Skip to content

Upstream port candidates — week of 2026-05-25 #18

Description

@richardwooding

Summary

Scanned 8 upstream cel2sql Go commits since ef505ab (v3.8.0, Apache Spark dialect — the last sync point for pycel2sql PR #8). All 8 are dep bumps or CHANGELOG prep; no Go-side features to port this week.

Scanned cel2sql4j cross-reference for the same window (commits after PR #10 / PR #9). Found 1 port candidate and 1 already done.


Port candidates

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

Upstream commit: SPANDigital/cel2sql4j@1835215

Scope: The write_json_array_membership and write_nested_json_array_membership abstract methods in the Dialect ABC currently receive only a write_array writer — not the element being tested for membership. This matches the pre-fix cel2sql4j state and produces broken SQL in most dialects.

grep result (confirms old signatures in pycel2sql):

src/pycel2sql/dialect/_base.py:131:    def write_json_array_membership(
src/pycel2sql/dialect/_base.py:132:        self, w: StringIO, json_func: str, write_expr: WriteFunc   # ← no write_elem
src/pycel2sql/dialect/_base.py:136:    def write_nested_json_array_membership(
src/pycel2sql/dialect/_base.py:137:        self, w: StringIO, write_expr: WriteFunc                   # ← no write_elem

What the cel2sql4j fix shows needs changing:

Dialect Current pycel2sql output (broken) Correct output after fix
PostgreSQL ANY(ARRAY(SELECT jsonFunc(arr))) (works accidentally) elem = ANY(ARRAY(SELECT jsonFunc(arr))) — signature update only
DuckDB elem = (SELECT value FROM json_each(arr)) — scalar subquery returns last row EXISTS (SELECT 1 FROM json_each(arr) WHERE value = elem)
SQLite elem = (SELECT value FROM json_each(arr)) — same scalar subquery bug EXISTS (SELECT 1 FROM json_each(arr) WHERE value = elem)
BigQuery elem = UNNEST(JSON_VALUE_ARRAY(arr))invalid SQL elem IN UNNEST(JSON_VALUE_ARRAY(arr))
MySQL elem = JSON_CONTAINS(arr, CAST(? AS JSON)) — compares elem to 0/1 JSON_OVERLAPS(JSON_ARRAY(elem), arr)
Spark raises UnsupportedDialectFeatureError at conversion time array_contains(from_json(arr, 'ARRAY<STRING>'), elem)

Additionally: the converter's _visit_in (converter.py:396) never routes to write_json_array_membership at all — it always falls through to write_array_membership. Adding the routing is part of the same fix. The cel2sql4j Converter.visitInJSONArray and the Go cel2sql.go:774–794 both show the required detection logic.

cel2sql4j cross-reference: cel2sql4j PR #20 is the direct source. The Go upstream (cel2sql) still has the old signatures in its dialect/dialect.go — this bug has only been fixed in the Java port so far.

Two-test change in test_spark.py: test_json_array_membership_dialect_method_raises and test_nested_json_array_membership_dialect_method_raises currently assert that the Spark dialect raises — they should be updated to assert the correct array_contains(from_json(...), elem) output once the fix lands.

Portability assessment: medium (6 dialect files + _base.py ABC + _converter.py routing + test updates across dialect test files and test_spark.py).


Already done

5e8eaa6Add three repo-local agent skills + fix missed Spark writeFormat impl (cel2sql4j PR #11)

The subject mentions "fix missed Spark writeFormat impl" — a Spark writeFormat method that was omitted in the initial cel2sql4j Spark port. pycel2sql already has this: SparkDialect.write_format is implemented at src/pycel2sql/dialect/spark.py:521 (emits format_string(...)) and was included in pycel2sql PR #8. The skills additions are chore and don't port to pycel2sql.


Out of scope

All 8 cel2sql Go commits since v3.8.0 (ef505ab..65f4a6c) are dependency bumps and CHANGELOG prep; none contain feature or fix changes to port.


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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions