-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[FLINK-35466][table] Implement star expansion in function calls in SE… #26438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -1051,6 +1051,14 @@ private SqlNode validateScopedExpression(SqlNode topNode, SqlValidatorScope scop | |||
if (outermostNode.isA(SqlKind.TOP_LEVEL)) { | |||
registerQuery(scope, null, outermostNode, outermostNode, null, false); | |||
} | |||
// ----- FLINK MODIFICATION BEGIN ----- | |||
if (outermostNode instanceof SqlSelect) { | |||
SqlSelect select = (SqlSelect) outermostNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not an expert on the table planner - but had some basic questions.
- I am not seeing how we know it is a select * . Is this related to
if (outermostNode instanceof SqlSelect) {
- Will this effect all
select *
code , include the working non UDFselect *
's? If so is there now redundant code we need to remove that dealt with the * later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you @davidradl for your review!
- I am not isolating
select *
for just theselect
node. This is about the star expansion in function calls only - This would not expand
*
alone, but only inSqlCall
. The implementation of that is quite hardcoded in theSqlValidator
and I did not touch that. However, I am able to re-use the sameexpandStar
method.
Does this answer your questions?
this.expr("foo(t1.x, t2.y, t3.z)").ok("`FOO`(`T1`.`X`, `T2`.`Y`, `T3`.`Z`)"); | ||
this.expr("foo(*)").ok("`FOO`(*)"); | ||
this.expr("foo(*^,^ x)").fails("(?s).*Encountered \",\" at line 1, column 6.*"); | ||
this.expr("foo(t1.*)").ok("`FOO`(`T1`.*)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about a quoted *
test. To check that the select does not expand
…LECT clause
What is the purpose of the change
This PR adds star expansion in SQL in order to gracefully handle statements like
SELECT myUDF(*) from MyTable
.Brief change log
SqlValidatorImpl
that re-uses the pre-existingexpandStar
method in the validator itself*
cannot be derivedAs of now, I did not update the class Javadoc with the lines of the update as I don't know if this is the best way to achieve the result. Waiting for a review to fix the Javadoc in case.
Verifying this change
This change added tests and can be verified as follows:
foo(*)
can be parsed as a valid function callSELECT
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation