-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-26495][table-planner] Prohibit hints(dynamic table options) on view #19007
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
Conversation
@flinkbot run azure |
|
@flinkbot run azure |
Hi, @JingsongLi, do you have time to take a look? |
Thanks @LadyForest for the contribution, can you add a case:
Explain select view2. |
def testOptionsHintOnTableApiView(): Unit = { | ||
val view1 = util.tableEnv.sqlQuery("select * from t1 join t2 on t1.a = t2.d") | ||
util.tableEnv.createTemporaryView("view1", view1) | ||
// The table hints on view expect to be ignored. |
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 appears that the previous behavior was by design, so we need to ensure that it is fully corrected.
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 appears that the previous behavior was by design.
Yes indeed. The hints are ignored quietly during planning phase. But it seems like our users are complaining the hints don't work. If we don't support hints on view, I think we'd better make it an explicit behavior. I'm afraid that the current design is somewhat not so much user-friendly. Beyond that, the current design is somewhat inconsistent, you can take a look at CatalogSourceTable#computeContextResolvedTable
at L#144, it also throws exception when encounteredTableKind.VIEW
. However, since the view expanding does not go through here, so this snippet of code does not get a chance to be called.
so we need to ensure that it is fully corrected
What do you mean by "ensure that it is fully corrected". Do you want to express we should ensure the exception is indeed thrown, or to ensure we don't throw exception when hints are imposed on table?
Sure |
@flinkbot run azure |
… view * Throw exception when expanding subquery * Fix the assertion order in CliClientITCase
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.
Looks good to me!
What is the purpose of the change
This PR aims to throw an explicit exception when querying a view with hints to improve user experience. Currently, the hints on view are swallowed quietly during the planning phase without any trace, and users complain that the hints don't work on view.
Brief changelog
ExpandingPreparingTable
to throw aValidationException
CliClientITCase
to correct the assertion order for expected and actualVerifying this change
This change added tests and can be verified as follows:
TableEnvironmentTest#testQueryViewWithHints
OptionHintsTest#testOptionsHintOnTableApiView
and#testOptionsHintOnSQLView
view.q
, which can be verified by runningCliClientITCase
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation