dtenedor opened a new pull request, #36445:
URL: https://github.com/apache/spark/pull/36445

   ## What changes were proposed in this pull request?
   
   DEFAULT columns are now supported in MERGE commands.
   
   Example:
   
   ```
   CREATE TABLE t1(
     i STRING,
     c CHAR(5),
     d VARCHAR(5),
     e STRING DEFAULT 'abc',
     f BIGINT DEFAULT 42)
     USING DELTA;
   INSERT INTO t1 VALUES('1', '12345', '67890', 'def', 31);
   CREATE TABLE t2(
     i STRING,
     c CHAR(5),
     d VARCHAR(5),
     e STRING DEFAULT 'abc',
     f BIGINT DEFAULT 42)
     USING DELTA;
   INSERT INTO t2 VALUES('1', '77777', '77777', 'ghi', 20);
   INSERT INTO t2 VALUES('2', '88888', '88888', 'jkl', 10);
   INSERT INTO t2 VALUES('3', '99999', '99999', 'jkl', 10);
   
   MERGE INTO t1 AS target
   USING t2 AS source
   ON source.i = target.i
   WHEN MATCHED AND (target.c = '12345') THEN DELETE
   WHEN NOT MATCHED AND (source.i = '2')
   THEN INSERT (target.i, target.c, target.d, target.e, target.f)
   VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT);
   
   SELECT e, f FROM t1 WHERE e = 'abc';
   > 'abc', 42
   ```
   
   ### Why are the changes needed?
   
   This makes MERGE commands easier to use.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   ## How was this patch tested?
   
   This PR adds new unit test coverage.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to