@@ -34,17 +34,16 @@ object HudiSchemaUtils extends DeltaLogging {
34
34
* corresponding Avro type.
35
35
*/
36
36
def transform [E <: DataType ](elem : E , isNullable : Boolean , currentPath : String ): Schema =
37
- elem match {
37
+ elem match {
38
38
case StructType (fields) =>
39
39
40
40
val avroFields : util.List [Schema .Field ] = fields.map(f =>
41
41
new Schema .Field (
42
42
f.name,
43
- transform(f.dataType, f.nullable,
44
- if (currentPath.isEmpty) f.name else s " $currentPath. ${f.name}" ),
43
+ transform(f.dataType, f.nullable, s " $currentPath. ${f.name}" ),
45
44
f.getComment().orNull)).toList.asJava
46
45
finalizeSchema(
47
- Schema .createRecord(elem.typeName , null , currentPath , false , avroFields),
46
+ Schema .createRecord(currentPath , null , null , false , avroFields),
48
47
isNullable)
49
48
// TODO: Add List and Map support: https://github.com/delta-io/delta/issues/2738
50
49
case ArrayType (elementType, containsNull) =>
@@ -59,7 +58,7 @@ object HudiSchemaUtils extends DeltaLogging {
59
58
throw new UnsupportedOperationException (s " Cannot convert Delta type $other to Hudi " )
60
59
}
61
60
62
- transform(deltaSchema, false , " " )
61
+ transform(deltaSchema, false , " root " )
63
62
}
64
63
65
64
private def finalizeSchema (targetSchema : Schema , isNullable : Boolean ): Schema = {
0 commit comments