-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add PreAgg Hint #1617
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
Add PreAgg Hint #1617
Conversation
fe/src/main/cup/sql_parser.cup
Outdated
| nonterminal ArrayList<String> opt_sort_hints; | ||
| nonterminal Expr sign_chain_expr; | ||
| nonterminal Qualifier union_op; | ||
| nonterminal String opt_agg_open_hints; |
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.
change this name? This can be hint for other purpose.
I think it should be a List, cause we can support other hints 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.
Ok
| isAnalyzed = true; // true that we have assigned desc | ||
| analyzeJoin(analyzer); | ||
| analyzeSortHints(); | ||
| analyzeAggOpenedHints(); |
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.
analyzeHints?
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.
ok
| ((OlapScanNode) root).setIsPreAggregation(false, turnOffReason); | ||
| if ((root instanceof OlapScanNode)) { | ||
| OlapScanNode node = (OlapScanNode) root; | ||
| for (TableRef tableRef : selectStmt.getTableRefs()) {// Force Open PreAgg |
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.
what do this logic means to do?
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.
We must have to match the table name,so we can set OpenPreAgg flags
| } | ||
|
|
||
| if (((OlapScanNode)root).getForceOpenPreAgg()) { | ||
| return;//OlapScanNode has be forced opened PreAgg then the function return directly. |
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.
why return?
you should call olapNode.setIsPreAggregation(true, null);
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.
if return value of the function getForceOpenPreAgg() is true, the OlapScanNode has be set TRUE,so we don't call olapNode.setIsPreAggregation(true, null);
morningman
left a comment
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.
LGTM
| DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? | ||
|
|
||
| EolHintBegin = "--" " "* "+" | ||
| CommentedHintBegin = "/*" " "* "+" |
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 your change will cause problem for query like "select /* test */ a from test"
imay
left a comment
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.
LGTM
We can force open PreAgg function if it has'nt aggregation information in SQL.