[SQL] Allow ROW field access without qualifying table#6388
Conversation
mythical-fred
left a comment
There was a problem hiding this comment.
APPROVE.
Minimal, targeted fix: override createStructType on the type factory to tag every struct with StructKind.PEEK_FIELDS_NO_EXPAND, matching the lenient dialect behavior #3636 asked for. Regression test covers both qualified (t.r.b) and unqualified (r.b) field access on a ROW column.
One sanity-check question (non-blocking): the override applies to all struct types the factory creates, not just user-declared ROW(...) columns — relation row types built during planning go through the same path. PEEK_FIELDS_NO_EXPAND is one level (no recursive peek) so I don't see how this can introduce a new ambiguity that the regular FROM-clause column namespace doesn't already handle, but if you've already convinced yourself of that via the wider Java test run feel free to ignore.
|
Two small things I noticed in the latest push (
The |
a03f514 to
4c19a3b
Compare
mythical-fred
left a comment
There was a problem hiding this comment.
Re-APPROVE on 4c19a3b055.
Force-push rebases the prior b6d1c4c08e onto the v0.306.0 prep commit and addresses both follow-up nits from issue comment 4618836591:
- The stray
import javax.xml.datatype.DatatypeFactory;is gone fromSqlToRelCompiler.java(only the intentionalStructKindimport remains in this PR's diff). - The "Expand commentComment on line R30Resolved" GitHub-UI paste is gone from the
QATests.javacomment block.
Substantive code is unchanged from the prior approve: StructKind.PEEK_FIELDS_NO_EXPAND override on createStructType/builder(), the two new Regression3Tests.issue3636 cases covering col.field2 and mixed t.r.b / r.b access, the replaceConnectors helper + reshaped getQATests (now scans new/workloads and .), and the types.md removal of the obsolete "must qualify with table name" caveat. Ship it.
|
This blocked waiting for apache/calcite#4993 to merge |
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
Fixes #3636
for
TABLE T(ROW R(x INT) r)you could not writer.x, you had to writeT.r.x.I thought this was a Calcite bug, but it actually was a configurable behavior; the behavior we had was SQL standard, but we want a more lenient one, which is supported by multiple dialects.
Describe Manual Test Plan
Ran manually the Java tests.
Checklist