Jiajun Xie created CALCITE-5141: ----------------------------------- Summary: Implicit type conversion incomplete for insert values Key: CALCITE-5141 URL: https://issues.apache.org/jira/browse/CALCITE-5141 Project: Calcite Issue Type: Bug Components: core Reporter: Jiajun Xie Assignee: Jiajun Xie
- Target table schema {code:java} // Register "T1" table. final MockTable t1 = MockTable.create(this, tSchema, "T1", false, 7.0, null); t1.addColumn("t1_varchar20", f.varchar20Type, true); t1.addColumn("t1_smallint", f.smallintType); t1.addColumn("t1_int", f.intType); t1.addColumn("t1_bigint", f.bigintType); t1.addColumn("t1_float", f.floatType); t1.addColumn("t1_double", f.doubleType); t1.addColumn("t1_decimal", f.decimalType); t1.addColumn("t1_timestamp", f.timestampType); t1.addColumn("t1_date", f.dateType); t1.addColumn("t1_binary", f.binaryType); t1.addColumn("t1_boolean", f.booleanType); registerTable(t1); {code} - Insert query {code:java} insert into t1 values ('a', 1, 1.0, 0, 0, 0, 0, TIMESTAMP '2021-11-28 00:00:00', date '2021-11-28', x'0A', false), ('b', 2, 2, 0, 0, 0, 0, TIMESTAMP '2021-11-28 00:00:00', date '2021-11-28', x'0A', false), ('c', CAST(3 AS SMALLINT), 3.0, 0, 0, 0, 0, TIMESTAMP '2021-11-28 00:00:00', date '2021-11-28', x'0A', false), ('d', 4, 4.0, 0, 0, 0, 0, TIMESTAMP '2021-11-28 00:00:00', date '2021-11-28', x'0A', false), ('e', 5, 5.0, 0, 0, 0, 0, TIMESTAMP '2021-11-28 00:00:00', date '2021-11-28', x'0A', false) {code} - Incorrect converted plan: the data type is not matched with table schema {code:java} LogicalTableModify(table=[[CATALOG, SALES, T1]], operation=[INSERT], flattened=[false]) LogicalValues(tuples=[[ { 'a', 1, 1, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'b', 2, 2, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'c', 3, 3.0, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'd', 4, 4.0, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'e', 5, 5.0, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }]]) {code} - Correct converted plan {code:java} LogicalTableModify(table=[[CATALOG, SALES, T1]], operation=[INSERT], flattened=[false]) LogicalValues(tuples=[[ { 'a', 1, 1, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'b', 2, 2, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'c', 3, 3, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'd', 4, 4, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }, { 'e', 5, 5, 0, 0, 0, 0, 2021-11-28 00:00:00, 2021-11-28, X'0a', false }]]) {code} -- This message was sent by Atlassian Jira (v8.20.7#820007)