Skip to content

branch-4.0: [feature](nereids) Support dereference expression #57532 - #58546

Merged
yiguolei merged 2 commits into
apache:branch-4.0from
924060929:branch-4.0-dereference
Dec 2, 2025
Merged

branch-4.0: [feature](nereids) Support dereference expression #57532#58546
yiguolei merged 2 commits into
apache:branch-4.0from
924060929:branch-4.0-dereference

Conversation

@924060929

Copy link
Copy Markdown
Contributor

picked from #57532

Support dereference expression for map/struct/variant
```sql
MySQL root@127.0.0.1:rqg> select
-> named_struct('c', named_struct('c', 100)).c.c,
-> map('a', 10, 'b', 20).a,
-> map('a', 10, 'b', 20).b,
-> cast('{"a":{"b":300}}' as variant).a.b;
+-----------------------------------------------+-------------------------+-------------------------+----------------------------------------+
| named_struct('c', named_struct('c', 100)).c.c | map('a', 10, 'b', 20).a | map('a', 10, 'b', 20).b | cast('{"a":{"b":300}}' as variant).a.b |
+-----------------------------------------------+-------------------------+-------------------------+----------------------------------------+
| 100 | 10 | 20 | 300 |
+-----------------------------------------------+-------------------------+-------------------------+----------------------------------------+
```
<b>the slot name parts binding priority:</b>
1. try to bind catalog, if binding failed, jump to 2
2. try to bind database, if binding failed, jump to 3
3. try to bind table, if binding failed, jump to 4
4. try to bind column
for example, `a.a.a.a.a`
first try to bind: catalog=a, database=a, table=a, column=a, sub
fields=a
second try to bind: catalog=&lt;current catalog&gt;, database=a,
table=a, column=a, sub fields=a.a
third try to bind: catalog=&lt;current catalog&gt;, database=&lt;current
database&gt;, table=a, column=a, sub fields=a.a.a
4th try to bind: catalog=&lt;current catalog&gt;, database=&lt;current
database&gt;, table=&lt;underscore table&gt;, column=a, sub
fields=a.a.a.a
(cherry picked from commit ac92fd4)
@Thearas

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@924060929

Copy link
Copy Markdown
ContributorAuthor

run buildall

@924060929

Copy link
Copy Markdown
ContributorAuthor

run buildall

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actionsgithub-actionsBot added approved Indicates a PR has been approved by one committer. reviewed labels Dec 2, 2025
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@yiguolei
yiguolei merged commit 9546f5c into apache:branch-4.0Dec 2, 2025
24 of 26 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@924060929@Thearas@yiguolei