moustafaalaa commented on issue #5291:
URL: https://github.com/apache/hudi/issues/5291#issuecomment-1103302907

   I also tried to add the primaryKey and the preCombineField key, but the 
output table properties doesn't reflect the default config file. For example, 
The output table is `cow` and i expect `mor`
   
   
   ```python
   query_create_tbl = f"""
   create table if not exists {db_name}.{table_name} (
     id bigint,
     name string,
     ts bigint,
     dt string,
     hh string
   )   using hudi
   options (
     preCombineField='ts', 
     primaryKey='id', 
     hoodie.table.name = '{table_name}',
     path = '{s3_output_path}',
     hoodie.datasource.hive_sync.table = '{table_name}'
   )
   partitioned by (dt, hh);
   """
   ```
   
   The output table 
   
   ```sql
   CREATE EXTERNAL TABLE `hudi_tbl_partitioned`(
     `_hoodie_commit_time` string, 
     `_hoodie_commit_seqno` string, 
     `_hoodie_record_key` string, 
     `_hoodie_partition_path` string, 
     `_hoodie_file_name` string, 
     `id` bigint, 
     `name` string, 
     `ts` bigint)
   PARTITIONED BY ( 
     `dt` string, 
     `hh` string)
   ROW FORMAT SERDE 
     'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
   WITH SERDEPROPERTIES ( 
     
'path'='s3://hudi-upgrade/data/hudi_sql_dml_ddl_hive/hudi_tbl_partitioned') 
   STORED AS INPUTFORMAT 
     'org.apache.hudi.hadoop.HoodieParquetInputFormat' 
   OUTPUTFORMAT 
     'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
   LOCATION
     's3://hudi-upgrade/data/hudi_sql_dml_ddl_hive/hudi_tbl_partitioned'
   TBLPROPERTIES (
     'hoodie.datasource.hive_sync.table'='hudi_tbl_partitioned', 
     'hoodie.table.name'='hudi_tbl_partitioned', 
     'last_commit_time_sync'='20220420003416329', 
     'preCombineField'='ts', 
     'primaryKey'='id', 
     'spark.sql.create.version'='3.1.1-amzn-0', 
     'spark.sql.sources.provider'='hudi', 
     'spark.sql.sources.schema.numPartCols'='2', 
     'spark.sql.sources.schema.numParts'='1', 
     
'spark.sql.sources.schema.part.0'='{\"type\":\"struct\",\"fields\":[{\"name\":\"_hoodie_commit_time\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"_hoodie_commit_seqno\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"_hoodie_record_key\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"_hoodie_partition_path\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"_hoodie_file_name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"id\",\"type\":\"long\",\"nullable\":true,\"metadata\":{}},{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"ts\",\"type\":\"long\",\"nullable\":true,\"metadata\":{}},{\"name\":\"dt\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"hh\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}}]}',
 
     'spark.sql.sources.schema.partCol.0'='dt', 
     'spark.sql.sources.schema.partCol.1'='hh', 
     'transient_lastDdlTime'='1650414765', 
     'type'='cow')
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to