gianm commented on code in PR #5349:
URL: https://github.com/apache/calcite/pull/5349#discussion_r4406885634


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercionImpl.java:
##########
@@ -118,6 +119,18 @@ public TypeCoercionImpl(RelDataTypeFactory typeFactory, 
SqlValidator validator)
     case WITH:
       SqlNode body = ((SqlWith) query).body;
       return rowTypeCoercion(validator.getOverScope(query), body, columnIndex, 
targetType);
+    case FROM_QUERY:
+    case PIPE_OPERATOR:
+      // A query in pipe syntax is validated and converted as its surrogate

Review Comment:
   It was defined in `SqlPipeOperator` (which is now renamed to `SqlPipeCall`) 
although I moved the definition to `SqlPipeQuery` where the `surrogateSelect()` 
method is defined.



##########
core/src/test/resources/sql/pipe.iq:
##########
@@ -0,0 +1,135 @@
+# pipe.iq - Tests for SQL pipe syntax
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Pipe syntax is only allowed under conformance levels that support it;
+# scott-lenient uses LENIENT conformance.
+!use scott-lenient
+!set outputformat mysql

Review Comment:
   They were validated against GoogleSQL. I added a comment, and also added a 
script to `core/src/test/resources/` that can aid in reproducing the validation.



##########
core/src/test/resources/sql/some.iq:
##########
@@ -1034,4 +1034,19 @@ select
 
 !ok
 
+# ALL over a WITH whose column needs coercion; the left operand is nullable
+# INTEGER and the right is TINYINT.
+select count(*) as c from emp

Review Comment:
   Oops, not really. I removed it.



-- 
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]

Reply via email to