You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/10/21 03:40:33 UTC

[GitHub] [hudi] liujinhui1994 opened a new pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

liujinhui1994 opened a new pull request #2192:
URL: https://github.com/apache/hudi/pull/2192


   ## *Tips*
   - *Thank you very much for contributing to Apache Hudi.*
   - *Please review https://hudi.apache.org/contributing.html before opening a pull request.*
   
   ## What is the purpose of the pull request
   
   
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-721585666


   OK, I will make changes, thanks for the suggestions
   @bvaradar 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-720497391


   @bvaradar  please help review


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on a change in pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on a change in pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#discussion_r521885133



##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -45,14 +50,32 @@ public void testPostProcessor() throws IOException {
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);
 
     Schema schema = provider.getSourceSchema();
     assertEquals(schema.getType(), Type.RECORD);
     assertEquals(schema.getName(), "test");
     assertNotNull(schema.getField("testString"));
   }
 
+  @Test
+  public void testSparkAvro() throws IOException {
+    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, SparkAvroPostProcessor.class.getName());
+    List<String> transformerClassNames = new ArrayList<>();
+    transformerClassNames.add(FlatteningTransformer.class.getName());
+
+    SchemaProvider provider =
+            UtilHelpers.wrapSchemaProviderWithPostProcessor(
+                    UtilHelpers.createSchemaProvider(SparkAvroSchemaProvider.class.getName(), properties, jsc),
+                    properties, jsc, transformerClassNames);
+
+    Schema schema = provider.getSourceSchema();

Review comment:
       Ok i will handle it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on a change in pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
bvaradar commented on a change in pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#discussion_r521884380



##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -45,14 +50,32 @@ public void testPostProcessor() throws IOException {
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);
 
     Schema schema = provider.getSourceSchema();
     assertEquals(schema.getType(), Type.RECORD);
     assertEquals(schema.getName(), "test");
     assertNotNull(schema.getField("testString"));
   }
 
+  @Test
+  public void testSparkAvro() throws IOException {
+    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, SparkAvroPostProcessor.class.getName());
+    List<String> transformerClassNames = new ArrayList<>();
+    transformerClassNames.add(FlatteningTransformer.class.getName());
+
+    SchemaProvider provider =
+            UtilHelpers.wrapSchemaProviderWithPostProcessor(
+                    UtilHelpers.createSchemaProvider(SparkAvroSchemaProvider.class.getName(), properties, jsc),
+                    properties, jsc, transformerClassNames);
+
+    Schema schema = provider.getSourceSchema();

