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-2869] Add support for Avro Map data type support for SDK #2649
Conversation
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6330/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/7982/ |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6705/ |
Is this only for SDK or can be support in SQL CREATE TABLE also? |
Is map implemented as an array of struct<key, value>? |
|
40c678f
to
33b446f
Compare
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6355/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8004/ |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6727/ |
33b446f
to
c69468f
Compare
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6386/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8040/ |
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6762/ |
c69468f
to
f07a1ba
Compare
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6395/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8049/ |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6771/ |
f07a1ba
to
e67bd0c
Compare
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6417/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8080/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/21/ |
@@ -232,6 +235,10 @@ private ColumnSchema addColumn(StructField field, String parentName, AtomicInteg | |||
for (int i = 0; i < fields.size(); i++) { | |||
addColumn(fields.get(i), parentFieldName, valIndex, false, true); | |||
} | |||
} else if (field.getDataType().getName().equalsIgnoreCase("MAP")) { |
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 use DataTypes.isMapType(field.getDataType())
@@ -195,7 +196,8 @@ private ColumnSchema addColumn(StructField field, String parentName, AtomicInteg | |||
newColumn.setColumnReferenceId(newColumn.getColumnUniqueId()); | |||
newColumn.setEncodingList(createEncoding(field.getDataType(), isSortColumn, isComplexChild)); | |||
if (field.getDataType().isComplexType()) { | |||
if (field.getDataType().getName().equalsIgnoreCase("ARRAY")) { | |||
if (field.getDataType().getName().equalsIgnoreCase("ARRAY") || field.getDataType().getName() |
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 use DataTypes.isArrayType(field.getDataType())
super(name, parentname, blockIndex); | ||
} | ||
|
||
@Override public Object getDataBasedOnDataType(ByteBuffer dataBuffer) { |
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 comment to tell how we convert array to map
Map mapEntries = (HashMap) fieldValue; | ||
Object[] arrayMapChildObjects = new Object[mapEntries.size()]; | ||
if (!mapEntries.isEmpty()) { | ||
Iterator iterator = ((HashMap) fieldValue).entrySet().iterator(); |
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.
Use mapEntries
directly instead of typecast again
e67bd0c
to
f733feb
Compare
@ravipesala ...fixed review comment. Kindly review and merge |
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6451/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/66/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8137/ |
LGTM |
This PR supports Avro Map data type support. It supports reading and writing complex map data type data using SDK.
For reading and writing Map data type using SDK refer the below test classes for reference
No
No
No
Add test cases for verification
NA