You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "alexeykudinkin (via GitHub)" <gi...@apache.org> on 2023/02/10 18:05:24 UTC

[GitHub] [hudi] alexeykudinkin commented on a diff in pull request #7915: [HUDI-5759] Supports add column on mor table with log

alexeykudinkin commented on code in PR #7915:
URL: https://github.com/apache/hudi/pull/7915#discussion_r1103062910


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/avro/SchemaConverters.scala:
##########
@@ -202,6 +202,13 @@ private[sql] object SchemaConverters {
           st.foreach { f =>
             val fieldAvroType =
               toAvroType(f.dataType, f.nullable, f.name, childNameSpace)
+            val fieldBuilder = fieldsAssembler.name(f.name).`type`(fieldAvroType)
+            if (isNullable(fieldAvroType)) {
+              fieldBuilder.withDefault(null)
+            } else {
+              fieldBuilder.noDefault()
+            }
+
             fieldsAssembler.name(f.name).`type`(fieldAvroType).noDefault()

Review Comment:
   We need to remove this line now, right?



##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/avro/SchemaConverters.scala:
##########
@@ -202,6 +202,13 @@ private[sql] object SchemaConverters {
           st.foreach { f =>
             val fieldAvroType =
               toAvroType(f.dataType, f.nullable, f.name, childNameSpace)
+            val fieldBuilder = fieldsAssembler.name(f.name).`type`(fieldAvroType)

Review Comment:
   This code is actually borrowed from Spark, and we try to avoid any changes to such code to make sure we're not diverging from Spark



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestUpdateTable.scala:
##########
@@ -204,4 +204,48 @@ class TestUpdateTable extends HoodieSparkSqlTestBase {
       }
     })
   }
+
+  test("Test Add Column and Update Table") {
+    withTempDir { tmp =>

Review Comment:
   @qidian99 can you please paste the whole stacktrace? Would like to understand better what exactly is failing 



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