lokeshj1703 commented on issue #7363:
URL: https://github.com/apache/hudi/issues/7363#issuecomment-1367241201

   ```
     public static final ConfigProperty<String> CREATE_SCHEMA = ConfigProperty
         .key("hoodie.table.create.schema")
         .noDefaultValue()
         .withDocumentation("Schema used when creating the table, for the first 
time.");
   
   ```
   This is the config value returned by function 
`hoodieTableMetaClient.getTableConfig().getTableCreateSchema()`. There is no 
default value for this config. It seems this would return a value only if 
configured.
   ```
   scala> import org.apache.hudi.common.table.TableSchemaResolver;
   import org.apache.hudi.common.table.TableSchemaResolver
   
   scala> var schemaResolver = new TableSchemaResolver(hoodieTableMetaClient);
   schemaResolver: org.apache.hudi.common.table.TableSchemaResolver = 
org.apache.hudi.common.table.TableSchemaResolver@3662dc9b
   
   scala> schemaResolver.getTableAvroSchema()
   res20: org.apache.avro.Schema = 
{"type":"record","name":"hudi_table_record","namespace":"hoodie.hudi_table","fields":[{"name":"_hoodie_commit_time","type":["null","string"],"doc":"","default":null},{"name":"_hoodie_commit_seqno","type":["null","string"],"doc":"","default":null},{"name":"_hoodie_record_key","type":["null","string"],"doc":"","default":null},{"name":"_hoodie_partition_path","type":["null","string"],"doc":"","default":null},{"name":"_hoodie_file_name","type":["null","string"],"doc":"","default":null},{"name":"emp_id","type":["null","long"],"default":null},{"name":"employee_name","type":["null","string"],"default":null},{"name":"department","type":["null","string"],"default":null},{"name":"state","type":["null","string"],"default":null},{"name":"salary","type":["null","long"...
   scala> schemaResolver.getTableParquetSchema()
   res21: org.apache.parquet.schema.MessageType =
   message hoodie.hudi_table.hudi_table_record {
     optional binary _hoodie_commit_time (UTF8);
     optional binary _hoodie_commit_seqno (UTF8);
     optional binary _hoodie_record_key (UTF8);
     optional binary _hoodie_partition_path (UTF8);
     optional binary _hoodie_file_name (UTF8);
     optional int64 emp_id;
     optional binary employee_name (UTF8);
     optional binary department (UTF8);
     optional binary state (UTF8);
     optional int64 salary;
     optional int64 age;
     optional int64 bonus;
     optional int64 ts;
   }
   ```
   You can use the above snippet for fetching the table schema instead. 
   
   cc @xushiyan 


-- 
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-unsubscr...@hudi.apache.org

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

Reply via email to