julianhyde commented on code in PR #3334:
URL: https://github.com/apache/calcite/pull/3334#discussion_r1272902346
##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -3076,16 +3076,14 @@ void checkCorrelatedMapSubQuery(boolean expand) {
sql(sql).ok();
}
- @Disabled("CALCITE-985")
@Test void testMerge() {
- final String sql = "merge into emp as target\n"
- + "using (select * from emp where deptno = 30) as source\n"
- + "on target.empno = source.empno\n"
- + "when matched then\n"
- + " update set sal = sal + source.sal\n"
- + "when not matched then\n"
- + " insert (empno, deptno, sal)\n"
- + " values (source.empno, source.deptno, source.sal)";
+ final String sql = "merge into empnullables e "
Review Comment:
Can you end each line of SQL with "\n" (and no space). It makes the SQL
easier to read inside `SqlToRelConverterTest.xml`.
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2256,11 +2256,16 @@ protected void registerNamespace(
@Nullable String alias,
SqlValidatorNamespace ns,
boolean forceNullable) {
- namespaces.put(requireNonNull(ns.getNode(), () -> "ns.getNode() for " +
ns), ns);
+ final SqlNode sqlNode = requireNonNull(ns.getNode(), () -> "ns.getNode()
for " + ns);
Review Comment:
Consider removing the `sqlNode` variable. After you've called
`requireNonNull(ns.getNode())` the validator will no longer complain.
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -5269,6 +5274,20 @@ private static SqlNode getNthExpr(SqlNode query, int
ordinal, int sourceCount) {
SqlInsert insertCallAfterValidate = call.getInsertCall();
if (insertCallAfterValidate != null) {
validateInsert(insertCallAfterValidate);
+ // Validate NULL
Review Comment:
I didn't understand the 'Validate NULL' comment at first. 'Throw if select
list contains NULL literal and target is NOT NULL' might be better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]