You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/05/14 11:24:01 UTC

[GitHub] [incubator-hudi] zherenyu831 opened a new issue #1631: [SUPPORT] After changed schema could not update schema of Hive

zherenyu831 opened a new issue #1631:
URL: https://github.com/apache/incubator-hudi/issues/1631


   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://cwiki.apache.org/confluence/display/HUDI/FAQ)?
   Yes
   - Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.
   
   - If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   
   When we added column `new_col` to middle of existed schema, and sync it to hive 
   We got error below
   
   ```
   0/05/14 10:40:45 ERROR HiveSyncTool: Got runtime exception when hive syncing
   org.apache.hudi.hive.HoodieHiveSyncException: Failed in executing SQL ALTER TABLE `default`.`test_minh_delete_col_ro` REPLACE COLUMNS(`_hoodie_commit_time` string, `_hoodie_commit_seqno` string, `_hoodie_record_key` string, `_hoodie_partition_path` string, `_hoodie_file_name` string, `id` bigint, `value` string, `new_col` int, `is_ok` int, `created_at` bigint, `_daas_event_type` int, `__daas_internal_ts` bigint, `_daas_is_deleted` boolean, `updated_at` bigint ) cascade
   	at org.apache.hudi.hive.HoodieHiveClient.updateHiveSQL(HoodieHiveClient.java:482)
   	at org.apache.hudi.hive.HoodieHiveClient.updateTableDefinition(HoodieHiveClient.java:261)
   [...]
   Caused by: java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following columns have types incompatible with the existing columns in their respective positions :
   is_ok,_daas_event_type,__daas_internal_ts,_daas_is_deleted
   	at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:297)
   	at org.apache.hudi.hive.HoodieHiveClient.updateHiveSQL(HoodieHiveClient.java:480)
   	... 86 more
   ```
   
   A clear and concise description of the problem.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   1. Setting hudi by using hive options
   ```
         TABLE_NAME -> "table",
         PRECOMBINE_FIELD_OPT_KEY -> "__daas_internal_ts",
         RECORDKEY_FIELD_OPT_KEY -> "id",
         PARTITIONPATH_FIELD_OPT_KEY -> "_partition_key",
         TABLE_TYPE_OPT_KEY -> MOR_TABLE_TYPE_OPT_VAL,
         HIVE_SYNC_ENABLED_OPT_KEY -> "true", 
         HIVE_DATABASE_OPT_KEY -> "XXXX", 
         HIVE_TABLE_OPT_KEY -> "YYYYY",
         HIVE_PARTITION_FIELDS_OPT_KEY -> "created_at",
         HIVE_PARTITION_EXTRACTOR_CLASS_OPT_KEY -> classOf[MultiPartKeysValueExtractor].getName
   ```
   2. Create a DF with column and write to hudi tables
   3. Create a same DF2 as 2. with a new column in middle
   4. Write DF2 to hudi table
   
   **Expected behavior**
   Same exception as description 
   
   A clear and concise description of what you expected to happen.
   I think there are already detected the schema changement
   https://github.com/apache/incubator-hudi/blob/3a2fe13fcb7c168f8ff023e3bdb6ae482b400316/hudi-hive-sync/src/main/java/org/apache/hudi/hive/SchemaDifference.java#L37-L39
   Should also support update hive schema for each pattern
   
   **Environment Description**
   
   * Hudi version : 0.5.2
   
   * Spark version : 2.4.4
   
   * Hive version : 3.1.2
   
   * Hadoop version : 3.1.2
   
   * Storage (HDFS/S3/GCS..) : S3
   
   * Running on Docker? (yes/no) : no
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   


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

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



[GitHub] [incubator-hudi] bvaradar commented on issue #1631: [SUPPORT] After changed schema could not update schema of Hive

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #1631:
URL: https://github.com/apache/incubator-hudi/issues/1631#issuecomment-628801677


   @zherenyu831 : Schema evolution rules does not allow for adding columns in the middle of schema. You would need to add them at the end. 


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

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



[GitHub] [incubator-hudi] zherenyu831 commented on issue #1631: [SUPPORT] After changed schema could not update schema of Hive

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #1631:
URL: https://github.com/apache/incubator-hudi/issues/1631#issuecomment-629015268


   @bvaradar 
   Thank you, I think this is the only solution could works now


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

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



[GitHub] [incubator-hudi] zherenyu831 closed issue #1631: [SUPPORT] After changed schema could not update schema of Hive

Posted by GitBox <gi...@apache.org>.
zherenyu831 closed issue #1631:
URL: https://github.com/apache/incubator-hudi/issues/1631


   


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

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