chunweilei commented on a change in pull request #2092:
URL: https://github.com/apache/calcite/pull/2092#discussion_r464986258
##########
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.config().sqlConformance().allowSelectTableFunction());
Review comment:
Before entering here, `handleTableFunctionInSelect` will be executed, in
which the validation and expansion happen. For example, if having
`TABLE_FUNC(1) AS (a, b)`, it will check whether the `TABLE_FUNC` is UDTF.
What's more, it would be expanded to `TABLE_FUNC.a` and `TABLE_FUNC.b`.
----------------------------------------------------------------
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]