-
Notifications
You must be signed in to change notification settings - Fork 703
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
[CARBONDATA-3289] MV datamap doesn't take effect when having clause use alias #3122
Conversation
430ea51
to
7564f2e
Compare
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2557/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2787/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10816/ |
@qiuchenjian i think , to fix the issues you are adding new rules for MV plan optimizations, same in #3101 , so what i suggest is instead of making new class for every rule, why can't you place all rules inside one class and in different objects. |
@akashrn5 |
@qiuchenjian you can do that, please refer the new comment given in #3101 , to place all rules in BirdcageOptimizer. |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2927/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/11188/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/3158/ |
@akashrn5 done |
// This class is used to optimize the filter condition | ||
// If all of the conditions have alias on the aggregate expressions | ||
// it will be pull up and exchange the alias to match the MV | ||
object MVPredicateAlias extends Rule[LogicalPlan] with PredicateHelper { |
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.
Whatever is pushdown in PushDownPredicate
you are trying to pull up using this rule. Please just remove the PushDownPredicate
from the optimizer will solve all having clause issues. But the only issue will be with filter query on groupby queries , I think that issue can be fixed in MV module instead of adding a rule.
[Problem]
MV datamap doesn't take effect when having clause use alias
create table test_main(id int,name string,height int) using carbondata
create datamap test_main_mv using 'mv' as select cast(id + 1 as bigint) as cast_id ,count(name) from test_main group by cast_id
select cast(id + 1 as bigint) as cast_id,count(name) from test_main group by cast_id having cast_id < 3
select cast(id + 1 as bigint) as cast_id,count(name) from test_main where cast(id + 1 as bigint) < 3 group by cast_id
[Solution]
Add a rule to modify the logical plan to support this
Be sure to do all of the following checklist to help us incorporate
your contribution quickly and easily:
Any interfaces changed?
Any backward compatibility impacted?
Document update required?
Testing done
Please provide details on
- Whether new unit test cases have been added or why no new tests are required?
- How it is tested? Please attach test report.
- Is it a performance related change? Please attach the performance test report.
- Any additional information to help reviewers in testing this change.
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.