Review comment:
       @liujinhui1994 : Rest looks good. Can you add a assertion to ensure the 2 schemas are different in this case




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] jingweiz2017 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
jingweiz2017 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-774653911


   I think I might run into a bug related to this particular fix. It was all good until I hit the type Decimal. Since it can either be FIXED or BYTES, if an avro schema contains decimal type with BYTES as its literal type, after this two way conversion its literal type become FIXED instead. This will cause an exception to be thrown in AvroConversionHelper as the data underneath is ByteBuffer rather than GenericFixed.       


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] codecov-io edited a comment on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717655063


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=h1) Report
   > Merging [#2192](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/7fa641ea9ad2318b185f8492964b30ebc90759b0?el=desc) will **increase** coverage by `0.09%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2192/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2192      +/-   ##
   ============================================
   + Coverage     53.62%   53.71%   +0.09%     
   - Complexity     2848     2855       +7     
   ============================================
     Files           359      360       +1     
     Lines         16553    16571      +18     
     Branches       1780     1783       +3     
   ============================================
   + Hits           8876     8901      +25     
   + Misses         6918     6912       -6     
   + Partials        759      758       -1     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
   | #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | #hudicommon | `54.73% <ø> (+<0.01%)` | `1795.00 <ø> (ø)` | |
   | #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
   | #hudispark | `65.95% <ø> (+0.52%)` | `304.00 <ø> (ø)` | |
   | #huditimelineservice | `62.29% <ø> (ø)` | `50.00 <ø> (ø)` | |
   | #hudiutilities | `70.14% <100.00%> (+0.06%)` | `332.00 <2.00> (+7.00)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `69.23% <ø> (-0.32%)` | `18.00 <0.00> (ø)` | |
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `64.02% <100.00%> (-0.58%)` | `32.00 <0.00> (+2.00)` | :arrow_down: |
   | [.../hudi/utilities/schema/SparkAvroPostProcessor.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TcGFya0F2cm9Qb3N0UHJvY2Vzc29yLmphdmE=) | `100.00% <100.00%> (ø)` | `2.00 <2.00> (?)` | |
   | [...java/org/apache/hudi/common/fs/StorageSchemes.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL2ZzL1N0b3JhZ2VTY2hlbWVzLmphdmE=) | `100.00% <0.00%> (ø)` | `10.00% <0.00%> (ø%)` | |
   | [...ava/org/apache/hudi/keygen/CustomKeyGenerator.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9rZXlnZW4vQ3VzdG9tS2V5R2VuZXJhdG9yLmphdmE=) | `82.60% <0.00%> (ø)` | `16.00% <0.00%> (ø%)` | |
   | [...g/apache/hudi/utilities/sources/AvroDFSSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvQXZyb0RGU1NvdXJjZS5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `84.44% <0.00%> (+2.39%)` | `14.00% <0.00%> (+2.00%)` | |
   | ... and [1 more](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree-more) | |
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-731889367


   @bvaradar  please help review


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] jingweiz2017 edited a comment on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
jingweiz2017 edited a comment on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-774653911


   I think I might run into a bug related to this particular fix. It was all good until I hit the type Decimal. Since it can either be FIXED or BYTES, if an avro schema contains decimal type with BYTES as its literal type, after this two way conversion its literal type become FIXED instead. This will cause an exception to be thrown in AvroConversionHelper as the data underneath is ByteBuffer rather than GenericFixed. @liujinhui1994 @bvaradar       


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] codecov-io commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717655063


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=h1) Report
   > Merging [#2192](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/7fa641ea9ad2318b185f8492964b30ebc90759b0?el=desc) will **increase** coverage by `0.09%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2192/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2192      +/-   ##
   ============================================
   + Coverage     53.62%   53.71%   +0.09%     
   - Complexity     2848     2855       +7     
   ============================================
     Files           359      360       +1     
     Lines         16553    16571      +18     
     Branches       1780     1783       +3     
   ============================================
   + Hits           8876     8901      +25     
   + Misses         6918     6912       -6     
   + Partials        759      758       -1     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
   | #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | #hudicommon | `54.73% <ø> (+<0.01%)` | `1795.00 <ø> (ø)` | |
   | #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
   | #hudispark | `65.95% <ø> (+0.52%)` | `304.00 <ø> (ø)` | |
   | #huditimelineservice | `62.29% <ø> (ø)` | `50.00 <ø> (ø)` | |
   | #hudiutilities | `70.14% <100.00%> (+0.06%)` | `332.00 <2.00> (+7.00)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `69.23% <ø> (-0.32%)` | `18.00 <0.00> (ø)` | |
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `64.02% <100.00%> (-0.58%)` | `32.00 <0.00> (+2.00)` | :arrow_down: |
   | [.../hudi/utilities/schema/SparkAvroPostProcessor.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TcGFya0F2cm9Qb3N0UHJvY2Vzc29yLmphdmE=) | `100.00% <100.00%> (ø)` | `2.00 <2.00> (?)` | |
   | [...java/org/apache/hudi/common/fs/StorageSchemes.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL2ZzL1N0b3JhZ2VTY2hlbWVzLmphdmE=) | `100.00% <0.00%> (ø)` | `10.00% <0.00%> (ø%)` | |
   | [...ava/org/apache/hudi/keygen/CustomKeyGenerator.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9rZXlnZW4vQ3VzdG9tS2V5R2VuZXJhdG9yLmphdmE=) | `82.60% <0.00%> (ø)` | `16.00% <0.00%> (ø%)` | |
   | [...g/apache/hudi/utilities/sources/AvroDFSSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvQXZyb0RGU1NvdXJjZS5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `84.44% <0.00%> (+2.39%)` | `14.00% <0.00%> (+2.00%)` | |
   | ... and [1 more](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree-more) | |
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] codecov-io edited a comment on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717655063


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=h1) Report
   > Merging [#2192](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=desc) (f82b423) into [master](https://codecov.io/gh/apache/hudi/commit/7fa641ea9ad2318b185f8492964b30ebc90759b0?el=desc) (7fa641e) will **decrease** coverage by `0.06%`.
   > The diff coverage is `77.77%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2192/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2192      +/-   ##
   ============================================
   - Coverage     53.62%   53.56%   -0.07%     
   + Complexity     2848     2775      -73     
   ============================================
     Files           359      349      -10     
     Lines         16553    16118     -435     
     Branches       1780     1645     -135     
   ============================================
   - Hits           8876     8633     -243     
   + Misses         6918     6786     -132     
   + Partials        759      699      -60     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | hudicli | `38.37% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | hudicommon | `55.33% <ø> (+0.59%)` | `0.00 <ø> (ø)` | |
   | hudihadoopmr | `32.94% <ø> (-0.12%)` | `0.00 <ø> (ø)` | |
   | hudispark | `65.58% <ø> (+0.16%)` | `0.00 <ø> (ø)` | |
   | huditimelineservice | `65.30% <ø> (+3.01%)` | `0.00 <ø> (ø)` | |
   | hudiutilities | `70.13% <77.77%> (+0.05%)` | `0.00 <2.00> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `69.23% <ø> (-0.32%)` | `18.00 <0.00> (ø)` | |
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `64.45% <75.00%> (-0.14%)` | `32.00 <0.00> (+2.00)` | :arrow_down: |
   | [.../hudi/utilities/schema/SparkAvroPostProcessor.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TcGFya0F2cm9Qb3N0UHJvY2Vzc29yLmphdmE=) | `80.00% <80.00%> (ø)` | `2.00 <2.00> (?)` | |
   | [...e/hudi/exception/HoodieDeltaStreamerException.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9leGNlcHRpb24vSG9vZGllRGVsdGFTdHJlYW1lckV4Y2VwdGlvbi5qYXZh) | `0.00% <0.00%> (-50.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [...i/common/table/view/HoodieTableFileSystemView.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL3ZpZXcvSG9vZGllVGFibGVGaWxlU3lzdGVtVmlldy5qYXZh) | `66.66% <0.00%> (-8.61%)` | `34.00% <0.00%> (+3.00%)` | :arrow_down: |
   | [...src/main/java/org/apache/hudi/DataSourceUtils.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9EYXRhU291cmNlVXRpbHMuamF2YQ==) | `40.95% <0.00%> (-3.81%)` | `19.00% <0.00%> (-3.00%)` | |
   | [...che/hudi/common/table/log/HoodieLogFileReader.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL2xvZy9Ib29kaWVMb2dGaWxlUmVhZGVyLmphdmE=) | `71.06% <0.00%> (-2.48%)` | `23.00% <0.00%> (-2.00%)` | |
   | [.../hadoop/utils/HoodieRealtimeRecordReaderUtils.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1oYWRvb3AtbXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvaGFkb29wL3V0aWxzL0hvb2RpZVJlYWx0aW1lUmVjb3JkUmVhZGVyVXRpbHMuamF2YQ==) | `73.04% <0.00%> (-1.52%)` | `30.00% <0.00%> (+1.00%)` | :arrow_down: |
   | [...common/table/view/PriorityBasedFileSystemView.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL3ZpZXcvUHJpb3JpdHlCYXNlZEZpbGVTeXN0ZW1WaWV3LmphdmE=) | `97.10% <0.00%> (-1.43%)` | `33.00% <0.00%> (ø%)` | |
   | ... and [43 more](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree-more) | |
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] yanghua commented on a change in pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#discussion_r535807469



##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -39,20 +44,51 @@
 
   private TypedProperties properties = new TypedProperties();
 
+  private static String ORIGINAL_SCHEMA = "{\"name\":\"t3_biz_operation_t_driver\",\"type\":\"record\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"null\",\"string\"],\"default\":null},"
+                                              + "{\"name\":\"ums_ts_\",\"type\":[\"null\",\"string\"],\"default\":null}]}";
+
+  private static String RESULT_SCHEMA = "{\"type\":\"record\",\"name\":\"hoodie_source\",\"namespace\":\"hoodie.source\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"string\",\"null\"]},"
+                                            + "{\"name\":\"ums_ts_\",\"type\":[\"string\",\"null\"]}]}";
+
   @Test
   public void testPostProcessor() throws IOException {
     properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, DummySchemaPostProcessor.class.getName());
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);

