Skip to content

Conversation

@924060929
Copy link
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)
@924060929 924060929 requested a review from morrySnow as a code owner December 1, 2025 03:37
@hello-stephen
Copy link
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
Contributor Author

run buildall

@924060929
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 38.24% (39/102) 🎉
Increment coverage report
Complete coverage report

@morrySnow morrySnow merged commit 8f4e393 into apache:branch-3.1 Dec 1, 2025
22 checks passed
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.

3 participants