Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-27570

[CX] Allow comparisons of incompatible type to return NULL

    XMLWordPrintable

Details

    • CX Sprint 100, CX Sprint 101, CX Sprint 102, CX Sprint 103, CX Sprint 104, CX Sprint 105

    Description

      The Analytics engine should return NULL instead instead of an error for incompatible comparisons (as it is done in the N1QL engine today).

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            Moved to Mad-Hatter (with Sachin and Tai)

            till Till Westmann added a comment - Moved to Mad-Hatter (with Sachin and Tai)

            Need to determine

            • if types that cause exceptions right now are used in Analytics and
            • if the comparison on these types should return NULL instead.
            till Till Westmann added a comment - Need to determine if types that cause exceptions right now are used in Analytics and if the comparison on these types should return NULL instead.
            mihir.kamdar Mihir Kamdar (Inactive) added a comment - - edited

            Till Westmann is there a code change associated with this ticket? I need help understanding what is the fix so that I can validate it.

            mihir.kamdar Mihir Kamdar (Inactive) added a comment - - edited Till Westmann is there a code change associated with this ticket? I need help understanding what is the fix so that I can validate it.

            Hi Mihir Kamdar, yes, there is.

            The fix is to return NULL instead of error when doing a comparison on incompatible types, e.g. SELECT 1 < "string". Here are the steps to verify it:

            1. Try <, >, =, != and their combinations on incompatible types including arrays and records, e.g. {"name": "Dave"} = 3
            2. Use those comparison operators in a query:

            SELECT 1 < "String";
            SELECT [1,2] = 3;
             
            FROM ds SELECT ds.f1, ds.f2 WHERE ds.int_value_field > "test";
            FROM ds SELECT ds.f1, ds.f2 WHERE ds.record_value_field > [1, 2];
             
            FROM ds1, ds2 SELECT ds1.f1, ds2.f1 WHERE ds1.int_value_field = ds2.string_value_field; // no tuples will join since comparison should return NULL

             

            The fix is implemented by:

            https://issues.apache.org/jira/browse/ASTERIXDB-1223

            https://issues.apache.org/jira/browse/ASTERIXDB-2516

             

            ali.alsuliman Ali Alsuliman added a comment - Hi  Mihir Kamdar , yes, there is. The fix is to return NULL instead of error when doing a comparison on incompatible types, e.g. SELECT 1 < "string". Here are the steps to verify it: Try <, >, =, != and their combinations on incompatible types including arrays and records, e.g. {"name": "Dave"} = 3 Use those comparison operators in a query: SELECT 1 < "String" ; SELECT [ 1 , 2 ] = 3 ;   FROM ds SELECT ds.f1, ds.f2 WHERE ds.int_value_field > "test" ; FROM ds SELECT ds.f1, ds.f2 WHERE ds.record_value_field > [ 1 , 2 ];   FROM ds1, ds2 SELECT ds1.f1, ds2.f1 WHERE ds1.int_value_field = ds2.string_value_field; // no tuples will join since comparison should return NULL   The fix is implemented by: https://issues.apache.org/jira/browse/ASTERIXDB-1223 https://issues.apache.org/jira/browse/ASTERIXDB-2516  

            Verified on 6.5.0-4744.

            mihir.kamdar Mihir Kamdar (Inactive) added a comment - Verified on 6.5.0-4744.

            People

              ali.alsuliman Ali Alsuliman
              till Till Westmann
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty