Skip to content

fix: allow aggregation by date#208

Merged
PMerlet merged 7 commits into
mainfrom
fix/date-aggregation
Mar 16, 2026
Merged

fix: allow aggregation by date#208
PMerlet merged 7 commits into
mainfrom
fix/date-aggregation

Conversation

@PMerlet

@PMerlet PMerlet commented Mar 16, 2026

Copy link
Copy Markdown
Member

Fix date-based aggregation grouping in Cosmos datasource AggregationConverter

  • Adds DATE_OPERATION_TO_LENGTH mapping and buildDateGroupExpression helper to aggregation-converter.ts, which converts Year/Month/Day group operations to LEFT(c.<field>, N) SQL expressions using ISO 8601 substring lengths.
  • Relaxes buildGroupedAggregationQuery to allow date operations on a single group field instead of rejecting them.
  • Behavioral Change: grouped aggregation queries no longer include an ORDER BY clause; unsupported date operations now throw an error.

Macroscope summarized d74e965.

PMerlet and others added 7 commits March 16, 2026 16:57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DateTimeBin is not a valid Cosmos DB SQL API function. Instead, use
LEFT() on ISO 8601 date strings for date grouping (Day=10, Month=7,
Year=4 chars). Also remove ORDER BY from grouped queries as Cosmos DB
doesn't support ORDER BY on computed expressions with GROUP BY.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PMerlet
PMerlet merged commit 4622350 into main Mar 16, 2026
2 checks passed
@PMerlet
PMerlet deleted the fix/date-aggregation branch March 16, 2026 18:56
forest-bot added a commit that referenced this pull request Mar 16, 2026
forest-bot added a commit that referenced this pull request Mar 27, 2026
# [2.9.0](https://github.com/ForestAdmin/forestadmin-experimental/compare/rpc-agent@2.8.0...rpc-agent@2.9.0) (2026-03-27)

### Bug Fixes

* allow aggregation by date ([#208](#208)) ([4622350](4622350))
* use Cosmos DB compatible functions for date aggregation ([#209](#209)) ([f4be4e2](f4be4e2))

### Features

* **api chart:** allow customizing api chart with query or body parameters ([#211](#211)) ([6d3eb65](6d3eb65))

### Performance Improvements

* rollup Week/Quarter from Day-level queries ([#210](#210)) ([9528843](9528843))
forest-bot added a commit that referenced this pull request Apr 24, 2026
# [1.12.0](https://github.com/ForestAdmin/forestadmin-experimental/compare/datasource-rpc@1.11.0...datasource-rpc@1.12.0) (2026-04-24)

### Bug Fixes

* allow aggregation by date ([#208](#208)) ([4622350](4622350))
* **datasource-cosmos:** increase maxConditions default to 1000 ([#212](#212)) ([96df1f5](96df1f5))
* fix aggregation when using a reserved keyword ([#207](#207)) ([7200f0b](7200f0b))
* **rpc agent:** release ([8f532a0](8f532a0))
* **rpc datasource:** fix introspection parsing ([b3978a1](b3978a1))
* use Cosmos DB compatible functions for date aggregation ([#209](#209)) ([f4be4e2](f4be4e2))

### Features

* **api chart:** allow customizing api chart with query or body parameters ([#211](#211)) ([6d3eb65](6d3eb65))

### Performance Improvements

* rollup Week/Quarter from Day-level queries ([#210](#210)) ([9528843](9528843))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant