Skip to content

Commit

Permalink
[native] Fix PartitionAndSerialize with constant keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasmanova committed Dec 7, 2023
1 parent 7898a86 commit 2d6a65b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class PartitionAndSerializeOperator : public Operator {
decodedVectors_.resize(keyChannels_.size());

for (auto partitionKey : keyChannels_) {
if (partitionKey == kConstantChannel) {
continue;
}
auto& keyVector = input_->childAt(partitionKey);
if (keyVector->mayHaveNulls()) {
decodedVectors_[partitionKey].decode(*keyVector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1163,14 +1163,6 @@ core::WindowNode::BoundType toVeloxBoundType(protocol::BoundType boundType) {
}
}

// Stores partitioned output channels.
// For each 'kConstantChannel', there is an entry in 'constValues'.
struct PartitionedOutputChannels {
std::vector<column_index_t> channels;
// Each vector holding a single value for a constant channel.
std::vector<VectorPtr> constValues;
};

core::LocalPartitionNode::Type toLocalExchangeType(
protocol::ExchangeNodeType type) {
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ public void testAntiJoin(Session joinTypeSession)
assertQuery(joinTypeSession, "SELECT * FROM lineitem WHERE orderkey NOT IN (SELECT orderkey FROM orders WHERE (orderkey + custkey) % 2 = 0)");
assertQuery(joinTypeSession, "SELECT * FROM lineitem " +
"WHERE linenumber = 3 OR orderkey NOT IN (SELECT orderkey FROM orders WHERE (orderkey + custkey) % 2 = 0)");

assertQuery("WITH mapping AS (\n" +
" SELECT orderkey, custkey FROM orders GROUP BY 1, 2\n" +
")\n" +
"SELECT \n" +
" custkey\n" +
"FROM \n" +
" mapping m \n" +
"WHERE \n" +
" m.custkey = 38 \n" +
" AND m.orderkey NOT IN (SELECT orderkey FROM lineitem)");
}

@Test(dataProvider = "joinTypeProvider")
Expand Down

0 comments on commit 2d6a65b

Please sign in to comment.