Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](mtmv) Fix partition track column fail when 'select *' used in related partition side #43531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seawinde
Copy link
Contributor

@seawinde seawinde commented Nov 8, 2024

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #34781

Problem Summary:

Table def as following, if create partition mv as following will throw exception

ERROR 1105 (HY000): errCode = 2, detailMessage = Unable to find a suitable base table for partitioning, the fail reason is can't not find valid partition track column, because

CREATE MATERIALIZED VIEW mv_10086
        BUILD IMMEDIATE REFRESH AUTO ON MANUAL
        partition by(l_orderkey)
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS 

           select l1.*, O_CUSTKEY
           from lineitem_list_partition l1
           left outer join orders_list_partition
           on l1.l_shipdate = o_orderdate;
CREATE TABLE `orders_list_partition` (
      `o_orderkey` BIGINT not NULL,
      `o_custkey` INT NULL,
      `o_orderstatus` VARCHAR(1) NULL,
      `o_totalprice` DECIMAL(15, 2)  NULL,
      `o_orderpriority` VARCHAR(15) NULL,
      `o_clerk` VARCHAR(15) NULL,
      `o_shippriority` INT NULL,
      `o_comment` VARCHAR(79) NULL,
      `o_orderdate` DATE NULL
    ) ENGINE=OLAP
    DUPLICATE KEY(`o_orderkey`, `o_custkey`)
    COMMENT 'OLAP'
    PARTITION BY list(o_orderkey) (
    PARTITION p1 VALUES in ('1'),
    PARTITION p2 VALUES in ('2'),
    PARTITION p3 VALUES in ('3'),
    PARTITION p4 VALUES in ('4')
    )
    DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 3
    PROPERTIES (
    "replication_num" = "1"
    );

CREATE TABLE `lineitem_list_partition` (
      `l_orderkey` BIGINT not NULL,
      `l_linenumber` INT NULL,
      `l_partkey` INT NULL,
      `l_suppkey` INT NULL,
      `l_quantity` DECIMAL(15, 2) NULL,
      `l_extendedprice` DECIMAL(15, 2) NULL,
      `l_discount` DECIMAL(15, 2) NULL,
      `l_tax` DECIMAL(15, 2) NULL,
      `l_returnflag` VARCHAR(1) NULL,
      `l_linestatus` VARCHAR(1) NULL,
      `l_commitdate` DATE NULL,
      `l_receiptdate` DATE NULL,
      `l_shipinstruct` VARCHAR(25) NULL,
      `l_shipmode` VARCHAR(10) NULL,
      `l_comment` VARCHAR(44) NULL,
      `l_shipdate` DATE NULL
    ) ENGINE=OLAP
    DUPLICATE KEY(l_orderkey, l_linenumber, l_partkey, l_suppkey )
    COMMENT 'OLAP'
    PARTITION BY list(l_orderkey) (
    PARTITION p1 VALUES in ('1'),
    PARTITION p2 VALUES in ('2'),
    PARTITION p3 VALUES in ('3')
    )
    DISTRIBUTED BY HASH(`l_orderkey`) BUCKETS 3
    PROPERTIES ("replication_num" = "1"
    );

Release note

Fix partition track column fail when 'select *' used in related partition side

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@doris-robot
Copy link

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?

@seawinde
Copy link
Contributor Author

seawinde commented Nov 8, 2024

run buildall

@wm1581066 wm1581066 added the usercase Important user case type label label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/2.1.x dev/3.0.x usercase Important user case type label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants