fix(vikingdb): normalize all date_time range filters in API key client - #3973
Open
fengluodb wants to merge 2 commits into
Open
fix(vikingdb): normalize all date_time range filters in API key client#3973fengluodb wants to merge 2 commits into
fengluodb wants to merge 2 commits into
Conversation
OpenViking compiles TimeRange down to the internal `range` DSL, but the commercial VikingDB data plane (Bearer API-key auth) expects `time_range` for date_time fields and `range` only for numeric fields. The API-key client does not run the local engine's filter conversion, so `range` nodes on date_time fields were sent verbatim and mis-handled. Normalize `range` -> `time_range` for every schema date_time field by reusing the canonical VALID_TIME_FIELDS constant, covering both `created_at` and `updated_at` instead of hardcoding a single field name. Numeric `range` nodes and nested boolean filter structure are preserved, and filters already emitted as `time_range` pass through unchanged. Only the request body `filter` is rewritten; upsert/update data is untouched. Add regression tests covering the converted created_at/updated_at date filters, an unchanged numeric filter, and time_range idempotency. Co-authored-by: TRAE CLI <noreply@bytedance.com>
The API-key client already rewrites `range` filter nodes on date_time fields to VikingDB's `time_range` operator, but the AK/SK-signed `VolcengineCollection` shares the same commercial data-plane endpoints and had the identical latent bug: `TimeRange` expressions compile down to the internal `range` DSL, which the commercial API only accepts for numeric fields. Mirror the API-key fix in `VolcengineCollection._data_post` so both auth modes normalize `range` -> `time_range` for `created_at`/`updated_at` while leaving numeric `range` nodes untouched. Add AK/SK coverage for both date_time fields and for idempotency of already-`time_range` input. Co-authored-by: TRAE CLI <noreply@bytedance.com>
baojun-zhang
approved these changes
Aug 13, 2026
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.
Description
Supersedes #3954. Fix date filtering for the commercial VikingDB data plane that uses Bearer API-key authentication.
OpenViking compiles
TimeRangedown to the internalrangeDSL, but the commercial data plane expectstime_rangefor date_time fields andrangeonly for numeric fields. The API-key client does not run the local engine filter conversion, sorangenodes on date_time fields were sent verbatim and mis-handled.Why this differs from #3954
#3954 only normalized the
created_atfield via a hardcoded literal. The context collection schema has two date_time fields,created_atandupdated_at, andupdated_atis the defaulttime_fieldfor the public find/search API. Hardcodingcreated_atleavesupdated_atrange filters broken and is fragile against schema evolution.Changes Made
range->time_rangefor every schema date_time field by reusing the canonicalVALID_TIME_FIELDSconstant (created_at+updated_at) instead of a hardcoded field name.rangenodes and nested boolean filter structure.time_rangeunchanged (idempotent).filter; upsert/update data untouched.Testing
uvx ruff check/uvx ruff format --checkpass on both files.test_volcengine_clients.pyaboutignore_unknown_fieldsreproduce on the base branch and are unrelated to this change.)