-
Notifications
You must be signed in to change notification settings - Fork 121
in dremio, removing the micro/nano seconds because dremio support mil… #874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…i seconds only when filtering
|
👋 @GuyEshdat |
WalkthroughUpdated timestamp casting logic in dremio__edr_cast_as_timestamp to first normalize input by trimming fractional seconds to three digits via REGEXP_REPLACE before performing the cast. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
macros/utils/data_types/cast_column.sql(1 hunks)
⏰ 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). (14)
- GitHub Check: test (latest_official, redshift) / test
- GitHub Check: test (fusion, bigquery) / test
- GitHub Check: test (latest_official, athena) / test
- GitHub Check: test (latest_official, databricks_catalog) / test
- GitHub Check: test (latest_official, trino) / test
- GitHub Check: test (latest_official, dremio) / test
- GitHub Check: test (latest_official, snowflake) / test
- GitHub Check: test (fusion, databricks_catalog) / test
- GitHub Check: test (fusion, redshift) / test
- GitHub Check: test (fusion, snowflake) / test
- GitHub Check: test (latest_official, clickhouse) / test
- GitHub Check: test (latest_official, postgres) / test
- GitHub Check: test (latest_official, bigquery) / test
- GitHub Check: test (latest_pre, postgres) / test
|
|
||
| {%- macro dremio__edr_cast_as_timestamp(timestamp_field) -%} | ||
| cast({{ timestamp_field }} as {{ elementary.edr_type_timestamp() }}) | ||
| cast(REGEXP_REPLACE({{ timestamp_field }}, '(\.\d{3})\d+', '$1') as {{ elementary.edr_type_timestamp() }}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the Dremio backreference syntax.
REGEXP_REPLACE in Dremio expects \1-style backreferences, not $1. With the current replacement string the fractional part becomes literal $1, and the subsequent CAST will fail. Please switch the replacement to '\1' (escaping as needed in Jinja) so the truncated milliseconds are preserved correctly.
🤖 Prompt for AI Agents
In macros/utils/data_types/cast_column.sql around line 32, the REGEXP_REPLACE
replacement uses a POSIX-style $1 backreference which Dremio does not recognize;
change the replacement to use a Dremio backreference '\1' and ensure it is
properly escaped for Jinja (e.g. use '\\1' or a quoted literal that yields '\1'
in the rendered SQL) so the fractional milliseconds are truncated correctly
before casting.
…i seconds only when filtering
Summary by CodeRabbit