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](Nereids) infer predicates generate wrong result #23456

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

morrySnow
Copy link
Contributor

We use two facilities to do predicate infer: PredicatePropagation and PullUpPredicates. In the prvious implementation, we use a set to save the intermediate result of PredicatePropagation. The purpose is infer new predicate though two equal relation. However, it is the wrong way. Because it could infer wrong predicate through outer join. For example

select a.c1
   from a
   left join b on a.c2 = b.c2 and a.c1 = '1'
   left join c on a.c2 = c.c2 and a.c1 = '2'
   inner join d on a.c3=d.c3

the predicates a.c1 = '1' and a.c1 = '2' should not be inferred as filter to relation a.

This PR:

  1. revert the change from PR [Fix](Nereids) Fix problem of infer predicates not completely #22145, commit 3c58e9b
  2. Remove the unreasonable restrict in PullupPredicate.
  3. Use new Filter node rather than new otherCondition on join node to save infer predicates

We use two facilities to do predicate infer: PredicatePropagation and
PullUpPredicates. In the prvious implementation, we use a set to save
the intermediate result of PredicatePropagation. The purpose is infer
new predicate though two equal relation. However, it is the wrong way.
Because it could infer wrong predicate through outer join. For example

```sql
select a.c1
   from a
   left join b on a.c2 = b.c2 and a.c1 = '1'
   left join c on a.c2 = c.c2 and a.c1 = '2'
   inner join d on a.c3=d.c3
```

the predicates `a.c1 = '1'` and `a.c1 = '2'` should not be inferred as
filter to relation `a`.

This PR:
1. revert the change from PR apache#22145, commit 3c58e9b
2. Remove the unreasonable restrict in PullupPredicate.
3. Use new Filter node rather than new otherCondition on join node to
   save infer predicates
@morrySnow
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 47.12 seconds
stream load tsv: 541 seconds loaded 74807831229 Bytes, about 131 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 29.3 seconds inserted 10000000 Rows, about 341K ops/s
storage size: 17161981139 Bytes

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 25, 2023
@morrySnow morrySnow merged commit ba931d9 into apache:master Aug 25, 2023
xiaokang pushed a commit that referenced this pull request Aug 25, 2023
We use two facilities to do predicate infer: PredicatePropagation and
PullUpPredicates. In the prvious implementation, we use a set to save
the intermediate result of PredicatePropagation. The purpose is infer
new predicate though two equal relation. However, it is the wrong way.
Because it could infer wrong predicate through outer join. For example

```sql
select a.c1
   from a
   left join b on a.c2 = b.c2 and a.c1 = '1'
   left join c on a.c2 = c.c2 and a.c1 = '2'
   inner join d on a.c3=d.c3
```

the predicates `a.c1 = '1'` and `a.c1 = '2'` should not be inferred as
filter to relation `a`.

This PR:
1. revert the change from PR #22145, commit 3c58e9b
2. Remove the unreasonable restrict in PullupPredicate.
3. Use new Filter node rather than new otherCondition on join node to
   save infer predicates
LiBinfeng-01 added a commit to LiBinfeng-01/doris that referenced this pull request Aug 29, 2023
@xiaokang xiaokang mentioned this pull request Aug 30, 2023
@morrySnow morrySnow deleted the fix_infer branch September 4, 2023 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.0.1-merged p0_w reviewed usercase Important user case type label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants