Skip to content

fix(params): honor declared NUMERIC/BIGNUMERIC query parameter types (#8) - #14

Draft
expobrain wants to merge 1 commit into
stack/02-cdc-load-optionsfrom
stack/03-numeric-params
Draft

expobrain wants to merge 1 commit into
stack/02-cdc-load-optionsfrom
stack/03-numeric-params

Conversation

@expobrain

Copy link
Copy Markdown
Owner

What

The BigQuery REST API encodes scalar query-parameter values as JSON strings. googlesqlite inferred the parameter type from that Go value, so a parameter declared NUMERIC/BIGNUMERIC was analysed as STRING and failed in arithmetic or typed comparisons.

This wraps named occurrences of declared numeric parameters in an explicit CAST before the query reaches the analyzer; arrays are replaced with an equivalent array whose elements are cast individually. The value encoding is unchanged, so NULL/empty handling is preserved.

Changes

  • internal/contentdata/repository.go: query rewrite for declared numeric parameters (scalar and array), typed empty numeric arrays.
  • server/server_test.go: TestNumericQueryParameter covers scalar NUMERIC, scalar BIGNUMERIC (large precision) and an array NUMERIC parameter through the REST query endpoint.

Verification

  • go test ./server ./internal/... ./types — all green.

Stack

Rung 3, based on stack/02-cdc-load-options (PR #13). Next: #9 (creation_time typing). Upstream context: goccy#511 (open), plus open PRs goccy#516/goccy#525/goccy#526.

Refs #8

)

BigQuery clients send scalar parameter values as JSON strings, so googlesqlite inferred STRING for parameters declared NUMERIC/BIGNUMERIC. Wrap named occurrences of those parameters in an explicit cast (and cast array elements individually) before sending the query to the analyzer, and type empty numeric arrays as string slices.

Refs #8
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