julianhyde commented on a change in pull request #1138: [CALCITE-1581] UDTF
like in hive
URL: https://github.com/apache/calcite/pull/1138#discussion_r315366715
##########
File path: core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
##########
@@ -102,12 +103,26 @@ public void validateCall(
// we don't want to validate the identifier.
final List<SqlNode> operands = call.getOperandList();
assert operands.size() == 2;
- assert operands.get(1) instanceof SqlIdentifier;
operands.get(0).validateExpr(validator, scope);
- SqlIdentifier id = (SqlIdentifier) operands.get(1);
- if (!id.isSimple()) {
- throw validator.newValidationError(id,
- RESOURCE.aliasMustBeSimpleIdentifier());
+
+ SqlNode asIdentifier = operands.get(1);
+ assert asIdentifier instanceof SqlIdentifier
+ || (asIdentifier instanceof SqlNodeList
+ && validator.getConformance().allowSelectTableFunction());
+
Review comment:
Simple rule of thumb. If you throw an exception (as opposed to using assert)
then you must add a test for that exception. If the parser has already checked,
and ensured that the condition is impossible, then you will find it impossible
to write a test case.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services