[GitHub] carbondata pull request #2671: [WIP]AVRO datatype support through SDK

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2671: [CARBONDATA-2876]AVRO datatype support throug...

qiuchenjian-2
Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2671#discussion_r214244301
 
    --- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/AvroCarbonWriter.java ---
    @@ -213,6 +181,124 @@ private Object avroFieldToObject(Schema.Field avroField, Object fieldValue) {
             }
             out = new ArrayObject(arrayChildObjects);
             break;
    +      case UNION:
    +        // Union type will be internally stored as Struct<col:type>
    +        // Fill data object only if fieldvalue is instance of datatype
    +        // For other field datatypes, fill value as Null
    +        List<Schema> unionFields = avroField.schema().getTypes();
    +        int notNullUnionFieldsCount = 0;
    +        for (Schema unionField : unionFields) {
    +          if (!unionField.getType().equals(Schema.Type.NULL)) {
    +            notNullUnionFieldsCount++;
    +          }
    +        }
    +        Object[] values = new Object[notNullUnionFieldsCount];
    +        int j = 0;
    +        for (Schema unionField : unionFields) {
    +          if (!unionField.getType().equals(Schema.Type.NULL) && checkFieldValueType(
    +              unionField.getType(), fieldValue)) {
    +            values[j] = avroFieldToObjectForUnionType(unionField, fieldValue, avroField);
    +            break;
    +          }
    +          if (notNullUnionFieldsCount != 1) {
    +            j++;
    +          }
    +        }
    --- End diff --
   
    Modify the code as below
            int j = 0;
            for (Schema unionField : unionFields) {
              if (unionField.getType().equals(Schema.Type.NULL) ) {
                 continue;
              }
               if (checkFieldValueType(unionField.getType(), fieldValue)) {
                values[j] = avroFieldToObjectForUnionType(unionField, fieldValue, avroField);
                break;
              }
              j++;
            }


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2671: [CARBONDATA-2876]AVRO datatype support through SDK

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user manishgupta88 commented on the issue:

    https://github.com/apache/carbondata/pull/2671
 
    LGTM...can be merged once build passes


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2671: [CARBONDATA-2876]AVRO datatype support through SDK

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2671
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/8197/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2671: [CARBONDATA-2876]AVRO datatype support through SDK

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2671
 
    Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/126/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2671: [CARBONDATA-2876]AVRO datatype support throug...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user asfgit closed the pull request at:

    https://github.com/apache/carbondata/pull/2671


---
12