sql,opt: propagate composite types (labeled tuples)#26621
sql,opt: propagate composite types (labeled tuples)#26621craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
|
@RaduBerinde @rytaft can you help me with the last remaining bit: the derived scalar type for a subquery in scalar context is not computed properly in the optimizer. Where is that type computed today? |
55883bc to
b4d7964
Compare
855eb6a to
6b42768
Compare
Never mind, found it! RFAL |
6b42768 to
b49c796
Compare
b49c796 to
ba302d0
Compare
|
opt part LGTM Review status: Comments from Reviewable |
|
@BramGruneir can you propagate the comments you made on #26628 that really pertain to this PR here? I'd like to iterate and merge this one before I rebase the other one. |
Release note: None
This patch adds more complete support for composite types (labeled tuples) by ensuring the following: - tuple labels are preserved during constant folding of tuple expressions. - tuple labels are preserved during expression transformations in optimizations. - subqueries in scalar contexts receive a composite type with labels. Note that there is currently a bug in DTuple serialization which break composite literals in distributed execution, so the composite type support is not fully ready yet. This is tracked as separate bug cockroachdb#26624. Release note: None
ba302d0 to
5947420
Compare
|
@BramGruneir I have replied to your comments that pertain to this PR over in #26628 (comment). |
|
Comments from Reviewable |
|
TFYR! bors r+ |
26621: sql,opt: propagate composite types (labeled tuples) r=knz a=knz Needed to resolve #24866. This patch adds more complete support for composite types (labeled tuples) by ensuring the following: - tuple labels are preserved during constant folding of tuple expressions. - tuple labels are preserved during expression transformations in optimizations. - subqueries in scalar contexts receive a composite type with labels. Note that there is currently a bug in DTuple serialization which break composite literals in distributed execution, so the composite type support is not fully ready yet. This is tracked as separate bug #26624. Release note: None 26683: opt: don't push limit through project when ordering on synthesized column r=RaduBerinde a=RaduBerinde It is invalid to push limit/offset through a projection if the ordering depends on a synthesized column. Fix the rules to check for this. Release note: None Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com> Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Build succeeded |
26628: sql: Support tuple column access and tuple stars r=knz a=knz First commits from #26621. Completes the fix to #24866 by re-activating disabled tests. This work is yet another step towards #16971. It would actually fix #16971 if it were not for #26627, #26624 and #26629. This work is yet another step towards #16971. The labeled tuples introduced in #25283 can now be accessed using their labels or using a star, e.g. `(E).*`. Release note (sql change): Labeled tuples can now be accessed using their labels (e.g. `SELECT (x).word FROM (SELECT pg_expand_keywords() AS x)` or a star (e.g. `SELECT (x).* FROM (SELECT pg_expand_keywords() AS x)`). Fixes #26720. Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com> Co-authored-by: Bram Gruneir <bram@cockroachlabs.com>
Needed to resolve #24866.
This patch adds more complete support for composite types (labeled
tuples) by ensuring the following:
expressions.
in optimizations.
Note that there is currently a bug in DTuple serialization which break
composite literals in distributed execution, so the composite type
support is not fully ready yet.
This is tracked as separate bug #26624.
Release note: None