geruh commented on issue #14707:
URL: https://github.com/apache/iceberg/issues/14707#issuecomment-3615502191

   Hey @enriquh,
   
   I tried running this scenario but haven't ran into the exception. I'm 
running something like:
   
   ```sql
   CREATE TABLE test_table (
     id BIGINT, 
     data VARIANT
   ) USING iceberg 
   TBLPROPERTIES ('format-version' = '3');
   
   INSERT INTO test_table VALUES 
     (1, parse_json('{"field": "foo", "num": 25}')),
     (2, parse_json('{"field": "bar", "num": 30}')),
     (3, parse_json('{"field": "baz", "num": 35}'));
   
   CREATE OR REPLACE TEMP VIEW merge_source AS 
   SELECT id, data FROM VALUES 
     (1, parse_json('{"field": "foo", "num": 26}')),
     (2, parse_json('{"field": "bar", "num": 31}')),
     (4, parse_json('{"field": "qux", "num": 40}'))
   AS source_data(id, data);
   
   -- MERGE with variant_get in condition
   MERGE INTO test_table AS target
   USING merge_source AS source
   ON variant_get(target.data, '$.field', 'string') = 
      variant_get(source.data, '$.field', 'string')
   AND target.id = source.id
   WHEN MATCHED THEN 
     UPDATE SET target.data = source.data
   WHEN NOT MATCHED THEN 
     INSERT (id, data) VALUES (source.id, source.data);
   
   -- Verify Merge wsa success
   SELECT id, 
     variant_get(data, '$.field', 'string') as field,
     variant_get(data, '$.num', 'int') as num
   FROM test_table 
   ORDER BY id;
   
   +---+------------------------+
   |id |data                    |
   +---+------------------------+
   |5  |{"field":"qux","num":40}|
   |3  |{"field":"baz","num":35}|
   |4  |NULL                    |
   |2  |{"field":"bar","num":31}|
   |1  |{"field":"foo","num":26}|
   +---+------------------------+
   
   ```
   
   This query for me is working fine on current main with Spark 4.0 and format 
v3.
   
   I had a hunch one of these PRs fixed but I reverted both [PR 
#14261](https://github.com/apache/iceberg/pull/14261) and [PR 
#14588](https://github.com/apache/iceberg/pull/14588) and it still works. So I 
can't actually reproduce the `UnsupportedOperationException` you're seeing.
   
   Maybe it's something about your environment or maybe the test isn't hitting 
the same code path you are. Or maybe you were on a different version when you 
hit this.
   
   What Iceberg commit were you using when you saw this? And can you paste the 
full stacktrace? That would help me figure out what's different.
   


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