Validate date-time query-constant operands - #62
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds query-translation validation for ClickHouse date-time operands that must remain constant throughout a query.
Changes:
- Rejects row-dependent week modes and interval sizes with actionable errors.
- Preserves support for literals and captured parameters.
- Adds integration/negative tests and updates public documentation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
ClickHouseDateTimeMethodTranslator.cs |
Validates query-constant operands. |
ClickHouseDateTimeDbFunctionsExtensions.cs |
Documents operand constraints. |
DateTimeFunctionsTranslationTests.cs |
Covers accepted and rejected operands. |
README.md |
Documents usage restrictions. |
CHANGELOG.md |
Records the bug fix. |
RELEASENOTES.md |
Adds release-facing fix details. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ToStartOfWeekmodes andToStartOfIntervalsizes during query translationWhy
ClickHouse requires the optional
toStartOfWeekmode and the interval size passed throughtoInterval*to be constant for the query. The translator previously forwarded arbitrary row expressions, producing SQL such astoStartOfWeek(ts, mode_column), which ClickHouse rejects withILLEGAL_COLUMN.Recognized invalid calls now fail during query compilation with an actionable message. This also prevents EF Core's top-level client-projection fallback from fetching rows before invoking the throwing client stub.
This is a follow-up to #57.
Validation
dotnet builddotnet test test/EFCore.ClickHouse.Tests/EFCore.ClickHouse.Tests.csproj --no-build— 661 passeddotnet test test/EFCore.ClickHouse.FunctionalTests/EFCore.ClickHouse.FunctionalTests.csproj --no-build— 323 passed, 4 skipped