Skip to content

Comments

feat(duckdb)!: support transpilation of ARRAY_REMOVE_AT#6930

Merged
georgesittas merged 1 commit intomainfrom
mlee/transpile-array_remove_at
Feb 3, 2026
Merged

feat(duckdb)!: support transpilation of ARRAY_REMOVE_AT#6930
georgesittas merged 1 commit intomainfrom
mlee/transpile-array_remove_at

Conversation

@fivetran-MichaelLee
Copy link
Collaborator

@fivetran-MichaelLee fivetran-MichaelLee commented Feb 2, 2026

Implements transpilation of Snowflake's ARRAY_REMOVE_AT(array, position) to DuckDB using LIST_CONCAT and array slicing.

Transpilation patterns

  • Position 0: arr[2:]
  • Positive position: LIST_CONCAT(arr[1:p], arr[p+2:])
  • Position -1: arr[1:LEN(arr)-1]
  • Negative position: LIST_CONCAT(arr[1:LEN(arr)+p], arr[LEN(arr)+p+2:])

All expressions wrapped in CASE WHEN arr IS NULL THEN NULL ELSE ... END for proper NULL propagation.

Limitations

  • Only supports literal integer positions
  • Non-literal positions remain untranspiled with unsupported warning

Changes

  • Added ArrayRemoveAt expression class
  • Implemented _array_remove_at_sql in DuckDB generator
  • Added test cases covering positive/negative positions, edge cases, and non-literal handling

@fivetran-MichaelLee fivetran-MichaelLee self-assigned this Feb 2, 2026
@fivetran-MichaelLee fivetran-MichaelLee marked this pull request as ready for review February 2, 2026 17:13
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:mlee/transpile-array_remove_at, sqlglot version: mlee/transpile-array_remove_at)
  • baseline (main, sqlglot version: 28.7.1.dev13)

⚠️ Limited to dialects: bigquery, snowflake, duckdb

By Dialect

dialect main sqlglot:mlee/transpile-array_remove_at difference links
bigquery -> bigquery 2592/2624 passed (98.8%) 2592/2624 passed (98.8%) No change full result / delta
bigquery -> duckdb 1846/2623 passed (70.4%) 1846/2623 passed (70.4%) No change full result / delta
duckdb -> duckdb 4003/4003 passed (100.0%) 4003/4003 passed (100.0%) No change full result / delta
snowflake -> duckdb 1313/2623 passed (50.1%) 1317/2623 passed (50.2%) ⬆ improved by 0.2% full result / delta
snowflake -> snowflake 2607/2623 passed (99.4%) 2606/2623 passed (99.4%) No change full result / delta

Overall

main: 14496 total, 12361 passed (pass rate: 85.3%), sqlglot version: 28.7.1.dev13

sqlglot:mlee/transpile-array_remove_at: 14496 total, 12364 passed (pass rate: 85.3%), sqlglot version: mlee/transpile-array_remove_at

Difference: No change

@georgesittas georgesittas merged commit 973d25d into main Feb 3, 2026
11 of 13 checks passed
@georgesittas georgesittas deleted the mlee/transpile-array_remove_at branch February 3, 2026 11:51
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