Copilot commented on code in PR #2989:
URL: https://github.com/apache/datafusion-comet/pull/2989#discussion_r2648679655


##########
docs/source/user-guide/latest/compatibility.md:
##########
@@ -192,3 +192,47 @@ or strings containing null bytes (e.g \\u0000) |
 
 Any cast not listed in the previous tables is currently unsupported. We are 
working on adding more. See the
 [tracking issue](https://github.com/apache/datafusion-comet/issues/286) for 
more details.
+
+### Complex Type Casts
+
+In addition to primitive types, Comet provides native support for a limited set
+of cast operations involving complex types. This section documents the 
currently
+supported complex type casts and known limitations.
+
+#### Struct Type Casting
+
+- `STRUCT` → `STRING`  
+  Casting a struct to a string is supported and produces a string 
representation
+  of the struct contents. This includes named structs and nested structs.
+
+  Example:
+  ```sql
+  SELECT CAST(named_struct('a', 1, 'b', 'x') AS STRING);
+  ```
+
+- `STRUCT` → `STRUCT`  
+  Casting between struct types is supported when the number of fields matches.
+  Fields are matched by position rather than by name, consistent with Apache 
Spark
+  behavior.
+
+  Example:
+  ```sql
+  SELECT CAST(s AS struct<field1:string, field2:string>) FROM table;

Review Comment:
   The SQL example references a column `s` from a table that is not defined in 
the example. This makes the example unclear and potentially confusing for users 
trying to understand the feature. Consider using a complete example similar to 
the other examples in this section, such as using a concrete struct 
construction with `named_struct` or specifying the full context with a CTE or 
CREATE TABLE statement.
   ```suggestion
     WITH t AS (
       SELECT named_struct('a', 1, 'b', 'x') AS s
     )
     SELECT CAST(s AS struct<field1:int, field2:string>) FROM t;
   ```



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