Skip to content

Handle dotted table names in quoted identifiers - #248

Merged
jogrogan merged 1 commit into
mainfrom
jogrogan/dotTables
Aug 11, 2026
Merged

Handle dotted table names in quoted identifiers#248
jogrogan merged 1 commit into
mainfrom
jogrogan/dotTables

Conversation

@jogrogan

Copy link
Copy Markdown
Collaborator

Problem

A quoted identifier segment can legitimately contain a dot — e.g. the Kafka topic "KAFKA"."my.event". Calcite parses such statements correctly (a quoted segment stays whole), but several Hoptimator paths took a bare identifier string and naively split("\\."), shredding my.event into my + event. That broke:

  • !describe / !graph / !resolve CLI commands
  • GraphService.resolve (graph target resolution)
  • PipelineGraphBuilder custom-resource name lookups

Fix

New IdentifierUtils.parseIdentifier(String) that splits by quoting:

  • Unquoted input → split directly on .. This is exact (an unquoted segment can't contain a dot) and also covers the unquoted hyphenated names the CLI commands accept but the SQL grammar rejects, e.g. LOGICAL.testevent-graph (which the parser would read as subtraction).
  • Quoted input → uses the SQL parser so a dot inside a quoted segment ("my.table") is preserved. Malformed/mixed quoted forms (e.g. "KAFKA".my-topic) now throw rather than silently mis-splitting.

Wired into GraphService.resolve, the !resolve/!describe CLI + quidem paths, and PipelineGraphBuilder.forView/forLogicalTable.

Naming is intentionally unchanged. K8s object names here are DNS-1123 subdomains and already permit dots, and resources with dotted names exist in production. canonicalizeName is left as-is so derived names stay backwards compatible (create-time and lookup-time both yield venice-my.event); rewriting dots would make the operator create duplicates instead of updating existing resources.

Tests

  • IdentifierUtilsTest — quoted dotted segments, escaped quotes, unquoted/hyphenated, and malformed-quoted-throws cases.
  • K8sUtilsTest — dot-preservation cases documenting the backwards-compatible naming behavior.
  • GraphServiceTest — resolves "VENICE"."my.table" as a single table identity.
  • hoptimator-kafka integration script kafka-ddl-dotted.id — creates, !describes, and drops a topic whose name contains a dot (verified against a live cluster).

Unit suites, spotbugs, checkstyle, and the affected integration tests all pass.

A quoted identifier segment may legitimately contain a dot, e.g. the Kafka
topic "KAFKA"."my.event". Several code paths took a bare identifier string and
naively split("\\."), shredding "my.event" into "my" + "event" and breaking
!describe / !graph / !resolve and graph / custom-resource lookups.

Add IdentifierUtils.parseIdentifier, which splits unquoted input directly on
'.' (exact, since an unquoted segment cannot contain a dot — this also covers
the unquoted hyphenated names the CLI commands accept, e.g.
LOGICAL.testevent-graph) and uses the SQL parser only for quoted input so a
dot inside a quoted segment is preserved. Malformed quoted identifiers now
error rather than silently mis-splitting.

Wire it into GraphService.resolve, the !resolve/!describe CLI and quidem
paths, and PipelineGraphBuilder. K8s object names already permit dots, so
canonicalization is left unchanged (backwards compatible with existing dotted
resource names).

Add unit tests for IdentifierUtils, dot-preservation tests for
K8sUtils.canonicalizeName, a GraphService test, and a Kafka integration
script that creates/describes/drops a topic whose name contains a dot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Code Coverage

Overall Project 84.76% 🟢
Files changed 100% 🟢

File Coverage
IdentifierUtils.java 100% 🟢
GraphService.java 86.36% 🟢
PipelineGraphBuilder.java 82.47% 🟢


@Test
void canonicalizeNamePreservesDots() {
// Dots are intentionally NOT rewritten: K8s object names here are DNS-1123 subdomains, which

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be technically true, but I have never seen periods in CR names, and some linters will complain about them. I think it's probably safer if we replace periods with hyphens.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fact checked and unfortunately we have some CRs in prod that use dots in the name. Changing this behavior would effectively orphan them, they’d no longer be able to be updated or dropped and the same view reissued would lead to a duplicate job.


@Test
void canonicalizeNameWithDottedTableAndDatabasePreservesDot() {
assertEquals("kafka-database-my.event", K8sUtils.canonicalizeName("kafka-database", "my.event"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typical order of operations makes this weird to read

@jogrogan
jogrogan merged commit c244ce6 into main Aug 11, 2026
1 check passed
@jogrogan
jogrogan deleted the jogrogan/dotTables branch August 11, 2026 21:02
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