Snowflake: Parse structured OBJECT types - #2489
osipovartem wants to merge 5 commits into
Conversation
| // With table function args, without alias | ||
| snowflake().verified_stmt("SELECT $1, $2 FROM @mystage1(file_format => 'myformat')"); | ||
| } | ||
| #[test] |
There was a problem hiding this comment.
| #[test] | |
| #[test] |
There was a problem hiding this comment.
Added the missing blank line before the test in 0d58c18.
| snowflake().verified_stmt("SELECT $1, $2 FROM @mystage1(file_format => 'myformat')"); | ||
| } | ||
| #[test] | ||
| fn test_structured_object_type() { |
There was a problem hiding this comment.
we're missing a test case for how the PR handles plain OBJECT as a type (as mentioned in my previous review comment)
There was a problem hiding this comment.
Added an explicit test_plain_object_type in 0d58c18. It verifies both Snowflake and Generic dialect parsing and asserts that plain OBJECT remains DataType::Custom("OBJECT", []), while OBJECT(...) uses the new structured representation. cargo test --all-targets and cargo clippy --all-targets --all-features -- -D warnings pass locally.
|
|
||
| #[test] | ||
| fn test_plain_object_type() { |
There was a problem hiding this comment.
let's merge this with the existing test case
There was a problem hiding this comment.
Done. I folded the plain OBJECT assertion into test_structured_object_type and removed the separate test case. The targeted Snowflake parser test passes locally.
Snowflake structured OBJECT types can contain named, nullable or
NOT NULLfields and recursively nested OBJECT types. The genericCustom(Vec<String>)representation loses these boundaries.This adds
DataType::Object(Vec<ColumnDef>), a Snowflake dialect capability, recursive parsing and formatting, and leaves unstructuredOBJECTunchanged.Validated against:
https://docs.snowflake.com/en/sql-reference/data-types-structured#structured-object-types
Tests cover nested types,
NOT NULLAST preservation, unstructuredOBJECT, and malformed definitions.AI assistance: Codex was used to prepare the implementation and tests.