-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-23799 : Calcite. Hash join. #11770
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
Open
Vladsz83
wants to merge
51
commits into
apache:master
Choose a base branch
from
Vladsz83:IGNITE-23799_calcite_hash_join
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
e478873
planner test works
Vladsz83 2d43502
fixed tests. + memory tracking
Vladsz83 4e0f987
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 c30cb44
Minor manual review fixes
Vladsz83 e43c971
Minorities
Vladsz83 a8db16e
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 eb70474
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 2fd447a
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 43a76bf
Merge branch 'master' into IGNITE-23799_calcite_hash_join_v2
Vladsz83 91c9fec
fix
Vladsz83 72987ea
+IGNITE-24675, +IGNITE-23970, +IGNITE-24050
Vladsz83 3337e98
+minor ai3 ticket
Vladsz83 48016a9
Revert "+minor ai3 ticket"
Vladsz83 aba8467
Merge branch 'master' into IGNITE-23799_calcite_hash_join_v2
Vladsz83 2acd9b3
+ lost HashJoin exec test
Vladsz83 c883dc7
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 cc4526c
merged master
Vladsz83 719aaee
Merge branch 'master' into IGNITE-23799_calcite_hash_join_v2
Vladsz83 78d1882
Merge branch 'IGNITE-23799_calcite_hash_join_v2' into IGNITE-23799_ca…
Vladsz83 75eb1e3
review fixes
Vladsz83 354937b
raw
Vladsz83 8928c1b
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 d7fe527
rawWithOldStore
Vladsz83 d493a91
raw with new storage. Some tests.
Vladsz83 8ef4118
self-review fixes
Vladsz83 3fb141c
optimized inputs requesting
Vladsz83 a29c239
self-review fixes
Vladsz83 0d838bf
test fix
Vladsz83 e4c4464
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 7b6de2c
Merge branch 'master' into hash_join_merge_master
Vladsz83 9b2036b
+ master
Vladsz83 414f886
allow mix with is not distinct
Vladsz83 304c43a
review fixes
Vladsz83 630a213
refactor to checkJoinFinished() / tryToRequestInputs();
Vladsz83 e42f8ca
+ rows number processing limitation
Vladsz83 f1da1c1
refactor join reschedule
Vladsz83 35c3613
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 d8ebf60
review fixes
Vladsz83 ea11f2a
review fixes
Vladsz83 1fcdcb6
Merge remote-tracking branch 'my/IGNITE-23799_calcite_hash_join' into…
Vladsz83 15e1e85
review fixes
Vladsz83 dabf871
review fixes
Vladsz83 ab4b742
Merge branch 'master' into IGNITE-23799_calcite_hash_join
Vladsz83 9ddf19d
review fixes
Vladsz83 b14b2fa
key fix
Vladsz83 6d0a6aa
test fix
Vladsz83 438ee87
revers hash store
Vladsz83 61b3776
revert `is not distinct`. revert refactoring of has runtime index
Vladsz83 006fa69
+ non-equi in left join
Vladsz83 e458995
Revert "+ non-equi in left join"
Vladsz83 1f8e00f
review fix
Vladsz83 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
.../ignite/internal/processors/query/calcite/exec/rel/AbstractRightMaterializedJoinNode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.ignite.internal.processors.query.calcite.exec.rel; | ||
|
|
||
| import java.util.ArrayDeque; | ||
| import java.util.Deque; | ||
| import org.apache.calcite.rel.type.RelDataType; | ||
| import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext; | ||
| import org.apache.ignite.internal.util.typedef.F; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| /** Right-part materialized join node. Holds data from the right part locally. */ | ||
| public abstract class AbstractRightMaterializedJoinNode<Row> extends MemoryTrackingNode<Row> { | ||
| /** */ | ||
| protected static final int HALF_BUF_SIZE = IN_BUFFER_SIZE >> 1; | ||
|
|
||
| /** Special flag which marks that all the rows are received. */ | ||
| protected static final int NOT_WAITING = -1; | ||
|
|
||
| /** */ | ||
| protected final Deque<Row> leftInBuf = new ArrayDeque<>(IN_BUFFER_SIZE); | ||
|
|
||
| /** */ | ||
| protected boolean inLoop; | ||
|
|
||
| /** */ | ||
| protected int requested; | ||
|
|
||
| /** */ | ||
| protected int waitingLeft; | ||
|
|
||
| /** */ | ||
| protected int waitingRight; | ||
|
|
||
| /** */ | ||
| protected @Nullable Row left; | ||
|
|
||
| /** */ | ||
| protected int processed; | ||
|
|
||
| /** */ | ||
| protected AbstractRightMaterializedJoinNode(ExecutionContext<Row> ctx, RelDataType rowType) { | ||
| super(ctx, rowType); | ||
| } | ||
|
|
||
| /** */ | ||
| protected abstract void join() throws Exception; | ||
|
|
||
| /** */ | ||
| protected abstract void pushRight(Row row) throws Exception; | ||
|
|
||
| /** {@inheritDoc} */ | ||
| @Override public void request(int rowsCnt) throws Exception { | ||
| assert !F.isEmpty(sources()) && sources().size() == 2; | ||
| assert rowsCnt > 0 && requested == 0; | ||
|
|
||
| requested = rowsCnt; | ||
|
|
||
| if (!inLoop) | ||
| context().execute(this::join0, this::onError); | ||
| } | ||
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected void rewindInternal() { | ||
| requested = 0; | ||
| waitingLeft = 0; | ||
| waitingRight = 0; | ||
| left = null; | ||
|
|
||
| leftInBuf.clear(); | ||
| } | ||
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected Downstream<Row> requestDownstream(int idx) { | ||
| if (idx == 0) { | ||
| return new Downstream<>() { | ||
| @Override public void push(Row row) throws Exception { | ||
| pushLeft(row); | ||
| } | ||
|
|
||
| @Override public void end() throws Exception { | ||
| endLeft(); | ||
| } | ||
|
|
||
| @Override public void onError(Throwable e) { | ||
| AbstractRightMaterializedJoinNode.this.onError(e); | ||
| } | ||
| }; | ||
| } | ||
| else if (idx == 1) { | ||
| return new Downstream<>() { | ||
| @Override public void push(Row row) throws Exception { | ||
| pushRight(row); | ||
| } | ||
|
|
||
| @Override public void end() throws Exception { | ||
| endRight(); | ||
| } | ||
|
|
||
| @Override public void onError(Throwable e) { | ||
| AbstractRightMaterializedJoinNode.this.onError(e); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| throw new IndexOutOfBoundsException(); | ||
| } | ||
|
|
||
| /** */ | ||
| private void pushLeft(Row row) throws Exception { | ||
| assert downstream() != null; | ||
| assert waitingLeft > 0; | ||
|
|
||
| --waitingLeft; | ||
|
|
||
| leftInBuf.add(row); | ||
|
|
||
| join0(); | ||
| } | ||
|
|
||
| /** */ | ||
| private void endLeft() throws Exception { | ||
| assert downstream() != null; | ||
| assert waitingLeft > 0; | ||
|
|
||
| waitingLeft = NOT_WAITING; | ||
|
|
||
| join0(); | ||
| } | ||
|
|
||
| /** */ | ||
| private void endRight() throws Exception { | ||
| assert downstream() != null; | ||
| assert waitingRight > 0; | ||
|
|
||
| waitingRight = NOT_WAITING; | ||
|
|
||
| join0(); | ||
| } | ||
|
|
||
| /** */ | ||
| protected void tryToRequestInputs() throws Exception { | ||
| if (waitingLeft == 0 && leftInBuf.size() <= HALF_BUF_SIZE) | ||
| leftSource().request(waitingLeft = IN_BUFFER_SIZE - leftInBuf.size()); | ||
|
|
||
| if (waitingRight == 0 && requested > 0) | ||
| rightSource().request(waitingRight = IN_BUFFER_SIZE); | ||
| } | ||
|
|
||
| /** */ | ||
| protected Node<Row> leftSource() { | ||
| return sources().get(0); | ||
| } | ||
|
|
||
| /** */ | ||
| protected Node<Row> rightSource() { | ||
| return sources().get(1); | ||
| } | ||
|
|
||
| /** */ | ||
| private void join0() throws Exception { | ||
| checkState(); | ||
|
|
||
| processed = 0; | ||
|
|
||
| join(); | ||
| } | ||
|
|
||
| /** */ | ||
| protected boolean rescheduleJoin() { | ||
| if (processed++ > IN_BUFFER_SIZE) { | ||
| context().execute(this::join0, this::onError); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.