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

[branch-2.1](auto-partition) fix auto partition expr change unexpected (#36345) #36514

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

zclllyybb
Copy link
Contributor

@zclllyybb zclllyybb commented Jun 19, 2024

Proposed changes

pick #36345

there's a caller used getPartitionExprs and modified the result. the result is a reference to a part of metadata. If when we create the table, the number of editlog didn't reach the limit to generate image file, when it reaches, the image will get the wrong metadata of partitionExprs from memory which was modified.

when Nereids timeout, we will get into trouble in legacy planner here:

    private void analyzerPartitionExpr(Analyzer analyzer, PartitionInfo partitionInfo) throws AnalysisException {
        ArrayList<Expr> exprs = partitionInfo.getPartitionExprs();
        for (Expr e : exprs) {
            LOG.info("beforeB: {}", e.toSql());
            e.analyze(analyzer);
            LOG.info("afterB: {}", e.toSql());
        }
    }
2024-06-18 21:49:07,449 INFO (mysql-nio-pool-154|695) [OlapScanNode.analyzerPartitionExpr():1561] beforeB: date_trunc(Carding_Day, 'MONTH')
2024-06-18 21:49:07,449 INFO (mysql-nio-pool-154|695) [OlapScanNode.analyzerPartitionExpr():1563] afterB: date_trunc(`a`.null, 'MONTH')
…he#36345)

## Proposed changes

Issue Number: close #xxx

there's a caller used `getPartitionExprs` and modified the result. the
result is a reference to a part of metadata. If when we create the
table, the number of editlog didn't reach the limit to generate image
file, when it reaches, the image will get the wrong metadata of
`partitionExprs` from memory which was modified.

currently we don't know why, but this root cause has been confirmed by:
```java
    private void analyzerPartitionExpr(Analyzer analyzer, PartitionInfo partitionInfo) throws AnalysisException {
        ArrayList<Expr> exprs = partitionInfo.getPartitionExprs();
        for (Expr e : exprs) {
            LOG.info("beforeB: {}", e.toSql());
            e.analyze(analyzer);
            LOG.info("afterB: {}", e.toSql());
        }
    }
```

```log
2024-06-18 21:49:07,449 INFO (mysql-nio-pool-154|695) [OlapScanNode.analyzerPartitionExpr():1561] beforeB: date_trunc(Carding_Day, 'MONTH')
2024-06-18 21:49:07,449 INFO (mysql-nio-pool-154|695) [OlapScanNode.analyzerPartitionExpr():1563] afterB: date_trunc(`a`.null, 'MONTH')
```
@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

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@zclllyybb
Copy link
Contributor Author

run buildall

@morningman morningman merged commit 6df1a9a into apache:branch-2.1 Jun 20, 2024
19 of 23 checks passed
@morningman morningman mentioned this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants