-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support Broadcast HashJoin (#211)
* feat: Support HashJoin * Add comment * Clean up test * Fix join filter * Fix clippy * Use consistent function with sort merge join * Add note about left semi and left anti joins * feat: Support BroadcastHashJoin * Move tests * Remove unused import * Add function to parse join parameters * Remove duplicate code * For review
- Loading branch information
Showing
8 changed files
with
221 additions
and
28 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
common/src/main/java/org/apache/comet/CometArrowStreamWriter.java
This file contains 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,51 @@ | ||
/* | ||
* 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.comet; | ||
|
||
import java.io.IOException; | ||
import java.nio.channels.WritableByteChannel; | ||
|
||
import org.apache.arrow.vector.VectorSchemaRoot; | ||
import org.apache.arrow.vector.VectorUnloader; | ||
import org.apache.arrow.vector.compression.NoCompressionCodec; | ||
import org.apache.arrow.vector.dictionary.DictionaryProvider; | ||
import org.apache.arrow.vector.ipc.ArrowStreamWriter; | ||
import org.apache.arrow.vector.ipc.message.ArrowRecordBatch; | ||
|
||
/** | ||
* A custom `ArrowStreamWriter` that allows writing batches from different root to the same stream. | ||
* Arrow `ArrowStreamWriter` cannot change the root after initialization. | ||
*/ | ||
public class CometArrowStreamWriter extends ArrowStreamWriter { | ||
public CometArrowStreamWriter( | ||
VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) { | ||
super(root, provider, out); | ||
} | ||
|
||
public void writeMoreBatch(VectorSchemaRoot root) throws IOException { | ||
VectorUnloader unloader = | ||
new VectorUnloader( | ||
root, /*includeNullCount*/ true, NoCompressionCodec.INSTANCE, /*alignBuffers*/ true); | ||
|
||
try (ArrowRecordBatch batch = unloader.getRecordBatch()) { | ||
writeRecordBatch(batch); | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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.