duckdb 0.3.5-dev344.0 → 0.3.5-dev346.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb.cpp +59 -28
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +36852 -36852
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -129092,44 +129092,75 @@ FilterResult FilterCombiner::AddFilter(Expression *expr) {
|
|
|
129092
129092
|
if (expr->GetExpressionClass() == ExpressionClass::BOUND_BETWEEN) {
|
|
129093
129093
|
auto &comparison = (BoundBetweenExpression &)*expr;
|
|
129094
129094
|
//! check if one of the sides is a scalar value
|
|
129095
|
-
bool
|
|
129096
|
-
bool
|
|
129097
|
-
if (
|
|
129098
|
-
//! comparison with scalar
|
|
129095
|
+
bool lower_is_scalar = comparison.lower->IsFoldable();
|
|
129096
|
+
bool upper_is_scalar = comparison.upper->IsFoldable();
|
|
129097
|
+
if (lower_is_scalar || upper_is_scalar) {
|
|
129098
|
+
//! comparison with scalar - break apart
|
|
129099
129099
|
auto node = GetNode(comparison.input.get());
|
|
129100
129100
|
idx_t equivalence_set = GetEquivalenceSet(node);
|
|
129101
|
-
auto
|
|
129102
|
-
auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129101
|
+
auto result = FilterResult::UNSATISFIABLE;
|
|
129103
129102
|
|
|
129104
|
-
|
|
129105
|
-
|
|
129106
|
-
|
|
129107
|
-
|
|
129103
|
+
if (lower_is_scalar) {
|
|
129104
|
+
auto scalar = comparison.lower.get();
|
|
129105
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129106
|
+
|
|
129107
|
+
// create the ExpressionValueInformation
|
|
129108
|
+
ExpressionValueInformation info;
|
|
129109
|
+
if (comparison.lower_inclusive) {
|
|
129110
|
+
info.comparison_type = ExpressionType::COMPARE_GREATERTHANOREQUALTO;
|
|
129111
|
+
} else {
|
|
129112
|
+
info.comparison_type = ExpressionType::COMPARE_GREATERTHAN;
|
|
129113
|
+
}
|
|
129114
|
+
info.constant = constant_value;
|
|
129115
|
+
|
|
129116
|
+
// get the current bucket of constant values
|
|
129117
|
+
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129118
|
+
auto &info_list = constant_values.find(equivalence_set)->second;
|
|
129119
|
+
// check the existing constant comparisons to see if we can do any pruning
|
|
129120
|
+
result = AddConstantComparison(info_list, info);
|
|
129108
129121
|
} else {
|
|
129109
|
-
|
|
129122
|
+
D_ASSERT(upper_is_scalar);
|
|
129123
|
+
const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
|
|
129124
|
+
: ExpressionType::COMPARE_LESSTHAN;
|
|
129125
|
+
auto left = comparison.lower->Copy();
|
|
129126
|
+
auto right = comparison.input->Copy();
|
|
129127
|
+
auto lower_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
|
|
129128
|
+
result = AddBoundComparisonFilter(lower_comp.get());
|
|
129110
129129
|
}
|
|
129111
|
-
info.constant = constant_value;
|
|
129112
129130
|
|
|
129113
|
-
//
|
|
129114
|
-
|
|
129115
|
-
|
|
129116
|
-
|
|
129117
|
-
AddConstantComparison(info_list, info);
|
|
129118
|
-
scalar = comparison.upper.get();
|
|
129119
|
-
constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129131
|
+
// Stop if we failed
|
|
129132
|
+
if (result != FilterResult::SUCCESS) {
|
|
129133
|
+
return result;
|
|
129134
|
+
}
|
|
129120
129135
|
|
|
129121
|
-
|
|
129122
|
-
|
|
129123
|
-
|
|
129136
|
+
if (upper_is_scalar) {
|
|
129137
|
+
auto scalar = comparison.upper.get();
|
|
129138
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129139
|
+
|
|
129140
|
+
// create the ExpressionValueInformation
|
|
129141
|
+
ExpressionValueInformation info;
|
|
129142
|
+
if (comparison.upper_inclusive) {
|
|
129143
|
+
info.comparison_type = ExpressionType::COMPARE_LESSTHANOREQUALTO;
|
|
129144
|
+
} else {
|
|
129145
|
+
info.comparison_type = ExpressionType::COMPARE_LESSTHAN;
|
|
129146
|
+
}
|
|
129147
|
+
info.constant = constant_value;
|
|
129148
|
+
|
|
129149
|
+
// get the current bucket of constant values
|
|
129150
|
+
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129151
|
+
// check the existing constant comparisons to see if we can do any pruning
|
|
129152
|
+
result = AddConstantComparison(constant_values.find(equivalence_set)->second, info);
|
|
129124
129153
|
} else {
|
|
129125
|
-
|
|
129154
|
+
D_ASSERT(lower_is_scalar);
|
|
129155
|
+
const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
|
|
129156
|
+
: ExpressionType::COMPARE_LESSTHAN;
|
|
129157
|
+
auto left = comparison.input->Copy();
|
|
129158
|
+
auto right = comparison.upper->Copy();
|
|
129159
|
+
auto upper_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
|
|
129160
|
+
result = AddBoundComparisonFilter(upper_comp.get());
|
|
129126
129161
|
}
|
|
129127
|
-
info.constant = constant_value;
|
|
129128
129162
|
|
|
129129
|
-
|
|
129130
|
-
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129131
|
-
// check the existing constant comparisons to see if we can do any pruning
|
|
129132
|
-
return AddConstantComparison(constant_values.find(equivalence_set)->second, info);
|
|
129163
|
+
return result;
|
|
129133
129164
|
}
|
|
129134
129165
|
} else if (expr->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON) {
|
|
129135
129166
|
return AddBoundComparisonFilter(expr);
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.3.5-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "0a96249d0"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev346"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|