Koylubaev Nikita created FLINK-28518: ----------------------------------------
Summary: Exception: AssertionError: Cannot add expression of different type to set in sub-query with ROW type Key: FLINK-28518 URL: https://issues.apache.org/jira/browse/FLINK-28518 Project: Flink Issue Type: Bug Components: Table SQL / Planner Affects Versions: 1.15.1 Reporter: Koylubaev Nikita Attachments: test.sql All scripts is attached to file: test.sql Create 2 tables: {code:java} SET 'sql-client.execution.result-mode' = 'tableau'; SET 'execution.runtime-mode' = 'batch'; SET 'sql-client.execution.mode' = 'streaming'; SET 'parallelism.default' = '8'; SET 'table.dml-sync' = 'true'; CREATE TEMPORARY TABLE fl ( `id` INT, `name` STRING) WITH ( 'connector' = 'faker', 'number-of-rows' = '10', 'rows-per-second' = '10000', 'fields.id.expression' = '#{number.numberBetween ''0'',''10''}', 'fields.name.expression' = '#{superhero.name}'); CREATE TEMPORARY TABLE application ( `id` INT, `fl_id` INT, `num` INT, `db` DOUBLE) WITH ( 'connector' = 'faker', 'number-of-rows' = '100', 'rows-per-second' = '1000000', 'fields.id.expression' = '#{number.numberBetween ''0'',''1000000''}', 'fields.fl_id.expression' = '#{number.numberBetween ''0'',''10''}', 'fields.num.expression' = '#{number.numberBetween ''-2147483648'',''2147483647''}', 'fields.db.expression' = '#{number.randomDouble ''3'',''-1000'',''1000''}'); {code} The next SQL throw exception: {code:java} select fl.name, (select (COLLECT(application.num), COLLECT(application.db)) from application where fl.id = application.fl_id) from fl;{code} Error stack trace is (I marked what is different in type: it's just NOT NULL): {code:java} [ERROR] Could not execute SQL statement. Reason: java.lang.AssertionError: Cannot add expression of different type to set: set type is RecordType(INTEGER id, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" name, RecordType(INTEGER MULTISET EXPR$0, DOUBLE MULTISET EXPR$1) $f0) NOT NULL expression type is RecordType(INTEGER id, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" name, RecordType(INTEGER MULTISET EXPR$0, DOUBLE MULTISET EXPR$1) NOT NULL $f0) NOT NULL set is rel#129:LogicalCorrelate.NONE.any.[](left=HepRelVertex#119,right=HepRelVertex#128,correlation=$cor0,joinType=left,requiredColumns={0}) expression is LogicalProject(id=[$0], name=[$1], $f0=[ROW($2, $3)]) LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}]) LogicalTableScan(table=[[default_catalog, default_database, fl]]) LogicalAggregate(group=[{}], agg#0=[COLLECT($0)], agg#1=[COLLECT($1)]) LogicalProject(num=[$2], db=[$3]) LogicalFilter(condition=[=($cor0.id, $1)]) LogicalTableScan(table=[[default_catalog, default_database, application]]) {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)