chore(ibis-server): Fix real type & nested composite type mapping for Trino engine#1456
Conversation
📝 WalkthroughWalkthroughAdded "real" type mapping to TRINO_TYPE_MAPPING and refactored TrinoMetadata._transform_column_type to normalize lowercased input types and special-case complex parametric types (array, map, row) to return original data_type unchanged. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ibis-server/app/model/metadata/trino.py (1)
143-157:⚠️ Potential issue | 🟡 MinorReturn type annotation does not match implementation.
Line 143 declares
RustWrenEngineColumnType, but the method also returnsstrat line 157 for complex types. Update the signature and docstring to use a union type.Note: The comment references "Databricks implementations" for consistency, but Databricks does not return raw strings—it always returns
RustWrenEngineColumnTypevalues. BigQuery correctly uses the union type approach shown in the proposed fix.🔧 Proposed fix
- def _transform_column_type(self, data_type: str) -> RustWrenEngineColumnType: + def _transform_column_type(self, data_type: str) -> str | RustWrenEngineColumnType: """Transform Trino data type to RustWrenEngineColumnType. Args: data_type: The Trino data type string Returns: - The corresponding RustWrenEngineColumnType + The corresponding RustWrenEngineColumnType or original string for + complex types🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ibis-server/app/model/metadata/trino.py` around lines 143 - 157, The _transform_column_type method currently declares a return type of RustWrenEngineColumnType but returns raw strings for complex/parametric types; change the signature to return a union (RustWrenEngineColumnType | str) and update the docstring to state it may return either a RustWrenEngineColumnType or the original type string for complex types (preserve behavior for array/map/row). Ensure any needed typing imports (e.g., from typing import Union or using PEP 604 syntax) are added and keep the logic in _transform_column_type unchanged except for the annotated return type and docstring.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@ibis-server/app/model/metadata/trino.py`:
- Around line 143-157: The _transform_column_type method currently declares a
return type of RustWrenEngineColumnType but returns raw strings for
complex/parametric types; change the signature to return a union
(RustWrenEngineColumnType | str) and update the docstring to state it may return
either a RustWrenEngineColumnType or the original type string for complex types
(preserve behavior for array/map/row). Ensure any needed typing imports (e.g.,
from typing import Union or using PEP 604 syntax) are added and keep the logic
in _transform_column_type unchanged except for the annotated return type and
docstring.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b9f42d23-7e7a-4c8c-9dd5-3958e995a7f4
📒 Files selected for processing (1)
ibis-server/app/model/metadata/trino.py
realtype mapping toRustWrenEngineColumnType.REALin Trino type mappingarray,map,row), consistent with BigQuery and Databricks implementations.lower()callexample)
Summary by CodeRabbit
Bug Fixes