dejankrak-db opened a new pull request, #59305: URL: https://github.com/apache/spark/pull/59305
### What changes were proposed in this pull request? Part 1 of the FILE type SPIP (SPARK-59132): the Catalyst type, independent of parquet-java. - Add `FileType`, a `DataType` that is physically a struct but does not extend `StructType`. SQL name is `FILE EXTERNAL`, JSON name is `"file"`. - Add the non-reserved `FILE` keyword and the `FILE EXTERNAL` DDL syntax. `EXTERNAL` is required; bare `FILE` is rejected as an unsupported type. - Add schema parsing/serialization: `DataType.fromJson`/`json` and `fromDDL`/`sql` round trip, including `FILE` nested in array, map value and struct types. - Expose `DataTypes.FileType` to Java and document the keyword in `sql-ref-ansi-compliance.md`. Out of scope (later parts): physical representation (unsafe row, codegen, encoders), casts, `TO_FILE` and related functions, comparability checks, Parquet schema converters, the UDF surface (`FileRef`) and Spark Connect. SPIP: https://docs.google.com/document/d/1pPof896ZwcZ-2Yn-YhC4TbyYWn1umiQJykGDkAxzCWc ### Why are the changes needed? Systems such as delta-spark represent column types as Spark Catalyst `DataType`s, and OSS Spark has no `FileType` today. This adds the type so it can be declared and serialized in schemas. ### Does this PR introduce _any_ user-facing change? Yes. `FILE EXTERNAL` can now be parsed as a data type, and `"file"` is accepted in JSON schemas. The type is not yet usable in query plans; that follows in later parts. `FILE` is non-reserved, so existing identifiers named `file` are unaffected. ### How was this patch tested? Added cases to `DataTypeParserSuite` (plain, nested, bare `FILE` rejected, `file` still usable as an identifier) and `DataTypeSuite` (name, JSON and DDL round trip, nullability). Ran: ``` build/sbt 'catalyst/testOnly *DataTypeParserSuite *DataTypeSuite *SQLKeywordSuite' ``` ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac This pull request and its description were written by Isaac. -- 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]
