Skip to content

branch-4.0: [fix](mtmv) Fix query err when calc mv functional dependency which has variant and log more detailed info for troubleshoot a problem #59933#61659

Merged
yiguolei merged 1 commit intobranch-4.0from
auto-pick-59933-branch-4.0
Mar 24, 2026
Merged

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Cherry-picked from #59933

…s variant and log more detailed info for troubleshoot a problem (#59933)

Fix query err when calc mv fd by catch it and log more detailed info for
troubleshoot a problem

1. originOutputs.size() should equlas targetOutputs.size(), if not would
throw exception, this would cause query err,
should log err log and not cause query err
2. current log could not find the root cause, so add detail log
3. fix the problem by mapping the slot full path name between scan mv
output and mv sql plan output

for example as following
```sql
  CREATE TABLE fact_var (
    k INT,
    v VARIANT
  ) ENGINE=OLAP
  DUPLICATE KEY(k)
  DISTRIBUTED BY HASH(k) BUCKETS 1
  PROPERTIES ("replication_num" = "1");

  INSERT INTO fact_var VALUES
  (1, '{"a":1,"b":{"c":10,"d":20}}'),
  (2, '{"a":2,"b":{"c":30}}');

  CREATE MATERIALIZED VIEW mv_var
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
  SELECT k, v
  FROM fact_var;
```

if run query as fllowing, mv_var sacn would return k, v, v['a'] but
mv_var def plan sql, would return k, v,
the size is different but also can work after the fix
```sql
SELECT v['a'] AS c_val FROM mv_var;
```

Related PR: #40106
@github-actions github-actions bot requested a review from yiguolei as a code owner March 24, 2026 06:24
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Mar 24, 2026

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?

@dataroaring dataroaring reopened this Mar 24, 2026
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Mar 24, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 75.00% (21/28) 🎉
Increment coverage report
Complete coverage report

@yiguolei yiguolei merged commit 3e5dbd9 into branch-4.0 Mar 24, 2026
26 of 29 checks passed
@github-actions github-actions bot deleted the auto-pick-59933-branch-4.0 branch March 24, 2026 09:44
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.

5 participants