Skip to content

Snowflake: Parse structured OBJECT types - #2489

Open
osipovartem wants to merge 2 commits into
apache:mainfrom
Embucket:upstream-snowflake-structured-object-independent
Open

Snowflake: Parse structured OBJECT types#2489
osipovartem wants to merge 2 commits into
apache:mainfrom
Embucket:upstream-snowflake-structured-object-independent

Conversation

@osipovartem

Copy link
Copy Markdown
Contributor

Snowflake structured OBJECT types can contain named, nullable or NOT NULL fields and recursively nested OBJECT types. The generic Custom(Vec<String>) representation loses these boundaries.

This adds DataType::Object(Vec<ColumnDef>), a Snowflake dialect capability, recursive parsing and formatting, and leaves unstructured OBJECT unchanged.

Validated against:
https://docs.snowflake.com/en/sql-reference/data-types-structured#structured-object-types

Tests cover nested types, NOT NULL AST preservation, unstructured OBJECT, and malformed definitions.

AI assistance: Codex was used to prepare the implementation and tests.

Comment thread src/dialect/snowflake.rs Outdated
true
}

/// See [doc](https://docs.snowflake.com/en/sql-reference/data-types-structured#structured-object-types)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I couldnt find the syntax being described in the link, could you double check and have the link reference the actual syntax?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. The previous anchor no longer exists. I updated it to the exact "Specifying a structured OBJECT type" section, which includes the OBJECT(...) syntax: https://docs.snowflake.com/en/sql-reference/data-types-structured#specifying-a-structured-object-type

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.

2 participants