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 2023/01/18 17:28:28 UTC

[GitHub] [hudi] nsivabalan commented on a diff in pull request #7695: HUDI-5575. Support any record key generation along w/ any partition path generation for row writer

nsivabalan commented on code in PR #7695:
URL: https://github.com/apache/hudi/pull/7695#discussion_r1073789912


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/BuiltinKeyGenerator.java:
##########
@@ -333,11 +223,11 @@ static UTF8String toUTF8String(Object o) {
     }
   }
 
-  private static String toString(Object o) {
+  static String toString(Object o) {
     return o == null ? null : o.toString();
   }
 
-  private static String handleNullOrEmptyCompositeKeyPart(Object keyPart) {
+  static String handleNullOrEmptyCompositeKeyPart(Object keyPart) {

Review Comment:
   shouldn't we move this to CompositeSparkRecordKeyGenerator
   or add a separate Utils class where do move all such static methods and use it wherever required. 



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/BuiltinKeyGenerator.java:
##########
@@ -423,7 +313,7 @@ GenericRecord convertToAvro(InternalRow row) {
     }
   }
 
-  protected class SparkRowAccessor {
+  public class SparkRowAccessor {

Review Comment:
   lets move this to separate class. 



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/BuiltinKeyGenerator.java:
##########
@@ -127,6 +129,8 @@ protected void tryInitRowAccessor(StructType schema) {
       synchronized (this) {
         if (this.rowAccessor == null) {
           this.rowAccessor = new SparkRowAccessor(schema);
+          this.sparkRecordKeyGenerator = SparkRecordKeyGeneratorFactory.getSparkRecordKeyGenerator(config,
+              rowAccessor, recordKeyFields, this.getClass());

Review Comment:
   does this rightly pass the impl class ? did you confirm.



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/BuiltinKeyGenerator.java:
##########
@@ -127,6 +129,8 @@ protected void tryInitRowAccessor(StructType schema) {
       synchronized (this) {
         if (this.rowAccessor == null) {
           this.rowAccessor = new SparkRowAccessor(schema);
+          this.sparkRecordKeyGenerator = SparkRecordKeyGeneratorFactory.getSparkRecordKeyGenerator(config,
+              rowAccessor, recordKeyFields, this.getClass());

Review Comment:
   if not, we should move this to impl classes. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

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