-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[FLINK-4068] [tableAPI] Move constant computations out of code-generated #2102
Conversation
Thanks for the PR @wuchong! I will have a look at it soon :-) |
@@ -146,4 +148,21 @@ class SelectITCase( | |||
tEnv.sql(sqlQuery) | |||
} | |||
|
|||
@Test | |||
def testConstantReduce(): Unit = { |
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 think the assertion of this this test should not check the name of the generate Flink operator.
Instead I propose the following:
- split the
translate()
method into anoptimize()
method that generates the optimizedRelNode
tree and atranslate()
method that translates into aDataSet
/DataStream
program. - make the
optimize()
methodprivate[flink]
and therefore accessible from a unit test - add a
BatchTableEnvironmentTest
and aStreamTableEnvironmentTest
which check that the optimizedRelNode
tree contains reduced expressions.
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.
👍 It's a good idea. I will try it later. And the CI throws cannot translate call AS...
error, I will figure it out today.
This @wuchong, your approach looks good. I also found that the However, it seems that several tests of In addition, the added test should be changed as sketched in the comment. Please let me know if you have questions. Thanks, Fabian |
After introducing
|
Regarding 3.: I already have some code in a branch that introduces symbols instead of the "Integer hack" we are currently using, but I haven't finished it so far. I can solve this issue for you. |
@twalthr That sounds great ! Thank you . |
@wuchong I have added symbols recently. So functions like |
Thanks @twalthr . This issue is more complex than I expected before. I will try to update this PR in next days. |
As I mentioned above, the |
The
ReduceExpressionsRule
rule can reduce constant expressions and replacing them with the corresponding constant. We haveReduceExpressionsRule.CALC_INSTANCE
in bothDATASET_OPT_RULES
andDATASET_OPT_RULES
, but it dose not take effect. Because it require the planner have an executor to evaluate the constant expressions. This PR does this, and resolve FLINK-4068.And some tests added.