Review comment:
       Please add a backspace before `,null`.

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/SparkAvroSchemaProvider.java
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.utilities;
+
+import org.apache.avro.Schema;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.utilities.schema.SchemaProvider;
+import org.apache.spark.api.java.JavaSparkContext;
+
+public class SparkAvroSchemaProvider extends SchemaProvider {

Review comment:
       Does `SparkAvroTestSchemaProvider` look better?

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -39,20 +44,51 @@
 
   private TypedProperties properties = new TypedProperties();
 
+  private static String ORIGINAL_SCHEMA = "{\"name\":\"t3_biz_operation_t_driver\",\"type\":\"record\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"null\",\"string\"],\"default\":null},"
+                                              + "{\"name\":\"ums_ts_\",\"type\":[\"null\",\"string\"],\"default\":null}]}";
+
+  private static String RESULT_SCHEMA = "{\"type\":\"record\",\"name\":\"hoodie_source\",\"namespace\":\"hoodie.source\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"string\",\"null\"]},"
+                                            + "{\"name\":\"ums_ts_\",\"type\":[\"string\",\"null\"]}]}";
+
   @Test
   public void testPostProcessor() throws IOException {
     properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, DummySchemaPostProcessor.class.getName());
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);
 
     Schema schema = provider.getSourceSchema();
     assertEquals(schema.getType(), Type.RECORD);
     assertEquals(schema.getName(), "test");
     assertNotNull(schema.getField("testString"));
   }
 
