-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SMALLER_BINARY: Add binary_executor.patch
From duckdb/duckdb#14057
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
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,92 @@ | ||
diff --git a/src/include/duckdb/common/vector_operations/binary_executor.hpp b/src/include/duckdb/common/vector_operations/binary_executor.hpp | ||
index 55c10bb289..c5f57edabf 100644 | ||
--- a/src/include/duckdb/common/vector_operations/binary_executor.hpp | ||
+++ b/src/include/duckdb/common/vector_operations/binary_executor.hpp | ||
@@ -381,6 +381,8 @@ public: | ||
} | ||
} | ||
|
||
+#define DUCKDB_SMALLER_BINARY | ||
+ | ||
template <class LEFT_TYPE, class RIGHT_TYPE, class OP, bool LEFT_CONSTANT, bool RIGHT_CONSTANT> | ||
static idx_t SelectFlat(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, | ||
SelectionVector *true_sel, SelectionVector *false_sel) { | ||
@@ -417,14 +419,22 @@ public: | ||
ldata, rdata, sel, count, combined_mask, true_sel, false_sel); | ||
} | ||
} | ||
- | ||
+#ifndef DUCKDB_SMALLER_BINARY | ||
template <class LEFT_TYPE, class RIGHT_TYPE, class OP, bool NO_NULL, bool HAS_TRUE_SEL, bool HAS_FALSE_SEL> | ||
+#else | ||
+ template <class LEFT_TYPE, class RIGHT_TYPE, class OP> | ||
+#endif | ||
static inline idx_t | ||
SelectGenericLoop(const LEFT_TYPE *__restrict ldata, const RIGHT_TYPE *__restrict rdata, | ||
const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, | ||
const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lvalidity, | ||
ValidityMask &rvalidity, SelectionVector *true_sel, SelectionVector *false_sel) { | ||
idx_t true_count = 0, false_count = 0; | ||
+#ifdef DUCKDB_SMALLER_BINARY | ||
+ const bool HAS_TRUE_SEL = true_sel; | ||
+ const bool HAS_FALSE_SEL = false_sel; | ||
+ const bool NO_NULL = false; | ||
+#endif | ||
for (idx_t i = 0; i < count; i++) { | ||
auto result_idx = result_sel->get_index(i); | ||
auto lindex = lsel->get_index(i); | ||
@@ -452,6 +462,7 @@ public: | ||
const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, | ||
const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lvalidity, | ||
ValidityMask &rvalidity, SelectionVector *true_sel, SelectionVector *false_sel) { | ||
+#ifndef DUCKDB_SMALLER_BINARY | ||
if (true_sel && false_sel) { | ||
return SelectGenericLoop<LEFT_TYPE, RIGHT_TYPE, OP, NO_NULL, true, true>( | ||
ldata, rdata, lsel, rsel, result_sel, count, lvalidity, rvalidity, true_sel, false_sel); | ||
@@ -463,6 +474,10 @@ public: | ||
return SelectGenericLoop<LEFT_TYPE, RIGHT_TYPE, OP, NO_NULL, false, true>( | ||
ldata, rdata, lsel, rsel, result_sel, count, lvalidity, rvalidity, true_sel, false_sel); | ||
} | ||
+#else | ||
+ return SelectGenericLoop<LEFT_TYPE, RIGHT_TYPE, OP>(ldata, rdata, lsel, rsel, result_sel, count, lvalidity, | ||
+ rvalidity, true_sel, false_sel); | ||
+#endif | ||
} | ||
|
||
template <class LEFT_TYPE, class RIGHT_TYPE, class OP> | ||
@@ -471,10 +486,13 @@ public: | ||
const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, | ||
const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lvalidity, | ||
ValidityMask &rvalidity, SelectionVector *true_sel, SelectionVector *false_sel) { | ||
+#ifndef DUCKDB_SMALLER_BINARY | ||
if (!lvalidity.AllValid() || !rvalidity.AllValid()) { | ||
return SelectGenericLoopSelSwitch<LEFT_TYPE, RIGHT_TYPE, OP, false>( | ||
ldata, rdata, lsel, rsel, result_sel, count, lvalidity, rvalidity, true_sel, false_sel); | ||
- } else { | ||
+ } else | ||
+#endif | ||
+ { | ||
return SelectGenericLoopSelSwitch<LEFT_TYPE, RIGHT_TYPE, OP, true>( | ||
ldata, rdata, lsel, rsel, result_sel, count, lvalidity, rvalidity, true_sel, false_sel); | ||
} | ||
@@ -502,6 +520,7 @@ public: | ||
if (left.GetVectorType() == VectorType::CONSTANT_VECTOR && | ||
right.GetVectorType() == VectorType::CONSTANT_VECTOR) { | ||
return SelectConstant<LEFT_TYPE, RIGHT_TYPE, OP>(left, right, sel, count, true_sel, false_sel); | ||
+#ifndef DUCKDB_SMALLER_BINARY | ||
} else if (left.GetVectorType() == VectorType::CONSTANT_VECTOR && | ||
right.GetVectorType() == VectorType::FLAT_VECTOR) { | ||
return SelectFlat<LEFT_TYPE, RIGHT_TYPE, OP, true, false>(left, right, sel, count, true_sel, false_sel); | ||
@@ -511,10 +530,12 @@ public: | ||
} else if (left.GetVectorType() == VectorType::FLAT_VECTOR && | ||
right.GetVectorType() == VectorType::FLAT_VECTOR) { | ||
return SelectFlat<LEFT_TYPE, RIGHT_TYPE, OP, false, false>(left, right, sel, count, true_sel, false_sel); | ||
+#endif | ||
} else { | ||
return SelectGeneric<LEFT_TYPE, RIGHT_TYPE, OP>(left, right, sel, count, true_sel, false_sel); | ||
} | ||
} | ||
+#undef DUCKDB_SMALLER_BINARY | ||
}; | ||
|
||
} // namespace duckdb |