1032851561 opened a new issue, #9402:
URL: https://github.com/apache/hudi/issues/9402

   **Describe the problem you faced**
   
   When I was testing schema evolution, I found that some exception occurred in 
synchronous hive.
   
    **Environment Description**
   
   * Hudi version : 0.13.1
   
   * Hive version : 2.3.6
   
   * Hadoop version : 2.10
   
   * Flink version : 1.14.5
   
   
   **Steps and exceptions**
   
   - Test change column type
   
   1. create table 
   ```
   create table if not exists ods_evolution1_hudi (
   `id` int,
   `name` int,
   `create_date` string,
   PRIMARY KEY(`id`) NOT ENFORCED
   )
   WITH (
   'connector'='hudi',
   'hoodie.datasource.write.hive_style_partitioning'='true',
   'hoodie.datasource.write.partitionpath.field'='create_date',
   'path'='file:///D:/data/hadoop/warehouse/test/ods_evolution1',
   'hive_sync.metastore.uris'='thrift://xxx:9083',
   'hive_sync.username'='',
   'hive_sync.table'='ods_evolution1',
   'hive_sync.enable'='true',
   'hive_sync.password'='',
   'hive_sync.db'='default',
   'write.operation'='INSERT',
   'hoodie.schema.on.read.enable'='true',
   'hoodie.datasource.write.reconcile.schema'='true',
   'table.type'='COPY_ON_WRITE'
   )
   ```
   2. insert `[2, 11, "2023-07-25"]` into ods_evolution1_hudi ,  
`ods_evolution1` sync and select success!
   3. change column type : `name int`  ->  `name string`
   ```
   create table if not exists ods_evolution1_hudi (
   `id` int,
   `name` string,
   `create_date` string,
   PRIMARY KEY(`id`) NOT ENFORCED
   )
   WITH (
    same options
   )
   ```
   5. insert `[1, "1", "2023-07-25"]` into ods_evolution1_hudi ,  
`ods_evolution1` sync failure!
   ```
   Caused by: org.apache.hudi.hive.HoodieHiveSyncException: Could not convert 
field Type from INT to string for field name
        at 
org.apache.hudi.hive.util.HiveSchemaUtil.getSchemaDifference(HiveSchemaUtil.java:118)
        at org.apache.hudi.hive.HiveSyncTool.syncSchema(HiveSyncTool.java:335)
        at 
org.apache.hudi.hive.HiveSyncTool.syncHoodieTable(HiveSyncTool.java:252)
   ``
   6. `alter table ods_evolution1 change name name string` 
   7. select ods_evolution1 with exception
   ```
   Failed with exception 
java.io.IOException:org.apache.hudi.exception.HoodieException: The gize of 
hive.io.file.readcolumn.ids:0.1,2.3.4,5.6.7 is not equal to projection columns: 
_hoodie_commit_time,_hoodie_commit_seqno,_hoodie_record_key,_hoodie_partition_path,_hoodie_file_name,id,name
   ```
   
   **Questions**
   1. Hive sync only support `int->string, float->double` ,refer to 
`.HiveSchemaUtil#isSchemaTypeUpdateAllowed`
   2. Why query failure in step 7.
   


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