Skip to content

fix(arrow): quote identifiers in generated DDL for Arrow-backed tables (#756) - #761

Open
adsharma wants to merge 1 commit into
mainfrom
fix/756-quote-arrow-identifiers
Open

fix(arrow): quote identifiers in generated DDL for Arrow-backed tables (#756)#761
adsharma wants to merge 1 commit into
mainfrom
fix/756-quote-arrow-identifiers

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Fixes #756

ArrowTableSupport::createViewFromArrowTable, createRelTableFromArrowTable, and createRelTableFromArrowCSR built their CREATE NODE TABLE / CREATE REL TABLE statements by string concatenation, never quoting the Arrow field names or the caller-supplied table names. Many ordinary names (index, order, group, end, default, names with a space, names with a leading digit) are not valid unquoted Cypher identifiers and were rejected by the parser.

Change (src/storage/table/arrow_table_support.cpp):

  • New quoteIdent helper (file-scoped in the lbug namespace, matching the existing join and findArrowColumnByName helpers): wraps an identifier in backticks.
  • All identifier interpolations in the three CREATE ... TABLE builders are now wrapped in quoteIdent(...): column names, table name, primary-key column, and the FROM/TO endpoint table names in the rel-table builders.
  • Bonus fix (same bug pattern): unregisterArrowTable builds a DROP TABLE statement with the same unquoted identifier. Without fixing it, a table created via this PR with a reserved name would have been un-droppable. Now also quoted.

Tests added (3, all pass):

  • ArrowNodeTableTest.CreateArrowTableReservedFieldNames — columns named index and value
  • ArrowNodeTableTest.CreateArrowTableIrregularFieldNames — columns named my column and 2nd (the harder cases)
  • ArrowRelTableTest.CreateArrowRelTableReservedTableName — rel table itself named index

All 50 arrow tests continue to pass; 14 pre-existing skips, 0 regressions.

Release note: callers that previously worked around this bug by pre-quoting Arrow field names with backticks (so the generated DDL happened to be correct) will now get double-quoted identifiers ( `\`index\ ``) and fail. Those backticks should be removed from the Arrow field names.

Out of scope (per the issue author):

  • LogicalType::toString() for STRUCT member names is a design call left for a separate look; STRUCT member quoting still fails after this change.
  • Backtick-escaping inside Transformer::transformSymbolicName is a separate parser issue; not addressed here.

Add a quoteIdent helper and wrap every identifier interpolation in
createViewFromArrowTable, createRelTableFromArrowTable,
createRelTableFromArrowCSR, and unregisterArrowTable.

Arrow field names and caller-supplied table names are arbitrary strings;
many ordinary ones (index, order, group, names with a space or leading
digit) are not valid unquoted Cypher identifiers and would cause parser
rejection.

Also add tests:
- CreateArrowTableReservedFieldNames: column names 'index' and 'value'
- CreateArrowTableIrregularFieldNames: column names 'my column' and '2nd'
- CreateArrowRelTableReservedTableName: rel table name 'index'

Release note: callers that previously worked around this bug by
pre-quoting Arrow field names with backticks will now get double-quoted
identifiers (``index``) and fail. Those backticks should be removed
from the Arrow field names.
@adsharma
adsharma force-pushed the fix/756-quote-arrow-identifiers branch from 21a6fc0 to 8ce3c81 Compare July 30, 2026 19:58
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.

Bug: Arrow field names and table names are interpolated into generated DDL unquoted

1 participant