Skip to content

Upstream port candidates — week of 2026-06-08 #21

Description

@richardwooding

Summary

  • Since-SHA: ef505ab (cel2sql Go PR #117, Apache Spark dialect — 2026-04-27), the most recent upstream commit ported in pycel2sql PR Add Apache Spark dialect, observe-fork options, and BigQuery COALESCE fix #8.
  • Upstream cel2sql Go scan window: 2026-04-27 → 2026-06-08 (11 commits, all chores — no feat/fix commits).
  • cel2sql4j cross-reference window: same period (1 port candidate found).

Port candidates

1835215fix: pass elem writer to JSON array membership dialect methods (cel2sql4j PR #20)

Source: cel2sql4j (Java cross-reference port), 2026-05-23. No corresponding upstream Go commit yet — the Go implementation has the same latent bug but hasn't addressed it.

Diff scope: Widened the writeJSONArrayMembership and writeNestedJSONArrayMembership dialect method signatures to accept a writeElem writer alongside the existing writeArray writer. The caller (Converter.visitInJSONArray) no longer writes elem = inline before delegating to the dialect; each dialect now owns the full predicate.

Why it matters — per dialect before vs after:

Dialect Old (broken) output Correct output
PostgreSQL elem = ANY(ARRAY(SELECT jsonFunc(arr))) unchanged semantics, elem moves inside
BigQuery elem = UNNEST(JSON_VALUE_ARRAY(arr)) ❌ invalid elem IN UNNEST(JSON_VALUE_ARRAY(arr))
DuckDB elem = (SELECT value FROM json_each(arr)) ❌ scalar subquery returns last row EXISTS (SELECT 1 FROM json_each(arr) WHERE value = elem)
SQLite same as DuckDB same fix
MySQL elem = JSON_CONTAINS(arr, CAST(? AS JSON)) ❌ compares to 0/1 JSON_OVERLAPS(JSON_ARRAY(elem), arr)
Spark throws UnsupportedDialectFeatureError array_contains(from_json(arr, 'ARRAY<STRING>'), elem)

pycel2sql current state (grep probes):

$ grep -nA4 "write_json_array_membership\|write_nested_json_array_membership" \
    src/pycel2sql/dialect/_base.py
131:    def write_json_array_membership(
132:        self, w: StringIO, json_func: str, write_expr: WriteFunc   # ← old single-writer
133:    ) -> None: ...
135:    def write_nested_json_array_membership(
136:        self, w: StringIO, write_expr: WriteFunc                   # ← old single-writer
137:    ) -> None: ...

All six dialect files have the old single-writer signatures. In addition, _converter.py::_visit_in never calls these methodswrite_json_array_membership / write_nested_json_array_membership are dead code; the converter always falls through to write_array_membership regardless of whether the RHS is a JSON array field. This means:

  1. The method signatures need widening (add write_elem: WriteFunc parameter to both, remove json_func: str from the ABC now that each dialect owns the full predicate).
  2. _visit_in needs to detect JSON array RHS (using _is_json_variable_root / _is_field_json / _is_nested_json_field already present in the converter) and route to write_json_array_membership / write_nested_json_array_membership instead of plain write_array_membership.
  3. The test_spark.py::test_json_array_membership_dialect_method_raises test asserts the old throwing behaviour and will need to be replaced with a positive assertion (mirroring the cel2sql4j PR Upstream port candidates — week of 2026-06-01 #20 test update).

cel2sql4j cross-reference: cel2sql4j PR #20 diff is the closest template — the Java SqlWriter functional interface maps directly to pycel2sql's WriteFunc = Callable[[], None].

Portability: Medium. The Dialect ABC signature change + 6 dialect implementations + converter routing + test updates. Each dialect change is small and mechanical; the converter routing is the interesting piece (it already has the JSON-field detection helpers).


Already done


Filtered (upstream Go chore commits — no feat/fix changes to port)

All 11 upstream cel2sql Go commits since ef505ab are chores:

  • 65f4a6c chore: prepare CHANGELOG for v3.8.2
  • 53b5faf chore(deps): bump google.golang.org/api 0.276→0.277
  • 79d81ed chore(deps): bump go-sql-driver/mysql 1.9.3→1.10.0
  • 651bc04 chore: prepare CHANGELOG for v3.8.1
  • df88b1e chore(deps): bump lib/pq 1.11.2→1.12.3
  • b0d57a3 chore(deps): bump cloud.google.com/go/bigquery 1.74→1.76
  • fac750a chore(deps): bump modernc.org/sqlite 1.46.1→1.50.0
  • fd4f0f8 chore(deps): bump github.com/google/cel-go 0.27→0.28
  • c10a520 chore: prepare CHANGELOG for v3.8.0
  • 93843bf chore: add three development skills (add-sql-dialect, add-cel-feature, release-cel2sql)
  • abbbfdd chore: add skill-authoring skill

None of these carry feature or behaviour changes that need porting. The cel-go bump (0.27→0.28) is a Go dependency; it does not affect pycel2sql's Python cel-python parsing layer.


Generated by the weekly upstream-scan routine. https://claude.ai/code/routines/weekly-upstream-port-scan

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions