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-3196] [CARBONDATA-3203]Fixed Compaction for Complex types with Dictionary Include and also supported Compaction for restructured table #3022
Conversation
5e975de
to
0045616
Compare
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1929/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1930/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10183/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2140/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1952/ |
@@ -1068,4 +1068,40 @@ class TestCompactionComplexType extends QueryTest with BeforeAndAfterAll { | |||
sql("Drop table if exists adaptive") | |||
} | |||
|
|||
test("Test major compaction for struct of array type") { | |||
sql("DROP TABLE IF EXISTS carbon") |
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.
- Include dropping of table in afterAll also
- Give the test case description as below
Test major compaction with dictionary include for struct of array type
new int[segmentProperties.getDimColumnsCardinality().length + segmentProperties | ||
.getComplexDimColumnCardinality().length]; | ||
for (int i = 0; i < segmentProperties.getDimColumnsCardinality().length; i++) { | ||
dimAndComplexColumnCardinality[i] = segmentProperties.getDimColumnsCardinality()[i]; |
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.
Check for a resturcture drop column case when few loads are done and then dictionary column is dropped and compaction is triggered. In that case segmentProperties will contain cardinality of dropped column also check finally what is the schema and cardinality written during compaction
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 restructure case is not handled for complex types compaction. I have raised the JIRA issue and I will handle it. Please find the JIRA link : 'https://issues.apache.org/jira/browse/CARBONDATA-3203' .
@@ -699,4 +701,33 @@ public static boolean isRawDataRequired(CarbonDataLoadConfiguration configuratio | |||
return iterators; | |||
} | |||
|
|||
public static int[] calcDimensionLengths(int numberOfSortColumns, int[] complexCardinality) { | |||
if (!(numberOfSortColumns > 0)) { |
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.
- Rewrite the condition
if (!(numberOfSortColumns > 0))
asif (numberOfSortColumns == 0)
- The functionality of this method is not clear. Add a comment to explain the logic explanation and use of this method
for (int eachDimLen : complexCardinality) { | ||
if (eachDimLen != 0) dimsLenList.add(eachDimLen); | ||
} | ||
int[] dimLens = new int[dimsLenList.size()]; |
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.
Conversion from arrayList to array can be done directly
return dimLens; | ||
} | ||
|
||
public static KeyGenerator[] createKeyGeneratorForComplexDimension(int numberOfSortColumns, |
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.
Add a method comment to explain the logic and method usage
Build Failed with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10205/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2227/ |
0045616
to
2011ecb
Compare
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2257/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2051/ |
Build Failed with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10303/ |
2011ecb
to
b715677
Compare
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2062/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2266/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10315/ |
LGTM |
… with Dictionary Include and also supported Compaction for restructured table Problem1: Compaction Failing for Complex datatypes with Dictionary Include as KeyGenenrator was not being set in model for Dictionary Include Complex Columns and dictionary include complex columns were not handled for finding cardinality. Solution: Handled both these issues by setting KeyGenerator and storing cardinality of Complex dictionary include columns. Problem2: Compaction was failing for restructured table containing dictionary include complex columns. Solution: Handled complex columns for this case by inserting correct indices of the columns. This closes #3022
… with Dictionary Include and also supported Compaction for restructured table Problem1: Compaction Failing for Complex datatypes with Dictionary Include as KeyGenenrator was not being set in model for Dictionary Include Complex Columns and dictionary include complex columns were not handled for finding cardinality. Solution: Handled both these issues by setting KeyGenerator and storing cardinality of Complex dictionary include columns. Problem2: Compaction was failing for restructured table containing dictionary include complex columns. Solution: Handled complex columns for this case by inserting correct indices of the columns. This closes apache#3022
Problem1: Compaction Failing for Complex datatypes with Dictionary Include as KeyGenenrator was not being set in model for Dictionary Include Complex Columns and dictionary include complex columns were not handled for finding cardinality.
Solution: Handled both these issues by setting KeyGenerator and storing cardinality of Complex dictionary include columns.
Problem2: Compaction was failing for restructured table containing dictionary include complex columns.
Solution: Handled complex columns for this case by inserting correct indices of the columns.
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.