fix(ibis): missing to use BigQuery SDK for dry run#1381
fix(ibis): missing to use BigQuery SDK for dry run#1381douenergy merged 1 commit intoCanner:mainfrom
Conversation
WalkthroughThe PR refactors the connector architecture by introducing an abstract interface layer (ConnectorABC and IbisConnector), replacing SimpleConnector with a formal ABC-based hierarchy. All concrete connectors now inherit from this abstraction, with consistent query, dry_run, and close method implementations across all backends. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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 |
|
BigQuery is tested locally |
There was a problem hiding this comment.
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)
ibis-server/app/model/connector.py (1)
401-415: Remove duplicate_handle_pyarrow_unsupported_typemethod.This method is identical to the inherited implementation from
IbisConnector. The duplication adds maintenance burden without providing any Canner-specific behavior.Apply this diff to remove the duplicate:
- def _handle_pyarrow_unsupported_type(self, ibis_table: Table, **kwargs) -> Table: - result_table = ibis_table - for name, dtype in ibis_table.schema().items(): - if isinstance(dtype, Decimal): - # Round decimal columns to a specified scale - result_table = self._round_decimal_columns( - result_table=result_table, col_name=name, **kwargs - ) - elif isinstance(dtype, UUID): - # Convert UUID to string for compatibility - result_table = self._cast_uuid_columns( - result_table=result_table, col_name=name - ) - - return result_table -
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ibis-server/app/model/connector.py(10 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-18T02:23:34.040Z
Learnt from: goldmedal
Repo: Canner/wren-engine PR: 1224
File: ibis-server/app/util.py:49-56
Timestamp: 2025-06-18T02:23:34.040Z
Learning: DuckDB supports querying PyArrow Tables directly in SQL queries without needing to register them. When a pa.Table object is referenced in a FROM clause (e.g., "SELECT ... FROM df" where df is a pa.Table), DuckDB automatically handles the PyArrow object without requiring conn.register().
Applied to files:
ibis-server/app/model/connector.py
📚 Learning: 2025-06-18T02:23:34.040Z
Learnt from: goldmedal
Repo: Canner/wren-engine PR: 1224
File: ibis-server/app/util.py:49-56
Timestamp: 2025-06-18T02:23:34.040Z
Learning: DuckDB supports querying PyArrow Tables directly in SQL queries without needing to register them. When a pa.Table object is referenced in a FROM clause (e.g., "SELECT ... FROM df" where df is a pa.Table), DuckDB automatically handles the PyArrow object via its "replacement scan" mechanism that recognizes Python variables referencing Arrow objects as SQL tables. No conn.register() call is required.
Applied to files:
ibis-server/app/model/connector.py
🧬 Code graph analysis (1)
ibis-server/app/model/connector.py (3)
ibis-server/app/routers/v3/connector.py (1)
query(61-233)ibis-server/wren/session/__init__.py (2)
sql(37-52)dry_run(138-145)ibis-server/app/model/data_source.py (1)
DataSource(62-221)
⏰ 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). (2)
- GitHub Check: ci
- GitHub Check: ci
🔇 Additional comments (7)
ibis-server/app/model/connector.py (7)
183-195: LGTM! Clean abstract interface.The
ConnectorABCinterface properly defines the contract for all connector implementations with the essential methods:query,dry_run, andclose.
197-274: LGTM! Solid base implementation.The
IbisConnectorprovides a well-structured base implementation with proper lifecycle management, PyArrow type compatibility handling, and comprehensive close logic with multiple fallback strategies.
276-318: LGTM! Postgres-specific close logic is appropriate.The custom
closemethod properly handles Postgres connection lifecycle with query cancellation and defensive checks to prevent segfaults.
320-385: LGTM! MSSql-specific handling is well implemented.The connector properly handles MSSQL decimal rounding requirements and includes a helpful workaround for ibis issue #10331 with descriptive error messages.
450-488: LGTM! BigQuery dry run now uses SDK as intended.The refactored
BigQueryConnectorproperly uses the BigQuery SDK for bothqueryanddry_runoperations, addressing the omission from PR #1370. The implementation correctly:
- Creates a persistent BigQuery client
- Uses
bigquery.QueryJobConfig(dry_run=True, use_query_cache=False)for dry run validation- Implements proper cleanup in the
closemethod
490-569: LGTM! DuckDB connector is well structured.The connector properly handles various file storage backends (S3, Minio, GCS) and implements database file attachment with appropriate error handling.
571-675: LGTM! Redshift and Databricks connectors are properly implemented.Both connectors correctly:
- Handle multiple authentication methods (IAM/password for Redshift, token/service principal for Databricks)
- Implement the
ConnectorABCinterface consistently- Use appropriate dry run strategies (LIMIT 0 pattern)
- Include proper connection cleanup with error handling
|
CI failure is the oracle flaky test. Let's ignore it for this PR. |
ConnectorABCto be the interface for the connector class. UseIbisConnectorfor the connector which based on ibis only.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.