-
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-1703] Refactored code for creation of filter for IN expression #1650
Conversation
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/1914/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/685/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2247/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/703/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/1932/ |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2263/ |
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/741/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/1972/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2291/ |
convertToJavaList(values.map(f => getCarbonLiteralExpression(name, f)).toList)))) | ||
if (values.length == 1 && values(0) == null) { | ||
Some(new InExpression(getCarbonExpression(name), | ||
new ListExpression( |
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.
Please make the In and Not In filter as par of TransformExpression. For e.g. Please look into line no 321-323..when it was corrected there it got missed in createFilter.
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 have made the null check for IN expression in line no. 89
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 two conditions length=1 and others when logic is same. only else condition should be sufficient
- Not In case when null comes, in method TransformExpression (as sounak pointed), the behaviour was similar to falseExpression. So we have to conform not IN null case with hive to decide the behaviour.
- Please add test cases for In and Not in case with null expression and compare behaviour with hive.
- can isNullLiteral(_) possible anytime? as it is in TransformExpression method.
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.
The 1 condition was added when we have only NULL in our IN expression for that case, the Left expression was becoming NULL. So to avoid that we added this case.
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/788/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2022/ |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2334/ |
ok to test |
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/809/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2351/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2040/ |
2. Added related test cases
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2086/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/861/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2384/ |
retest this please |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2392/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/875/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2100/ |
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/878/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2103/ |
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/945/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2174/ |
@gvramana Please review again, as I have made the required changes |
new ListExpression( | ||
convertToJavaList(values.map(f => getCarbonLiteralExpression(name, f)).toList)))) | ||
if (values.length == 1 && values(0) == null) { | ||
Some(new InExpression(getCarbonExpression(name), |
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.
In case there are only one value in In list and that is also qualifies as Null, then why cant we return False expression just like Not In case. i.e. Some(new FalseExpression(getCarbonExpression(name))).
@@ -75,6 +78,9 @@ class ExpressionWithNullTestCase extends QueryTest with BeforeAndAfterAll { | |||
checkAnswer(sql("select * from expression_test where id not in ('2')"), sql("select * from expression_test_hive where id not in ('2')")) | |||
checkAnswer(sql("select * from expression_test where id not in (cast('2' as int))"), sql("select * from expression_test_hive where id not in (cast('2' as int))")) | |||
// checkAnswer(sql("select * from expression_test where id not in (cast('null' as int))"), sql("select * from expression_test_hive where id not in (cast('null' as int))")) |
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.
Please uncomment the test cases and rerun it once.
@@ -75,6 +78,9 @@ class ExpressionWithNullTestCase extends QueryTest with BeforeAndAfterAll { | |||
checkAnswer(sql("select * from expression_test where id not in ('2')"), sql("select * from expression_test_hive where id not in ('2')")) | |||
checkAnswer(sql("select * from expression_test where id not in (cast('2' as int))"), sql("select * from expression_test_hive where id not in (cast('2' as int))")) | |||
// checkAnswer(sql("select * from expression_test where id not in (cast('null' as int))"), sql("select * from expression_test_hive where id not in (cast('null' as int))")) | |||
checkAnswer(sql("select * from expression_test where id not in (1,2,NULL)"), sql("select * from expression_test_hive where id not in (1,2,NULL)")) | |||
checkAnswer(sql("select * from expression_test where id not in (NULL)"), sql("select * from expression_test_hive where id not in (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.
Please add some more test cases with explicit cast and with Nulls
if (values.contains(null)) { | ||
Some(new FalseExpression(getCarbonExpression(name))) | ||
} else { | ||
Some(new NotInExpression(getCarbonExpression(name), |
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 similar changes are required in transformExpression also. In case Cast is not resolved by Spark then transformExpression will handle those expression. But prior doing any changes we need supporting test cases.
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.
Can you please provide scenario for the same
3884132
to
0c9dabe
Compare
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2387/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1171/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2394/ |
retest this please |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2409/ |
Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1185/ |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2593/ |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2594/ |
retest this please |
@geetikagupta16 can you add more description of this bug? what is the bug and what is the root analysis of it? |
@jackylk I have updated the PR description please check |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2436/ |
Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1212/ |
LGTM |
retest sdv please |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2696/ |
LGTM |
Problem: There was a difference in result set count of carbon and hive tables
Analysis: This difference was due to the creation of filters in hive and carbon. In hive 'NULL' is not added in filter creation for IN expression whereas in carbon we were adding 'NULL' also in filter creation
Solution: Removed addition of 'NULL' values in case of IN filter creation
Be sure to do all of the following checklist to help us incorporate
your contribution quickly and easily:
Any interfaces changed? No
Any backward compatibility impacted? No
Document update required? No
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.