Skip to content

Commit 243c3ad

Browse files
mihaibudiujulianhyde
authored andcommitted
[CALCITE-6617] TypeCoercion is not applied correctly to comparisons
Additional tests in cast.iq (Julian Hyde) Close #3998 Signed-off-by: Mihai Budiu <[email protected]>
1 parent 78e873d commit 243c3ad

File tree

16 files changed

+362
-141
lines changed

16 files changed

+362
-141
lines changed

arrow/src/test/java/org/apache/calcite/adapter/arrow/ArrowAdapterTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
374374
String sql = "select * from arrowdata\n"
375375
+ " where \"floatField\"=15.0";
376376
String plan = "PLAN=ArrowToEnumerableConverter\n"
377-
+ " ArrowFilter(condition=[=(CAST($2):DOUBLE, 15.0E0)])\n"
377+
+ " ArrowFilter(condition=[=($2, 15.0E0)])\n"
378378
+ " ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 3]])\n\n";
379379
String result = "intField=15; stringField=15; floatField=15.0; longField=15\n";
380380

@@ -666,7 +666,7 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
666666
@Test void testFilteredAgg() {
667667
String sql = "select SUM(SAL) FILTER (WHERE COMM > 400) as SALESSUM from EMP";
668668
String plan = "PLAN=EnumerableAggregate(group=[{}], SALESSUM=[SUM($0) FILTER $1])\n"
669-
+ " EnumerableCalc(expr#0..7=[{inputs}], expr#8=[400], expr#9=[>($t6, $t8)], "
669+
+ " EnumerableCalc(expr#0..7=[{inputs}], expr#8=[400:DECIMAL(19, 0)], expr#9=[>($t6, $t8)], "
670670
+ "expr#10=[IS TRUE($t9)], SAL=[$t5], $f1=[$t10])\n"
671671
+ " ArrowToEnumerableConverter\n"
672672
+ " ArrowTableScan(table=[[ARROW, EMP]], fields=[[0, 1, 2, 3, 4, 5, 6, 7]])\n\n";
@@ -684,7 +684,7 @@ static void initializeArrowState(@TempDir Path sharedTempDir)
684684
String sql = "select SUM(SAL) FILTER (WHERE COMM > 400) as SALESSUM from EMP group by EMPNO";
685685
String plan = "PLAN=EnumerableCalc(expr#0..1=[{inputs}], SALESSUM=[$t1])\n"
686686
+ " EnumerableAggregate(group=[{0}], SALESSUM=[SUM($1) FILTER $2])\n"
687-
+ " EnumerableCalc(expr#0..7=[{inputs}], expr#8=[400], expr#9=[>($t6, $t8)], "
687+
+ " EnumerableCalc(expr#0..7=[{inputs}], expr#8=[400:DECIMAL(19, 0)], expr#9=[>($t6, $t8)], "
688688
+ "expr#10=[IS TRUE($t9)], EMPNO=[$t0], SAL=[$t5], $f2=[$t10])\n"
689689
+ " ArrowToEnumerableConverter\n"
690690
+ " ArrowTableScan(table=[[ARROW, EMP]], fields=[[0, 1, 2, 3, 4, 5, 6, 7]])\n\n";

core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java

+58-6
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ private RelDataType getTightestCommonTypeOrThrow(
492492
}
493493

494494
/**
495-
* Determines common type for a comparison operator when one operand is String type and the
496-
* other is not. For date + timestamp operands, use timestamp as common type,
495+
* Determines common type for a comparison operator.
496+
* For date and timestamp operands, use timestamp as common type,
497497
* i.e. Timestamp(2017-01-01 00:00 ...) &gt; Date(2018) evaluates to be false.
498498
*/
499499
@Override public @Nullable RelDataType commonTypeForBinaryComparison(
@@ -509,9 +509,11 @@ private RelDataType getTightestCommonTypeOrThrow(
509509
return null;
510510
}
511511

512-
// DATETIME + CHARACTER -> DATETIME
513-
// REVIEW Danny 2019-09-23: There is some legacy redundant code in SqlToRelConverter
514-
// that coerce Datetime and CHARACTER comparison.
512+
if (SqlTypeUtil.sameNamedType(type1, type2)) {
513+
return factory.leastRestrictive(ImmutableList.of(type1, type2));
514+
}
515+
516+
// DATETIME < CHARACTER -> DATETIME
515517
if (SqlTypeUtil.isCharacter(type1) && SqlTypeUtil.isDatetime(type2)) {
516518
return factory.createTypeWithNullability(type2, type1.isNullable());
517519
}
@@ -520,7 +522,7 @@ private RelDataType getTightestCommonTypeOrThrow(
520522
return factory.createTypeWithNullability(type1, type2.isNullable());
521523
}
522524

523-
// DATE + TIMESTAMP -> TIMESTAMP
525+
// DATE < TIMESTAMP -> TIMESTAMP
524526
if (SqlTypeUtil.isDate(type1) && SqlTypeUtil.isTimestamp(type2)) {
525527
return factory.createTypeWithNullability(type2, type1.isNullable());
526528
}
@@ -556,6 +558,19 @@ private RelDataType getTightestCommonTypeOrThrow(
556558
return null;
557559
}
558560

561+
if (SqlTypeUtil.isString(type1) && SqlTypeUtil.isString(type2)) {
562+
// Return the string with the larger precision
563+
if (type1.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED) {
564+
return factory.createTypeWithNullability(type1, type2.isNullable());
565+
} else if (type2.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED) {
566+
return factory.createTypeWithNullability(type2, type1.isNullable());
567+
} else if (type1.getPrecision() > type2.getPrecision()) {
568+
return factory.createTypeWithNullability(type1, type2.isNullable());
569+
} else {
570+
return factory.createTypeWithNullability(type2, type1.isNullable());
571+
}
572+
}
573+
559574
// 1 > '1' will be coerced to 1 > 1.
560575
if (SqlTypeUtil.isAtomic(type1) && SqlTypeUtil.isCharacter(type2)) {
561576
if (SqlTypeUtil.isTimestamp(type1)) {
@@ -581,6 +596,43 @@ private RelDataType getTightestCommonTypeOrThrow(
581596
}
582597
}
583598

599+
if (SqlTypeUtil.isApproximateNumeric(type1) && SqlTypeUtil.isApproximateNumeric(type2)) {
600+
if (type1.getPrecision() > type2.getPrecision()) {
601+
return factory.createTypeWithNullability(type1, type2.isNullable());
602+
} else {
603+
return factory.createTypeWithNullability(type2, type1.isNullable());
604+
}
605+
}
606+
607+
if (SqlTypeUtil.isApproximateNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) {
608+
return factory.createTypeWithNullability(type1, type2.isNullable());
609+
}
610+
611+
if (SqlTypeUtil.isApproximateNumeric(type2) && SqlTypeUtil.isExactNumeric(type1)) {
612+
return factory.createTypeWithNullability(type2, type1.isNullable());
613+
}
614+
615+
if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) {
616+
if (SqlTypeUtil.isDecimal(type1)) {
617+
// Use max precision
618+
RelDataType result =
619+
factory.createSqlType(type1.getSqlTypeName(),
620+
Math.max(type1.getPrecision(), type2.getPrecision()), type1.getScale());
621+
return factory.createTypeWithNullability(result, type1.isNullable() || type2.isNullable());
622+
} else if (SqlTypeUtil.isDecimal(type2)) {
623+
// Use max precision
624+
RelDataType result =
625+
factory.createSqlType(type2.getSqlTypeName(),
626+
Math.max(type1.getPrecision(), type2.getPrecision()), type2.getScale());
627+
return factory.createTypeWithNullability(result, type1.isNullable() || type2.isNullable());
628+
}
629+
if (type1.getPrecision() > type2.getPrecision()) {
630+
return factory.createTypeWithNullability(type1, type2.isNullable());
631+
} else {
632+
return factory.createTypeWithNullability(type2, type1.isNullable());
633+
}
634+
}
635+
584636
return null;
585637
}
586638

core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ public interface TypeCoercion {
9393
@Nullable RelDataType type1, @Nullable RelDataType type2);
9494

9595
/**
96-
* Determines common type for a comparison operator whose operands are STRING
97-
* type and the other (non STRING) type.
96+
* Determines common type for a comparison operator.
9897
*/
9998
@Nullable RelDataType commonTypeForBinaryComparison(
10099
@Nullable RelDataType type1, @Nullable RelDataType type2);

core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercionImpl.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import java.math.BigDecimal;
4949
import java.util.AbstractList;
5050
import java.util.ArrayList;
51-
import java.util.Arrays;
5251
import java.util.List;
5352
import java.util.stream.Collectors;
5453

@@ -291,18 +290,9 @@ protected boolean binaryArithmeticWithStrings(
291290
return null;
292291
}
293292

294-
RelDataType commonType;
295-
if (SqlTypeUtil.sameNamedType(type1, type2)) {
296-
commonType = factory.leastRestrictive(Arrays.asList(type1, type2));
297-
} else {
298-
commonType = commonTypeForBinaryComparison(type1, type2);
299-
}
293+
RelDataType commonType = commonTypeForBinaryComparison(type1, type2);
300294
for (int i = 2; i < dataTypes.size() && commonType != null; i++) {
301-
if (SqlTypeUtil.sameNamedType(commonType, dataTypes.get(i))) {
302-
commonType = factory.leastRestrictive(Arrays.asList(commonType, dataTypes.get(i)));
303-
} else {
304-
commonType = commonTypeForBinaryComparison(commonType, dataTypes.get(i));
305-
}
295+
commonType = commonTypeForBinaryComparison(commonType, dataTypes.get(i));
306296
}
307297
return commonType;
308298
}

core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -319,33 +319,33 @@ private static String toSql(RelNode root, SqlDialect dialect,
319319
+ "where \"product_id\" > 0\n"
320320
+ "group by \"product_id\"";
321321
final String expectedDefault = "SELECT"
322-
+ " SUM(\"shelf_width\") FILTER (WHERE \"net_weight\" > 0 IS TRUE),"
322+
+ " SUM(\"shelf_width\") FILTER (WHERE \"net_weight\" > 0E0 IS TRUE),"
323323
+ " SUM(\"shelf_width\")\n"
324324
+ "FROM \"foodmart\".\"product\"\n"
325325
+ "WHERE \"product_id\" > 0\n"
326326
+ "GROUP BY \"product_id\"";
327327
final String expectedBigQuery = "SELECT"
328-
+ " SUM(CASE WHEN net_weight > 0 IS TRUE"
328+
+ " SUM(CASE WHEN net_weight > 0E0 IS TRUE"
329329
+ " THEN shelf_width ELSE NULL END), "
330330
+ "SUM(shelf_width)\n"
331331
+ "FROM foodmart.product\n"
332332
+ "WHERE product_id > 0\n"
333333
+ "GROUP BY product_id";
334334
final String expectedFirebolt = "SELECT"
335-
+ " SUM(CASE WHEN \"net_weight\" > 0 IS TRUE"
335+
+ " SUM(CASE WHEN \"net_weight\" > 0E0 IS TRUE"
336336
+ " THEN \"shelf_width\" ELSE NULL END), "
337337
+ "SUM(\"shelf_width\")\n"
338338
+ "FROM \"foodmart\".\"product\"\n"
339339
+ "WHERE \"product_id\" > 0\n"
340340
+ "GROUP BY \"product_id\"";
341341
final String expectedMysql = "SELECT"
342-
+ " SUM(CASE WHEN `net_weight` > 0 IS TRUE"
342+
+ " SUM(CASE WHEN `net_weight` > 0E0 IS TRUE"
343343
+ " THEN `shelf_width` ELSE NULL END), SUM(`shelf_width`)\n"
344344
+ "FROM `foodmart`.`product`\n"
345345
+ "WHERE `product_id` > 0\n"
346346
+ "GROUP BY `product_id`";
347347
final String expectedStarRocks = "SELECT"
348-
+ " SUM(CASE WHEN `net_weight` > 0 IS TRUE"
348+
+ " SUM(CASE WHEN `net_weight` > 0E0 IS TRUE"
349349
+ " THEN `shelf_width` ELSE NULL END), SUM(`shelf_width`)\n"
350350
+ "FROM `foodmart`.`product`\n"
351351
+ "WHERE `product_id` > 0\n"
@@ -539,7 +539,7 @@ private static String toSql(RelNode root, SqlDialect dialect,
539539
final String expected = "SELECT *\n"
540540
+ "FROM \"foodmart\".\"product\"\n"
541541
+ "WHERE (\"product_id\" = 10 OR \"product_id\" <= 5) "
542-
+ "AND (80 >= \"shelf_width\" OR \"shelf_width\" > 30)";
542+
+ "AND (CAST(80 AS DOUBLE) >= \"shelf_width\" OR \"shelf_width\" > CAST(30 AS DOUBLE))";
543543
sql(query).ok(expected);
544544
}
545545

@@ -2097,34 +2097,34 @@ private void checkHavingAliasSameAsColumn(boolean upperAlias) {
20972097
+ " sum(\"gross_weight\") as \"" + alias + "\"\n"
20982098
+ "from \"product\"\n"
20992099
+ "group by \"product_id\"\n"
2100-
+ "having sum(\"product\".\"gross_weight\") < 200";
2100+
+ "having sum(\"product\".\"gross_weight\") < 2.000E2";
21012101
// PostgreSQL has isHavingAlias=false, case-sensitive=true
21022102
final String expectedPostgresql = "SELECT \"product_id\" + 1,"
21032103
+ " SUM(\"gross_weight\") AS \"" + alias + "\"\n"
21042104
+ "FROM \"foodmart\".\"product\"\n"
21052105
+ "GROUP BY \"product_id\"\n"
2106-
+ "HAVING SUM(\"gross_weight\") < 200";
2106+
+ "HAVING SUM(\"gross_weight\") < 2.000E2";
21072107
// MySQL has isHavingAlias=true, case-sensitive=true
21082108
final String expectedMysql = "SELECT `product_id` + 1, `" + alias + "`\n"
21092109
+ "FROM (SELECT `product_id`, SUM(`gross_weight`) AS `" + alias + "`\n"
21102110
+ "FROM `foodmart`.`product`\n"
21112111
+ "GROUP BY `product_id`\n"
2112-
+ "HAVING `" + alias + "` < 200) AS `t1`";
2112+
+ "HAVING `" + alias + "` < 2.000E2) AS `t1`";
21132113
// BigQuery has isHavingAlias=true, case-sensitive=false
21142114
final String expectedBigQuery = upperAlias
21152115
? "SELECT product_id + 1, GROSS_WEIGHT\n"
21162116
+ "FROM (SELECT product_id, SUM(gross_weight) AS GROSS_WEIGHT\n"
21172117
+ "FROM foodmart.product\n"
21182118
+ "GROUP BY product_id\n"
2119-
+ "HAVING GROSS_WEIGHT < 200) AS t1"
2119+
+ "HAVING GROSS_WEIGHT < 2.000E2) AS t1"
21202120
// Before [CALCITE-3896] was fixed, we got
21212121
// "HAVING SUM(gross_weight) < 200) AS t1"
21222122
// which on BigQuery gives you an error about aggregating aggregates
21232123
: "SELECT product_id + 1, gross_weight\n"
21242124
+ "FROM (SELECT product_id, SUM(gross_weight) AS gross_weight\n"
21252125
+ "FROM foodmart.product\n"
21262126
+ "GROUP BY product_id\n"
2127-
+ "HAVING gross_weight < 200) AS t1";
2127+
+ "HAVING gross_weight < 2.000E2) AS t1";
21282128
sql(query)
21292129
.withBigQuery().ok(expectedBigQuery)
21302130
.withPostgresql().ok(expectedPostgresql)
@@ -2144,11 +2144,11 @@ private void checkHavingAliasSameAsColumn(boolean upperAlias) {
21442144
final String expected = "SELECT \"product_id\"\n"
21452145
+ "FROM (SELECT \"product_id\", AVG(\"gross_weight\") AS \"AGW\"\n"
21462146
+ "FROM \"foodmart\".\"product\"\n"
2147-
+ "WHERE \"net_weight\" < 100\n"
2147+
+ "WHERE \"net_weight\" < CAST(100 AS DOUBLE)\n"
21482148
+ "GROUP BY \"product_id\"\n"
2149-
+ "HAVING AVG(\"gross_weight\") > 50) AS \"t2\"\n"
2149+
+ "HAVING AVG(\"gross_weight\") > CAST(50 AS DOUBLE)) AS \"t2\"\n"
21502150
+ "GROUP BY \"product_id\"\n"
2151-
+ "HAVING AVG(\"AGW\") > 60";
2151+
+ "HAVING AVG(\"AGW\") > 6.00E1";
21522152
sql(query).ok(expected);
21532153
}
21542154

@@ -5366,21 +5366,21 @@ private void checkLiteral2(String expression, String expected) {
53665366
+ "UNION ALL\n"
53675367
+ "SELECT NULL) END AS `$f0`\n"
53685368
+ "FROM `foodmart`.`product`) AS `t0` ON TRUE\n"
5369-
+ "WHERE `product`.`net_weight` > `t0`.`$f0`";
5369+
+ "WHERE `product`.`net_weight` > CAST(`t0`.`$f0` AS DOUBLE)";
53705370
final String expectedPostgresql = "SELECT \"product\".\"product_class_id\" AS \"C\"\n"
53715371
+ "FROM \"foodmart\".\"product\"\n"
53725372
+ "LEFT JOIN (SELECT CASE COUNT(*) WHEN 0 THEN NULL WHEN 1 THEN MIN(\"product_class_id\") ELSE (SELECT CAST(NULL AS INTEGER)\n"
53735373
+ "UNION ALL\n"
53745374
+ "SELECT CAST(NULL AS INTEGER)) END AS \"$f0\"\n"
53755375
+ "FROM \"foodmart\".\"product\") AS \"t0\" ON TRUE\n"
5376-
+ "WHERE \"product\".\"net_weight\" > \"t0\".\"$f0\"";
5376+
+ "WHERE \"product\".\"net_weight\" > CAST(\"t0\".\"$f0\" AS DOUBLE PRECISION)";
53775377
final String expectedHsqldb = "SELECT product.product_class_id AS C\n"
53785378
+ "FROM foodmart.product\n"
53795379
+ "LEFT JOIN (SELECT CASE COUNT(*) WHEN 0 THEN NULL WHEN 1 THEN MIN(product_class_id) ELSE ((VALUES 0E0)\n"
53805380
+ "UNION ALL\n"
53815381
+ "(VALUES 0E0)) END AS $f0\n"
53825382
+ "FROM foodmart.product) AS t0 ON TRUE\n"
5383-
+ "WHERE product.net_weight > t0.$f0";
5383+
+ "WHERE product.net_weight > CAST(t0.$f0 AS DOUBLE)";
53845384
sql(query)
53855385
.withConfig(c -> c.withExpand(true))
53865386
.withMysql().ok(expectedMysql)
@@ -6905,7 +6905,7 @@ private void checkLiteral2(String expression, String expected) {
69056905
+ "within group (order by \"net_weight\" desc) filter (where \"net_weight\" > 0)"
69066906
+ "from \"product\" group by \"product_class_id\"";
69076907
final String expected = "SELECT \"product_class_id\", COLLECT(\"net_weight\") "
6908-
+ "FILTER (WHERE \"net_weight\" > 0 IS TRUE) "
6908+
+ "FILTER (WHERE \"net_weight\" > 0E0 IS TRUE) "
69096909
+ "WITHIN GROUP (ORDER BY \"net_weight\" DESC)\n"
69106910
+ "FROM \"foodmart\".\"product\"\n"
69116911
+ "GROUP BY \"product_class_id\"";
@@ -8241,7 +8241,7 @@ private void checkLiteral2(String expression, String expected) {
82418241
final String expected = "SELECT *\n"
82428242
+ "FROM TABLE(DEDUP(CURSOR ((SELECT \"product_id\", \"product_name\"\n"
82438243
+ "FROM \"foodmart\".\"product\"\n"
8244-
+ "WHERE \"net_weight\" > 100 AND \"product_name\" = 'Hello World')), "
8244+
+ "WHERE \"net_weight\" > CAST(100 AS DOUBLE) AND \"product_name\" = 'Hello World')), "
82458245
+ "CURSOR ((SELECT \"employee_id\", \"full_name\"\n"
82468246
+ "FROM \"foodmart\".\"employee\"\n"
82478247
+ "GROUP BY \"employee_id\", \"full_name\")), 'NAME'))";

core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,15 @@ private void checkPushJoinThroughUnionOnRightDoesNotMatchSemiOrAntiJoin(JoinRelT
31123112
.check();
31133113
}
31143114

3115+
/** Test case for
3116+
* <a href="https://issues.apache.org/jira/browse/CALCITE-6617">[CALCITE-6617]
3117+
* TypeCoercion is not applied correctly to comparisons</a>. */
3118+
@Test void testRand() {
3119+
final String sql = "SELECT * FROM (SELECT 1, ROUND(RAND()) AS A)\n"
3120+
+ "WHERE A BETWEEN 1 AND 10 OR A IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)";
3121+
sql(sql).withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS).check();
3122+
}
3123+
31153124
/** Test case for
31163125
* <a href="https://issues.apache.org/jira/browse/CALCITE-6481">[CALCITE-6481]
31173126
* Optimize 'VALUES...UNION...VALUES' to a single 'VALUES' the IN-list contains CAST

core/src/test/java/org/apache/calcite/test/TCatalogReader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TCatalogReader extends MockCatalogReader {
4949
t1.addColumn("t1_smallint", f.smallintType);
5050
t1.addColumn("t1_int", f.intType);
5151
t1.addColumn("t1_bigint", f.bigintType);
52-
t1.addColumn("t1_float", f.floatType);
52+
t1.addColumn("t1_real", f.realType);
5353
t1.addColumn("t1_double", f.doubleType);
5454
t1.addColumn("t1_decimal", f.decimalType);
5555
t1.addColumn("t1_timestamp", f.timestampType);
@@ -64,7 +64,7 @@ public class TCatalogReader extends MockCatalogReader {
6464
t2.addColumn("t2_smallint", f.smallintType);
6565
t2.addColumn("t2_int", f.intType);
6666
t2.addColumn("t2_bigint", f.bigintType);
67-
t2.addColumn("t2_float", f.floatType);
67+
t2.addColumn("t2_real", f.realType);
6868
t2.addColumn("t2_double", f.doubleType);
6969
t2.addColumn("t2_decimal", f.decimalType);
7070
t2.addColumn("t2_timestamp", f.timestampType);

core/src/test/java/org/apache/calcite/test/TypeCoercionConverterTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ public static void checkActualAndReferenceFiles() {
161161
// char decimal float double
162162
// char decimal smallint double
163163
final String sql = "select t1_int, t1_decimal, t1_smallint, t1_double from t1 "
164-
+ "union select t2_varchar20, t2_decimal, t2_float, t2_bigint from t2 "
165-
+ "union select t1_varchar20, t1_decimal, t1_float, t1_double from t1 "
164+
+ "union select t2_varchar20, t2_decimal, t2_real, t2_bigint from t2 "
165+
+ "union select t1_varchar20, t1_decimal, t1_real, t1_double from t1 "
166166
+ "union select t2_varchar20, t2_decimal, t2_smallint, t2_double from t2";
167167
sql(sql).ok();
168168
}
169169

170170
@Test void testInsertQuerySourceCoercion() {
171-
final String sql = "insert into t1 select t2_smallint, t2_int, t2_bigint, t2_float,\n"
171+
final String sql = "insert into t1 select t2_smallint, t2_int, t2_bigint, t2_real,\n"
172172
+ "t2_double, t2_decimal, t2_int, t2_date, t2_timestamp, t2_varchar20, t2_int from t2";
173173
sql(sql).ok();
174174
}

0 commit comments

Comments
 (0)