Repository navigation
fix(drivers): athena custom-granularity pre-aggregation build - #10950
Conversation
|
Claude finished @waralexrom's task in 1m 22s —— View job Code Review: PR #10950
SummaryClean, well-scoped fix for CORE-410. The root cause is correctly identified: Detailed ReviewCore Fix —
|
…bucket `PrestodbQuery.dateBin` used `from_iso8601_timestamp(...)` as the `date_add` origin, which returns `timestamp with time zone`. Because `date_add` inherits the type of its third argument, custom-granularity rollup columns ended up typed as `timestamp(3) with time zone` — a type Hive cannot serialize when writing to an Athena export bucket, failing the CTAS with `NOT_SUPPORTED: Unsupported Hive type: timestamp(3) with time zone`. Wrap the origin in `CAST(... AS TIMESTAMP)` so the result is a plain TIMESTAMP, matching the shape already produced by `timeGroupedColumn`/`date_trunc` for standard granularities. Also close a testing-drivers E2E coverage gap: until now no rollup with a custom granularity was ever built against the Athena export bucket in CI, so the regression had no test to catch it. Introduce a unique `build_only_half_year` granularity and a `TBuildOnlyHalfYear` rollup on `ECommerce.orderDate`, built explicitly in the `must built pre-aggregations` step. The granularity name is unique to this rollup so no query test can match it (keeping snapshots stable in both legacy and Tesseract planner modes). Refs CORE-410.
82d7a3c to
9eb1b37
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #10950 +/- ##
===========================================
- Coverage 83.57% 58.50% -25.07%
===========================================
Files 254 216 -38
Lines 76126 17006 -59120
Branches 0 3454 +3454
===========================================
- Hits 63622 9950 -53672
+ Misses 12504 6553 -5951
- Partials 0 503 +503
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Extend the custom-granularity pre-aggregation build to all driver fixtures, not just Athena. The `build_only_half_year` granularity and the `ECommerce.TBuildOnlyHalfYear` rollup are now defined in every fixture, and the `must built pre-aggregations` step unconditionally builds it. Drives CI to surface any other drivers that struggle with rollup-build from a custom-granularity time grouping. Drivers that genuinely cannot support this can be skipped per-fixture once we see which ones break.
…fYear rollup ClickHouseQuery.preAggregationLoadSql refuses to compile a rollup without an indexes block (it needs at least one to produce the `ORDER BY` clause of the underlying MergeTree). Mirror what the other ECommerce rollups in clickhouse.json do.
|
Claude finished @waralexrom's task in 2m 18s —— View job Code Review: PR #10950 — Athena custom-granularity pre-aggregation build fix
SummaryClean, well-targeted fix for CORE-410. The root cause is correctly identified: Detailed ReviewCore Fix —
|
Summary
CORE-410: Athena pre-aggregation builds for custom granularities fail when an export bucket is configured (
NOT_SUPPORTED: Unsupported Hive type: timestamp(3) with time zone). CastdateBinorigin to plainTIMESTAMPso Hive can serialize the rollup output column.Changes
PrestodbQuery.dateBin: wrap origin inCAST(... AS TIMESTAMP)sodate_addreturns a plainTIMESTAMPinstead oftimestamp with time zone. Inherited by Athena and Trino, brings the custom-granularity rollup column shape in line with whattimeGroupedColumn/date_truncalready emits for standard granularities.athena-query.test.tsasserting the newloadSqlshape for a custom-granularity rollup.cubejs-testing-drivers: introduce a uniquebuild_only_half_yeargranularity and aECommerce.TBuildOnlyHalfYearrollup, built explicitly undermust built pre-aggregationsfortype === 'athena'. The granularity name is unique to this rollup so no query test matches it — snapshots stay stable in both legacy and Tesseract planner modes.Testing
cd packages/cubejs-schema-compiler && yarn tsc && TZ=UTC node_modules/.bin/jest dist/test/unit/athena-query.test.js— both unit tests pass; without the fix the new regression fails (TZ-aware origin leaks intoloadSql).CREATE TABLE ... AS SELECTsucceeds. CI matrix covers Athena in bothuse_tesseract_sql_planner: trueandfalse.