Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

qiuchenjian
Copy link
Contributor

@qiuchenjian qiuchenjian commented Feb 8, 2019

[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.

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2557/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2787/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10816/

@akashrn5
Copy link
Contributor

@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.

@qiuchenjian
Copy link
Contributor Author

@akashrn5
Because they are different issues and different PRs, If we put a class, we will have a conflict。
Can we handle your suggest using a new PR, when the PRs are merged?

@akashrn5
Copy link
Contributor

@qiuchenjian you can do that, please refer the new comment given in #3101 , to place all rules in BirdcageOptimizer.

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2927/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/11188/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/3158/

@qiuchenjian
Copy link
Contributor Author

@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 {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants