cyberbeam524 opened a new issue, #27791:
URL: https://github.com/apache/datafusion/issues/27791

   ### Describe the bug
   
   When creating a table with explicit extension-typed columns using `CREATE 
TABLE ... AS` (CTAS), the resulting column loses its Arrow extension type 
metadata (e.g., `ARROW:extension:name = arrow.uuid`), even when the source 
expression is explicitly cast to the extension type.
   
   By contrast, `CREATE TABLE` followed by `INSERT INTO` preserves the 
extension metadata.
   
   ### To Reproduce
   
   Run on `main` (v56.0.0+) in `datafusion-cli`:
   
   ```sql
   -- CTAS drops arrow.uuid metadata
   CREATE TABLE t (id UUID) AS VALUES
     (CAST(arrow_cast(X'00010203040506070809000102030506', 
'FixedSizeBinary(16)') AS UUID));
   
   SELECT arrow_metadata(id, 'ARROW:extension:name') FROM t;
   -- Actual: NULL
   -- Expected: arrow.uuid
   
   -- Compare with CREATE TABLE + INSERT INTO (works)
   CREATE TABLE t2 (id UUID);
   INSERT INTO t2 VALUES
     (CAST(arrow_cast(X'00010203040506070809000102030506', 
'FixedSizeBinary(16)') AS UUID));
   
   SELECT arrow_metadata(id, 'ARROW:extension:name') FROM t2;
   -- Returns: arrow.uuid
   
   ### Expected behavior
   
   ```markdown
   `SELECT arrow_metadata(id, 'ARROW:extension:name') FROM t` should return 
`arrow.uuid`, consistent with `CREATE TABLE` + `INSERT INTO`.
   
   ### Additional context
   
   Discovered while working on #26915 (follow-up to #21714). Happy to open a 
follow-up PR to align CTAS with `INSERT` if this is unintended.
   
   
   ### Willingness to contribute
   
   I plan to contribute a fix for this bug independently


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