+  @Test
+  public void testSparkAvro() throws IOException {

Review comment:
       IMO, this naming is not good.

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/SparkAvroSchemaProvider.java
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.utilities;
+
+import org.apache.avro.Schema;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.utilities.schema.SchemaProvider;
+import org.apache.spark.api.java.JavaSparkContext;
+
+public class SparkAvroSchemaProvider extends SchemaProvider {

Review comment:
       Or define a static inner class in `TestSchemaPostProcessor`?

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -39,20 +44,51 @@
 
   private TypedProperties properties = new TypedProperties();
 
+  private static String ORIGINAL_SCHEMA = "{\"name\":\"t3_biz_operation_t_driver\",\"type\":\"record\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"null\",\"string\"],\"default\":null},"
+                                              + "{\"name\":\"ums_ts_\",\"type\":[\"null\",\"string\"],\"default\":null}]}";
+
+  private static String RESULT_SCHEMA = "{\"type\":\"record\",\"name\":\"hoodie_source\",\"namespace\":\"hoodie.source\",\"fields\":[{\"name\":\"ums_id_\",\"type\":[\"string\",\"null\"]},"
+                                            + "{\"name\":\"ums_ts_\",\"type\":[\"string\",\"null\"]}]}";
+
   @Test
   public void testPostProcessor() throws IOException {
     properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, DummySchemaPostProcessor.class.getName());
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);
 
     Schema schema = provider.getSourceSchema();
     assertEquals(schema.getType(), Type.RECORD);
     assertEquals(schema.getName(), "test");
     assertNotNull(schema.getField("testString"));
   }
 
+  @Test
+  public void testSparkAvro() throws IOException {
+    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, SparkAvroPostProcessor.class.getName());
+    List<String> transformerClassNames = new ArrayList<>();
+    transformerClassNames.add(FlatteningTransformer.class.getName());
+
+    SchemaProvider provider =
+            UtilHelpers.wrapSchemaProviderWithPostProcessor(
+                    UtilHelpers.createSchemaProvider(SparkAvroSchemaProvider.class.getName(), properties, jsc),
+                    properties, jsc, transformerClassNames);
+
+    Schema schema = provider.getSourceSchema();
+    assertEquals(schema.getType(), Type.RECORD);
+    assertEquals(schema.getName(), "hoodie_source");
+    assertEquals(schema.getNamespace(), "hoodie.source");
+    assertNotNull(schema.getField("day"));
+  }
+
+  @Test
+  public void testSparkAvroSchema() throws IOException {

Review comment:
       WDYT about naming it to be `testSparkAvroSchemaPostProcessor`?

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -22,15 +22,20 @@
 import org.apache.hudi.utilities.schema.SchemaPostProcessor;
 import org.apache.hudi.utilities.schema.SchemaPostProcessor.Config;
 import org.apache.hudi.utilities.schema.SchemaProvider;
+import org.apache.hudi.utilities.schema.SparkAvroPostProcessor;
 import org.apache.hudi.utilities.testutils.UtilitiesTestBase;
 
 import org.apache.avro.Schema;
 import org.apache.avro.Schema.Type;
 import org.apache.avro.SchemaBuilder;
+
+import org.apache.hudi.utilities.transform.FlatteningTransformer;

Review comment:
       wrong place




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] yanghua commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-738543101


   Sorry for the conflict with @bvaradar , @liujinhui1994 can you consider using a refactoring PR to solve the problem I raised?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-738531609


   @yanghua  Can you help pass


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] yanghua commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-774675357


   > I think I might run into a bug related to this particular fix. It was all good until I hit the type Decimal. Since it can either be FIXED or BYTES, if an avro schema contains decimal type with BYTES as its literal type, after this two way conversion its literal type become FIXED instead. This will cause an exception to be thrown in AvroConversionHelper as the data underneath is ByteBuffer rather than GenericFixed. @liujinhui1994 @bvaradar
   
   @jingweiz2017 Thanks for the report. Can you file a jira issue to describe the issue?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] codecov-io edited a comment on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717655063


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=h1) Report
   > Merging [#2192](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=desc) (1e2bfd1) into [master](https://codecov.io/gh/apache/hudi/commit/7fa641ea9ad2318b185f8492964b30ebc90759b0?el=desc) (7fa641e) will **decrease** coverage by `43.27%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2192/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #2192       +/-   ##
   =============================================
   - Coverage     53.62%   10.34%   -43.28%     
   + Complexity     2848       48     -2800     
   =============================================
     Files           359       51      -308     
     Lines         16553     1788    -14765     
     Branches       1780      213     -1567     
   =============================================
   - Hits           8876      185     -8691     
   + Misses         6918     1590     -5328     
   + Partials        759       13      -746     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | hudicli | `?` | `?` | |
   | hudiclient | `?` | `?` | |
   | hudicommon | `?` | `?` | |
   | hudihadoopmr | `?` | `?` | |
   | hudispark | `?` | `?` | |
   | huditimelineservice | `?` | `?` | |
   | hudiutilities | `10.34% <0.00%> (-59.74%)` | `0.00 <0.00> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `35.54% <0.00%> (-29.06%)` | `11.00 <0.00> (-19.00)` | |
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `0.00% <ø> (-69.55%)` | `0.00 <0.00> (-18.00)` | |
   | [.../hudi/utilities/schema/SparkAvroPostProcessor.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TcGFya0F2cm9Qb3N0UHJvY2Vzc29yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...va/org/apache/hudi/utilities/IdentitySplitter.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL0lkZW50aXR5U3BsaXR0ZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-2.00%)` | |
   | [...va/org/apache/hudi/utilities/schema/SchemaSet.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TY2hlbWFTZXQuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-3.00%)` | |
   | [...a/org/apache/hudi/utilities/sources/RowSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvUm93U291cmNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-4.00%)` | |
   | [.../org/apache/hudi/utilities/sources/AvroSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvQXZyb1NvdXJjZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [.../org/apache/hudi/utilities/sources/JsonSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvSnNvblNvdXJjZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [...rg/apache/hudi/utilities/sources/CsvDFSSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvQ3N2REZTU291cmNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-10.00%)` | |
   | [...g/apache/hudi/utilities/sources/JsonDFSSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvSnNvbkRGU1NvdXJjZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-4.00%)` | |
   | ... and [341 more](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree-more) | |
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] liujinhui1994 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
liujinhui1994 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717826925


   @bvaradar  @yanghua  please review


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] codecov-io edited a comment on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-717655063


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=h1) Report
   > Merging [#2192](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/7fa641ea9ad2318b185f8492964b30ebc90759b0?el=desc) will **increase** coverage by `0.09%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2192/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2192      +/-   ##
   ============================================
   + Coverage     53.62%   53.71%   +0.09%     
   - Complexity     2848     2855       +7     
   ============================================
     Files           359      360       +1     
     Lines         16553    16571      +18     
     Branches       1780     1783       +3     
   ============================================
   + Hits           8876     8901      +25     
   + Misses         6918     6912       -6     
   + Partials        759      758       -1     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
   | #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | #hudicommon | `54.73% <ø> (+<0.01%)` | `1795.00 <ø> (ø)` | |
   | #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
   | #hudispark | `65.95% <ø> (+0.52%)` | `304.00 <ø> (ø)` | |
   | #huditimelineservice | `62.29% <ø> (ø)` | `50.00 <ø> (ø)` | |
   | #hudiutilities | `70.14% <100.00%> (+0.06%)` | `332.00 <2.00> (+7.00)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2192?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `69.23% <ø> (-0.32%)` | `18.00 <0.00> (ø)` | |
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `64.02% <100.00%> (-0.58%)` | `32.00 <0.00> (+2.00)` | :arrow_down: |
   | [.../hudi/utilities/schema/SparkAvroPostProcessor.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NjaGVtYS9TcGFya0F2cm9Qb3N0UHJvY2Vzc29yLmphdmE=) | `100.00% <100.00%> (ø)` | `2.00 <2.00> (?)` | |
   | [...java/org/apache/hudi/common/fs/StorageSchemes.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL2ZzL1N0b3JhZ2VTY2hlbWVzLmphdmE=) | `100.00% <0.00%> (ø)` | `10.00% <0.00%> (ø%)` | |
   | [...ava/org/apache/hudi/keygen/CustomKeyGenerator.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9rZXlnZW4vQ3VzdG9tS2V5R2VuZXJhdG9yLmphdmE=) | `82.60% <0.00%> (ø)` | `16.00% <0.00%> (ø%)` | |
   | [...g/apache/hudi/utilities/sources/AvroDFSSource.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvQXZyb0RGU1NvdXJjZS5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `84.44% <0.00%> (+2.39%)` | `14.00% <0.00%> (+2.00%)` | |
   | ... and [1 more](https://codecov.io/gh/apache/hudi/pull/2192/diff?src=pr&el=tree-more) | |
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on a change in pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
bvaradar commented on a change in pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#discussion_r516757551



##########
File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/SparkAvroPostProcessor.java
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.utilities.schema;
+
+import org.apache.hudi.AvroConversionUtils;
+import org.apache.hudi.common.config.TypedProperties;
+
+import org.apache.avro.Schema;
+import org.apache.spark.api.java.JavaSparkContext;
+
+public class SparkAvroPostProcessor extends SchemaPostProcessor {

Review comment:
       Can you reference the jira number as part of this class Javadoc so that developers would know why this class exist ?

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestSchemaPostProcessor.java
##########
@@ -45,14 +50,32 @@ public void testPostProcessor() throws IOException {
     SchemaProvider provider =
         UtilHelpers.wrapSchemaProviderWithPostProcessor(
         UtilHelpers.createSchemaProvider(DummySchemaProvider.class.getName(), properties, jsc),
-            properties, jsc);
+            properties, jsc,null);
 
     Schema schema = provider.getSourceSchema();
     assertEquals(schema.getType(), Type.RECORD);
     assertEquals(schema.getName(), "test");
     assertNotNull(schema.getField("testString"));
   }
 
+  @Test
+  public void testSparkAvro() throws IOException {
+    properties.put(Config.SCHEMA_POST_PROCESSOR_PROP, SparkAvroPostProcessor.class.getName());
+    List<String> transformerClassNames = new ArrayList<>();
+    transformerClassNames.add(FlatteningTransformer.class.getName());
+
+    SchemaProvider provider =
+            UtilHelpers.wrapSchemaProviderWithPostProcessor(
+                    UtilHelpers.createSchemaProvider(SparkAvroSchemaProvider.class.getName(), properties, jsc),
+                    properties, jsc, transformerClassNames);
+
+    Schema schema = provider.getSourceSchema();

Review comment:
       Can you add a check that post processed schema is different from original schema.

##########
File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/UtilHelpers.java
##########
@@ -413,14 +414,19 @@ public static SchemaProviderWithPostProcessor wrapSchemaProviderWithPostProcesso
     if (provider instanceof  SchemaProviderWithPostProcessor) {
       return (SchemaProviderWithPostProcessor)provider;
     }
+
     String schemaPostProcessorClass = cfg.getString(Config.SCHEMA_POST_PROCESSOR_PROP, null);
+    if (transformerClassNames != null && !transformerClassNames.isEmpty() && StringUtils.isNullOrEmpty(schemaPostProcessorClass)) {

Review comment:
       I think it is safer to add a configuration (enabled by default) if users do not need this feature.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] jingweiz2017 commented on pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
jingweiz2017 commented on pull request #2192:
URL: https://github.com/apache/hudi/pull/2192#issuecomment-776413023


   @yanghua Filed [HUDI-1607 ](https://issues.apache.org/jira/projects/HUDI/issues/HUDI-1607?filter=allissues)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar merged pull request #2192: [HUDI-1343] Add standard schema postprocessor which would rewrite the schema using spark-avro conversion

Posted by GitBox <gi...@apache.org>.
bvaradar merged pull request #2192:
URL: https://github.com/apache/hudi/pull/2192


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org