Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3616,9 +3616,10 @@ private RexNode convertUsing(SqlValidatorNamespace leftNamespace,
offset += rowType.getFieldList().size();
}

RelDataType resultType =
validator().getTypeCoercion().commonTypeForBinaryComparison(
comparedTypes.get(0), comparedTypes.get(1));
RelDataType resultType = validator().config().typeCoercionEnabled()
? validator().getTypeCoercion().commonTypeForBinaryComparison(
comparedTypes.get(0), comparedTypes.get(1))
: null;
if (resultType == null) {
// Leave call unchanged (as it happens in TypeCoercionImpl#binaryComparisonCoercion)
list.add(rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, operands));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5379,6 +5379,13 @@ void checkUserDefinedOrderByOver(NullCollation nullCollation) {
.ok();
}

/** Test case for <a href="https://issues.apache.org/jira/browse/CALCITE-7589">[CALCITE-7589]
* JOIN ... USING might fail with disabled type coercion</a>. */
@Test void testNaturalJoinCastNoCoercion2() {
final String sql = "select * from emp join dept using(deptno)";
sql(sql).withTypeCoercion(false).ok();
}

/** Tests LEFT JOIN LATERAL with multiple columns from outer. */
@Test void testLeftJoinLateral4() {
final String sql = "select * from (values (4,5)) as t(c,d)\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5670,6 +5670,19 @@ LogicalProject(X=[CAST($0):DECIMAL(2, 1) NOT NULL])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalValues(tuples=[[{ 'x' }]])
LogicalValues(tuples=[[{ 0.0 }]])
]]>
</Resource>
</TestCase>
<TestCase name="testNaturalJoinCastNoCoercion2">
<Resource name="sql">
<![CDATA[select * from emp join dept using(deptno)]]>
</Resource>
<Resource name="plan">
<![CDATA[
LogicalProject(DEPTNO=[$7], EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], NAME=[$10])
LogicalJoin(condition=[=($7, $9)], joinType=[inner])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
]]>
</Resource>
</TestCase>
Expand Down
Loading