Sergey Nuyanzin created CALCITE-7910:
----------------------------------------

             Summary: Minus and Intersect lose StructKind of nested ROW types 
in row type derivation
                 Key: CALCITE-7910
                 URL: https://issues.apache.org/jira/browse/CALCITE-7910
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Sergey Nuyanzin
            Assignee: Sergey Nuyanzin


Repro with {{PROJECT_FILTER_TRANSPOSE}} and {{MINUS_FILTER_TO_FILTER}}:

{code:sql}
SELECT contactno, coord_ne FROM customer.contact_peek
EXCEPT
SELECT contactno, coord_ne FROM customer.contact_peek WHERE contactno = 2
{code}

it fails as
{noformat}
 java.lang.AssertionError: Cannot add expression of different type to set:
    set type is RecordType(INTEGER NOT NULL CONTACTNO, RecordType(INTEGER NOT 
NULL M, RecordType(INTEGER NOT NULL A, INTEGER NOT NULL B) NOT NULL SUB) NOT 
NULL COORD_NE) NOT NULL
    expression type is RecordType(INTEGER NOT NULL CONTACTNO, 
RecordType:peek_no_expand(INTEGER NOT NULL M, RecordType:peek_no_expand(INTEGER 
NOT NULL A, INTEGER NOT NULL B) NOT NULL SUB) NOT NULL COORD_NE) NOT NULL
    set is 
rel#33:LogicalMinus.(input#0=HepRelVertex#29,input#1=HepRelVertex#32,all=false)
    expression is LogicalAggregate(group=[{0, 1}])
      LogicalFilter(condition=[<>($0, 2)])
        LogicalProject(CONTACTNO=[$0], COORD_NE=[$5])
          LogicalTableScan(table=[[CATALOG, CUSTOMER, CONTACT_PEEK]])
    Type mismatch:
    rowtype of original rel: RecordType(INTEGER NOT NULL CONTACTNO, 
RecordType(INTEGER NOT NULL M, RecordType(INTEGER NOT NULL A, INTEGER NOT NULL 
B) NOT NULL SUB) NOT NULL COORD_NE) NOT NULL
    rowtype of new rel: RecordType(INTEGER NOT NULL CONTACTNO, 
RecordType:peek_no_expand(INTEGER NOT NULL M, RecordType:peek_no_expand(INTEGER 
NOT NULL A, INTEGER NOT NULL B) NOT NULL SUB) NOT NULL COORD_NE) NOT NULL
    Difference:
    COORD_NE: RecordType(INTEGER NOT NULL M, RecordType(INTEGER NOT NULL A, 
INTEGER NOT NULL B) NOT NULL SUB) NOT NULL -> RecordType:peek_no_expand(INTEGER 
NOT NULL M, RecordType:peek_no_expand(INTEGER NOT NULL A, INTEGER NOT NULL B) 
NOT NULL SUB) NOT NULL
    
{noformat}

seems related to CALCITE-6451



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to