[
https://issues.apache.org/jira/browse/HUDI-6483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17954384#comment-17954384
]
Y Ethan Guo commented on HUDI-6483:
-----------------------------------
Any DML like INSERT INTO, UPDATE, MERGE INTO, etc., should not change the table
schema. The schema evolution should go through ALTER TABLE statements. We
should still support schema evolution where the schema is evolved during a span
of the latest file slice.
> MERGE INTO should support schema evolution for partial updates.
> ---------------------------------------------------------------
>
> Key: HUDI-6483
> URL: https://issues.apache.org/jira/browse/HUDI-6483
> Project: Apache Hudi
> Issue Type: Improvement
> Components: spark-sql
> Reporter: Aditya Goenka
> Assignee: Jonathan Vexler
> Priority: Blocker
> Fix For: 0.16.0, 1.1.0
>
>
> Following code is example for doing MERGE INTO along with schema evolution
> which is not yet supported by hudi. Currently, Hudi tries to use target table
> schema during MERGE INTO.
> Following code should be supported -
> ```
> create table test_insert3 (
> id int,
> name string,
> updated_at timestamp
> ) using hudi
> options (
> type = 'cow',
> primaryKey = 'id',
> preCombineField = 'updated_at'
> ) location 'file:///tmp/test_insert3';
> merge into test_insert3 as target
> using (
> select 1 as id, 'c' as name, 1 as new_col, current_timestamp as updated_at
> ) source
> on target.id = source.id
> when matched then update set target.new_col = source.new_col
> when not matched then insert *;
> ```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)