Skip to content

feat(weave): query filters for scorer_* Array/Map columns#6918

Open
nikumar1206 wants to merge 1 commit into
nikhil/scorer-feedback-agent-monitor-typefrom
nikhil/scorer-feedback-query-filters
Open

feat(weave): query filters for scorer_* Array/Map columns#6918
nikumar1206 wants to merge 1 commit into
nikhil/scorer-feedback-agent-monitor-typefrom
nikhil/scorer-feedback-query-filters

Conversation

@nikumar1206
Copy link
Copy Markdown
Contributor

@nikumar1206 nikumar1206 commented May 20, 2026

Description

Filter support for the Array/Map scorer columns.

  • `Table` exposes `array_string_cols` and `map_cols`.
  • `_transform_external_field_to_internal_field` resolves `scorer_ratings.rating` to `scorer_ratings['rating']` on ClickHouse and `json_extract(scorer_ratings, '$."rating"')` on SQLite. Backslash-escaped dots in keys are preserved (`scorer_reasons.tag\.nsfw` → key `tag.nsfw`).
  • `$contains` on a bare Array(String) column compiles to `has(col, value)` on ClickHouse and `EXISTS (SELECT 1 FROM json_each(col) WHERE value = ?)` on SQLite — was `position()` / `INSTR()` before, which errors on arrays. Other operand shapes still hit the substring path.

Testing

Unit tests.

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 Bot commented May 20, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 84.48276% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
weave/trace_server/orm.py 84.48% 4 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from 6a5aec2 to b8c35fb Compare May 20, 2026 23:37
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from b002e37 to 042a0c0 Compare May 20, 2026 23:37
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from b8c35fb to 53b6a66 Compare May 20, 2026 23:47
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 042a0c0 to 1a857fa Compare May 20, 2026 23:47
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch 4 times, most recently from 6050ded to 4a2618d Compare May 21, 2026 13:55
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 1a857fa to 77c114c Compare May 21, 2026 14:46
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from 4a2618d to 52af3a2 Compare May 21, 2026 14:46
@nikumar1206 nikumar1206 marked this pull request as ready for review May 21, 2026 15:44
@nikumar1206 nikumar1206 requested a review from a team as a code owner May 21, 2026 15:44
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 77c114c to 893c8f7 Compare May 21, 2026 20:36
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch 2 times, most recently from 7260176 to e489cf2 Compare May 21, 2026 21:48
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 893c8f7 to 577fcab Compare May 21, 2026 21:48
Copy link
Copy Markdown
Contributor

@jtschoonhoven jtschoonhoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review. Will look again after you've updated to handle the new scorer_tag_reasons columns, etc. Looks pretty good so far.

Comment thread weave/trace_server/orm.py Outdated
Comment thread weave/trace_server/orm.py Outdated
Comment thread weave/trace_server/orm.py
Comment thread weave/trace_server/orm.py Outdated
Comment thread weave/trace_server/orm.py Outdated
@jtschoonhoven jtschoonhoven force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 577fcab to a4d6155 Compare May 22, 2026 17:23
@jtschoonhoven jtschoonhoven force-pushed the nikhil/scorer-feedback-query-filters branch from e489cf2 to 6acc884 Compare May 22, 2026 17:23
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from 6acc884 to ddcde38 Compare May 22, 2026 18:44
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from a4d6155 to 6f6503e Compare May 22, 2026 18:44
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from ddcde38 to 9c7ec31 Compare May 22, 2026 19:06
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch 2 times, most recently from 9a478a2 to 35db1c8 Compare May 22, 2026 19:30
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from 9c7ec31 to 21be1fb Compare May 22, 2026 19:31
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-agent-monitor-type branch from 35db1c8 to 4b8dbc0 Compare May 22, 2026 22:18
@nikumar1206 nikumar1206 force-pushed the nikhil/scorer-feedback-query-filters branch from 21be1fb to 4065d76 Compare May 22, 2026 22:18
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.

2 participants