Skip to content

Conversation

@Brijesh-Thakkar
Copy link

PR Description

Which issue does this PR close?

Closes #2743

Rationale for this change

Comet already provides native support for a subset of cast operations involving complex types such as STRUCT and ARRAY, but this behavior was not documented in the compatibility guide. As a result, users may be unaware of which complex type casts are supported natively and which may fall back to Spark.

This change improves the accuracy and completeness of the documentation by explicitly describing the currently supported complex type casts and their limitations, based on existing behavior and tests.

What changes are included in this PR?

  • Added a new "Complex Type Casts" section to the compatibility guide
  • Documented support for:
    • STRUCTSTRING (including named structs, nested structs, and structs containing primitive, decimal, date, and timestamp fields)
    • STRUCTSTRUCT (field matching by position)
    • ARRAY<T>STRING (for element types: boolean, byte, short, integer, long, string, decimal)
    • BINARYSTRING (for valid UTF-8 data)
    • STRINGBINARY
  • Described known limitations and Spark fallback behavior for other complex type casts

How are these changes tested?

This PR only updates documentation. The documented behavior is verified against existing tests in CometCastSuite.scala, which cover the supported complex type cast operations:

  • test("cast StructType to StringType") - lines 1090-1110
  • test("cast StructType to StructType") - lines 1112-1123
  • test("cast StructType to StructType with different names") - lines 1125-1141
  • test("cast ArrayType to StringType") - lines 1164-1184
  • test("cast BinaryType to StringType") - lines 895-897
  • test("cast StringType to BinaryType") - lines 847-849

No new tests are required for this documentation-only change.

This adds documentation for native support of complex type casts
including STRUCT to STRING/STRUCT, ARRAY to STRING, and BINARY
to/from STRING conversions.

Closes apache#2743
Copilot AI review requested due to automatic review settings December 27, 2025 05:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation for complex type cast operations to the Comet compatibility guide, addressing issue #2743. The documentation clarifies which complex type casts (STRUCT, ARRAY, BINARY) are natively supported by Comet and which will fall back to Spark.

Key changes:

  • Added "Complex Type Casts" section documenting native support for STRUCT→STRING, STRUCT→STRUCT, ARRAY→STRING, BINARY→STRING, and STRING→BINARY casts
  • Included practical SQL examples for each supported cast type
  • Documented known limitations and fallback behavior for unsupported complex casts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for cast support for complex types

1 participant