Skip to content

feat(ibis): enhance the function list of snowflake#1350

Merged
douenergy merged 2 commits intoCanner:mainfrom
goldmedal:feat/snowflake-nested-func
Oct 21, 2025
Merged

feat(ibis): enhance the function list of snowflake#1350
douenergy merged 2 commits intoCanner:mainfrom
goldmedal:feat/snowflake-nested-func

Conversation

@goldmedal
Copy link
Copy Markdown
Contributor

@goldmedal goldmedal commented Oct 20, 2025

  • Support the common operators for semi-structured type (object and variant).

Summary by CodeRabbit

  • New Features

    • Added support for Snowflake VARIANT and OBJECT data types
    • Enabled local query execution with Snowflake connections
    • Expanded Snowflake function library with 30 additional functions
  • Bug Fixes

    • Improved error handling for functions with invalid return types to prevent crashes

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 20, 2025

Walkthrough

Adds Snowflake VARIANT column type support by introducing a new enum member and type mapping, updates remote function count expectations, enables Snowflake data source queries locally, and improves error handling for remote functions with invalid return types.

Changes

Cohort / File(s) Summary
Type System Extensions
ibis-server/app/model/metadata/dto.py, ibis-server/app/model/metadata/snowflake.py
Added VARIANT enum member to RustWrenEngineColumnType; extended SNOWFLAKE_TYPE_MAPPING to handle "variant" → VARIANT and "object" → JSON type conversions
Test Updates
ibis-server/tests/routers/v3/connector/snowflake/test_functions.py
Updated expected remote function count from DATAFUSION_FUNCTION_COUNT + 63 to DATAFUSION_FUNCTION_COUNT + 93 in test_function_list
Local Query Tool
ibis-server/tools/query_local_run.py
Added Snowflake data source support with connection validation and connector initialization
Remote Function Error Handling
wren-core/core/src/mdl/function/remote_function.rs
Modified From conversion to fall back to Utf8 return type instead of panicking on invalid types

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Canner/wren-engine#1286: Updates Snowflake remote function list expectations with modified function count assertions in test_functions.py

Suggested labels

ibis, python, rust, core

Suggested reviewers

  • douenergy

Poem

🐰 Whiskers twitch with glee,
VARIANT types now flow so free,
Snowflake's chill winds softly blow,
Through Wren's new paths they safely go!
No panics now, just graceful grace, 🌨️✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "enhance the function list of snowflake" is clearly related to the changeset. The test changes demonstrate a measurable increase in the function count from DATAFUSION_FUNCTION_COUNT + 63 to DATAFUSION_FUNCTION_COUNT + 93, confirming that the function list is indeed enhanced. However, the title does not fully capture the underlying purpose of these changes, which according to the PR description is to add support for semi-structured types (object and variant). While the title correctly identifies a real and significant aspect of the changeset, it describes the outcome rather than the core reason for the enhancement.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added core ibis rust Pull requests that update Rust code python Pull requests that update Python code labels Oct 20, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wren-core/core/src/mdl/function/remote_function.rs (1)

187-199: Critical: Inconsistent error handling across function types.

The From<RemoteFunction> implementation for ByPassScalarUDF now falls back to DataType::Utf8 for invalid return types, but the analogous implementations for ByPassAggregateUDF (line 274) and ByPassWindowFunction (line 337) still use .unwrap() and will panic. This creates inconsistent behavior where invalid return types are silently tolerated for scalar functions but cause panics for aggregate and window functions.

Additionally, the comment on line 189 states "just panic if the return type is not valid" but the code now does the opposite.

Apply this diff to make error handling consistent across all three function types:

 impl From<RemoteFunction> for ByPassScalarUDF {
     fn from(func: RemoteFunction) -> Self {
-        // just panic if the return type is not valid to avoid we input invalid type
+        // Fall back to Utf8 if the return type is not recognized
         let return_type = ReturnType::from_str(&func.return_type)
             .unwrap_or(ReturnType::Specific(DataType::Utf8));
         ByPassScalarUDF {
 impl From<RemoteFunction> for ByPassAggregateUDF {
     fn from(func: RemoteFunction) -> Self {
-        // just panic if the return type is not valid to avoid we input invalid type
-        let return_type = ReturnType::from_str(&func.return_type).unwrap();
+        // Fall back to Utf8 if the return type is not recognized
+        let return_type = ReturnType::from_str(&func.return_type)
+            .unwrap_or(ReturnType::Specific(DataType::Utf8));
         ByPassAggregateUDF {
 impl From<RemoteFunction> for ByPassWindowFunction {
     fn from(func: RemoteFunction) -> Self {
-        // just panic if the return type is not valid to avoid we input invalid type
-        let return_type = ReturnType::from_str(&func.return_type).unwrap();
+        // Fall back to Utf8 if the return type is not recognized
+        let return_type = ReturnType::from_str(&func.return_type)
+            .unwrap_or(ReturnType::Specific(DataType::Utf8));
         ByPassWindowFunction {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0973140 and 3b0b662.

⛔ Files ignored due to path filters (1)
  • ibis-server/resources/function_list/snowflake.csv is excluded by !**/*.csv
📒 Files selected for processing (5)
  • ibis-server/app/model/metadata/dto.py (1 hunks)
  • ibis-server/app/model/metadata/snowflake.py (1 hunks)
  • ibis-server/tests/routers/v3/connector/snowflake/test_functions.py (1 hunks)
  • ibis-server/tools/query_local_run.py (2 hunks)
  • wren-core/core/src/mdl/function/remote_function.rs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
ibis-server/app/model/metadata/snowflake.py (1)
ibis-server/app/model/metadata/dto.py (1)
  • RustWrenEngineColumnType (13-58)
ibis-server/tools/query_local_run.py (2)
ibis-server/app/model/__init__.py (1)
  • SnowflakeConnectionInfo (329-360)
ibis-server/app/model/data_source.py (1)
  • get_snowflake_connection (366-397)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test
  • GitHub Check: ci
  • GitHub Check: cargo check
🔇 Additional comments (4)
ibis-server/app/model/metadata/dto.py (1)

53-53: LGTM! Clean addition to support Snowflake VARIANT type.

The new enum member follows the existing pattern and enables proper type mapping for Snowflake's semi-structured data types.

ibis-server/app/model/metadata/snowflake.py (1)

51-52: Good addition for semi-structured type support.

The mappings enable proper handling of Snowflake's semi-structured types:

  • variantVARIANT: Direct mapping to the newly added enum member
  • objectJSON: Treats Snowflake's OBJECT (key-value pairs) as JSON, which is semantically appropriate
ibis-server/tools/query_local_run.py (2)

18-18: LGTM! Proper import for Snowflake support.

The import follows the existing pattern and is used correctly in the conditional branch below.


108-110: LGTM! Snowflake integration follows established patterns.

The implementation correctly:

  • Validates connection info using SnowflakeConnectionInfo.model_validate_json()
  • Obtains the connection via DataSourceExtension.get_snowflake_connection()
  • Follows the same structure as other data source branches

@goldmedal goldmedal requested a review from douenergy October 20, 2025 03:31
@goldmedal
Copy link
Copy Markdown
Contributor Author

There are some issues about pulling the Oracle testing image (always timeout 🤔), but it doesn't matter for this PR.
Let's ignore the CI failure.

@douenergy douenergy merged commit ad39988 into Canner:main Oct 21, 2025
10 of 12 checks passed
@douenergy
Copy link
Copy Markdown
Contributor

Thanks @goldmedal

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

Labels

core ibis python Pull requests that update Python code rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants