duckdb 0.3.5-dev329.0 → 0.3.5-dev349.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 +161 -78
- package/src/duckdb.hpp +4 -4
- package/src/parquet-amalgamation.cpp +36961 -36961
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -77813,6 +77813,9 @@ void AvgFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
77813
77813
|
LogicalType::DOUBLE, LogicalType::DOUBLE, true));
|
|
77814
77814
|
set.AddFunction(avg);
|
|
77815
77815
|
|
|
77816
|
+
avg.name = "mean";
|
|
77817
|
+
set.AddFunction(avg);
|
|
77818
|
+
|
|
77816
77819
|
AggregateFunctionSet favg("favg");
|
|
77817
77820
|
favg.AddFunction(AggregateFunction::UnaryAggregate<KahanAvgState, double, double, KahanAverageOperation>(
|
|
77818
77821
|
LogicalType::DOUBLE, LogicalType::DOUBLE, true));
|
|
@@ -83673,7 +83676,7 @@ struct HistogramFun {
|
|
|
83673
83676
|
|
|
83674
83677
|
namespace duckdb {
|
|
83675
83678
|
|
|
83676
|
-
struct
|
|
83679
|
+
struct HistogramFunctor {
|
|
83677
83680
|
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
83678
83681
|
static void HistogramUpdate(VectorData &sdata, VectorData &input_data, idx_t count) {
|
|
83679
83682
|
|
|
@@ -83689,9 +83692,14 @@ struct HistogramUpdateFunctor {
|
|
|
83689
83692
|
}
|
|
83690
83693
|
}
|
|
83691
83694
|
}
|
|
83695
|
+
|
|
83696
|
+
template <class T>
|
|
83697
|
+
static Value HistogramFinalize(T first) {
|
|
83698
|
+
return Value::CreateValue(first);
|
|
83699
|
+
}
|
|
83692
83700
|
};
|
|
83693
83701
|
|
|
83694
|
-
struct
|
|
83702
|
+
struct HistogramStringFunctor {
|
|
83695
83703
|
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
83696
83704
|
static void HistogramUpdate(VectorData &sdata, VectorData &input_data, idx_t count) {
|
|
83697
83705
|
|
|
@@ -83707,6 +83715,12 @@ struct HistogramStringUpdateFunctor {
|
|
|
83707
83715
|
}
|
|
83708
83716
|
}
|
|
83709
83717
|
}
|
|
83718
|
+
|
|
83719
|
+
template <class T>
|
|
83720
|
+
static Value HistogramFinalize(T first) {
|
|
83721
|
+
string_t value = first;
|
|
83722
|
+
return Value::CreateValue(value);
|
|
83723
|
+
}
|
|
83710
83724
|
};
|
|
83711
83725
|
|
|
83712
83726
|
struct HistogramFunction {
|
|
@@ -83767,8 +83781,8 @@ static void HistogramCombineFunction(Vector &state, Vector &combined, FunctionDa
|
|
|
83767
83781
|
}
|
|
83768
83782
|
}
|
|
83769
83783
|
|
|
83770
|
-
template <class T, class MAP_TYPE>
|
|
83771
|
-
static void
|
|
83784
|
+
template <class OP, class T, class MAP_TYPE>
|
|
83785
|
+
static void HistogramFinalizeFunction(Vector &state_vector, FunctionData *, Vector &result, idx_t count, idx_t offset) {
|
|
83772
83786
|
|
|
83773
83787
|
VectorData sdata;
|
|
83774
83788
|
state_vector.Orrify(count, sdata);
|
|
@@ -83784,7 +83798,9 @@ static void HistogramFinalize(Vector &state_vector, FunctionData *, Vector &resu
|
|
|
83784
83798
|
|
|
83785
83799
|
auto &bucket_validity = FlatVector::Validity(*bucket_list);
|
|
83786
83800
|
auto &count_validity = FlatVector::Validity(*count_list);
|
|
83801
|
+
|
|
83787
83802
|
for (idx_t i = 0; i < count; i++) {
|
|
83803
|
+
|
|
83788
83804
|
const auto rid = i + offset;
|
|
83789
83805
|
auto state = states[sdata.sel->get_index(i)];
|
|
83790
83806
|
if (!state->hist) {
|
|
@@ -83793,12 +83809,14 @@ static void HistogramFinalize(Vector &state_vector, FunctionData *, Vector &resu
|
|
|
83793
83809
|
count_validity.SetInvalid(rid);
|
|
83794
83810
|
continue;
|
|
83795
83811
|
}
|
|
83812
|
+
|
|
83796
83813
|
for (auto &entry : *state->hist) {
|
|
83797
|
-
|
|
83814
|
+
Value bucket_value = OP::template HistogramFinalize<T>(entry.first);
|
|
83798
83815
|
ListVector::PushBack(*bucket_list, bucket_value);
|
|
83799
83816
|
auto count_value = Value::CreateValue(entry.second);
|
|
83800
83817
|
ListVector::PushBack(*count_list, count_value);
|
|
83801
83818
|
}
|
|
83819
|
+
|
|
83802
83820
|
auto list_struct_data = FlatVector::GetData<list_entry_t>(*bucket_list);
|
|
83803
83821
|
list_struct_data[rid].length = ListVector::GetListSize(*bucket_list) - old_len;
|
|
83804
83822
|
list_struct_data[rid].offset = old_len;
|
|
@@ -83831,7 +83849,7 @@ static AggregateFunction GetHistogramFunction(const LogicalType &type) {
|
|
|
83831
83849
|
return AggregateFunction("histogram", {type}, LogicalTypeId::MAP, AggregateFunction::StateSize<STATE_TYPE>,
|
|
83832
83850
|
AggregateFunction::StateInitialize<STATE_TYPE, HistogramFunction>,
|
|
83833
83851
|
HistogramUpdateFunction<OP, T, MAP_TYPE>, HistogramCombineFunction<T, MAP_TYPE>,
|
|
83834
|
-
|
|
83852
|
+
HistogramFinalizeFunction<OP, T, MAP_TYPE>, nullptr, HistogramBindFunction,
|
|
83835
83853
|
AggregateFunction::StateDestroy<STATE_TYPE, HistogramFunction>);
|
|
83836
83854
|
}
|
|
83837
83855
|
|
|
@@ -83849,45 +83867,45 @@ AggregateFunction GetHistogramFunction(const LogicalType &type) {
|
|
|
83849
83867
|
|
|
83850
83868
|
switch (type.id()) {
|
|
83851
83869
|
case LogicalType::BOOLEAN:
|
|
83852
|
-
return GetMapType<
|
|
83870
|
+
return GetMapType<HistogramFunctor, bool, IS_ORDERED>(type);
|
|
83853
83871
|
case LogicalType::UTINYINT:
|
|
83854
|
-
return GetMapType<
|
|
83872
|
+
return GetMapType<HistogramFunctor, uint8_t, IS_ORDERED>(type);
|
|
83855
83873
|
case LogicalType::USMALLINT:
|
|
83856
|
-
return GetMapType<
|
|
83874
|
+
return GetMapType<HistogramFunctor, uint16_t, IS_ORDERED>(type);
|
|
83857
83875
|
case LogicalType::UINTEGER:
|
|
83858
|
-
return GetMapType<
|
|
83876
|
+
return GetMapType<HistogramFunctor, uint32_t, IS_ORDERED>(type);
|
|
83859
83877
|
case LogicalType::UBIGINT:
|
|
83860
|
-
return GetMapType<
|
|
83878
|
+
return GetMapType<HistogramFunctor, uint64_t, IS_ORDERED>(type);
|
|
83861
83879
|
case LogicalType::TINYINT:
|
|
83862
|
-
return GetMapType<
|
|
83880
|
+
return GetMapType<HistogramFunctor, int8_t, IS_ORDERED>(type);
|
|
83863
83881
|
case LogicalType::SMALLINT:
|
|
83864
|
-
return GetMapType<
|
|
83882
|
+
return GetMapType<HistogramFunctor, int16_t, IS_ORDERED>(type);
|
|
83865
83883
|
case LogicalType::INTEGER:
|
|
83866
|
-
return GetMapType<
|
|
83884
|
+
return GetMapType<HistogramFunctor, int32_t, IS_ORDERED>(type);
|
|
83867
83885
|
case LogicalType::BIGINT:
|
|
83868
|
-
return GetMapType<
|
|
83886
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83869
83887
|
case LogicalType::FLOAT:
|
|
83870
|
-
return GetMapType<
|
|
83888
|
+
return GetMapType<HistogramFunctor, float, IS_ORDERED>(type);
|
|
83871
83889
|
case LogicalType::DOUBLE:
|
|
83872
|
-
return GetMapType<
|
|
83890
|
+
return GetMapType<HistogramFunctor, double, IS_ORDERED>(type);
|
|
83873
83891
|
case LogicalType::VARCHAR:
|
|
83874
|
-
return GetMapType<
|
|
83892
|
+
return GetMapType<HistogramStringFunctor, string, IS_ORDERED>(type);
|
|
83875
83893
|
case LogicalType::TIMESTAMP:
|
|
83876
|
-
return GetMapType<
|
|
83894
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83877
83895
|
case LogicalType::TIMESTAMP_TZ:
|
|
83878
|
-
return GetMapType<
|
|
83896
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83879
83897
|
case LogicalType::TIMESTAMP_S:
|
|
83880
|
-
return GetMapType<
|
|
83898
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83881
83899
|
case LogicalType::TIMESTAMP_MS:
|
|
83882
|
-
return GetMapType<
|
|
83900
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83883
83901
|
case LogicalType::TIMESTAMP_NS:
|
|
83884
|
-
return GetMapType<
|
|
83902
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83885
83903
|
case LogicalType::TIME:
|
|
83886
|
-
return GetMapType<
|
|
83904
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83887
83905
|
case LogicalType::TIME_TZ:
|
|
83888
|
-
return GetMapType<
|
|
83906
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83889
83907
|
case LogicalType::DATE:
|
|
83890
|
-
return GetMapType<
|
|
83908
|
+
return GetMapType<HistogramFunctor, int32_t, IS_ORDERED>(type);
|
|
83891
83909
|
default:
|
|
83892
83910
|
throw InternalException("Unimplemented histogram aggregate");
|
|
83893
83911
|
}
|
|
@@ -92355,14 +92373,29 @@ struct StateVector {
|
|
|
92355
92373
|
Vector state_vector;
|
|
92356
92374
|
};
|
|
92357
92375
|
|
|
92376
|
+
struct FinalizeValueFunctor {
|
|
92377
|
+
template <class T>
|
|
92378
|
+
static Value FinalizeValue(T first) {
|
|
92379
|
+
return Value::CreateValue(first);
|
|
92380
|
+
}
|
|
92381
|
+
};
|
|
92382
|
+
|
|
92383
|
+
struct FinalizeStringValueFunctor {
|
|
92384
|
+
template <class T>
|
|
92385
|
+
static Value FinalizeValue(T first) {
|
|
92386
|
+
string_t value = first;
|
|
92387
|
+
return Value::CreateValue(value);
|
|
92388
|
+
}
|
|
92389
|
+
};
|
|
92390
|
+
|
|
92358
92391
|
struct AggregateFunctor {
|
|
92359
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92392
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92360
92393
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92361
92394
|
}
|
|
92362
92395
|
};
|
|
92363
92396
|
|
|
92364
92397
|
struct DistinctFunctor {
|
|
92365
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92398
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92366
92399
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92367
92400
|
|
|
92368
92401
|
VectorData sdata;
|
|
@@ -92386,7 +92419,7 @@ struct DistinctFunctor {
|
|
|
92386
92419
|
offset += state->hist->size();
|
|
92387
92420
|
|
|
92388
92421
|
for (auto &entry : *state->hist) {
|
|
92389
|
-
|
|
92422
|
+
Value bucket_value = OP::template FinalizeValue<T>(entry.first);
|
|
92390
92423
|
ListVector::PushBack(result, bucket_value);
|
|
92391
92424
|
}
|
|
92392
92425
|
}
|
|
@@ -92395,7 +92428,7 @@ struct DistinctFunctor {
|
|
|
92395
92428
|
};
|
|
92396
92429
|
|
|
92397
92430
|
struct UniqueFunctor {
|
|
92398
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92431
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92399
92432
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92400
92433
|
|
|
92401
92434
|
VectorData sdata;
|
|
@@ -92419,7 +92452,7 @@ struct UniqueFunctor {
|
|
|
92419
92452
|
}
|
|
92420
92453
|
};
|
|
92421
92454
|
|
|
92422
|
-
template <class
|
|
92455
|
+
template <class FUNCTION_FUNCTOR, bool IS_AGGR = false>
|
|
92423
92456
|
static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
92424
92457
|
|
|
92425
92458
|
auto count = args.size();
|
|
@@ -92525,61 +92558,80 @@ static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
92525
92558
|
|
|
92526
92559
|
switch (key_type.InternalType()) {
|
|
92527
92560
|
case PhysicalType::BOOL:
|
|
92528
|
-
|
|
92561
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, bool>(
|
|
92562
|
+
result, state_vector.state_vector, count);
|
|
92529
92563
|
break;
|
|
92530
92564
|
case PhysicalType::UINT8:
|
|
92531
|
-
|
|
92565
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint8_t>(
|
|
92566
|
+
result, state_vector.state_vector, count);
|
|
92532
92567
|
break;
|
|
92533
92568
|
case PhysicalType::UINT16:
|
|
92534
|
-
|
|
92569
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint16_t>(
|
|
92570
|
+
result, state_vector.state_vector, count);
|
|
92535
92571
|
break;
|
|
92536
92572
|
case PhysicalType::UINT32:
|
|
92537
|
-
|
|
92573
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint32_t>(
|
|
92574
|
+
result, state_vector.state_vector, count);
|
|
92538
92575
|
break;
|
|
92539
92576
|
case PhysicalType::UINT64:
|
|
92540
|
-
|
|
92577
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint64_t>(
|
|
92578
|
+
result, state_vector.state_vector, count);
|
|
92541
92579
|
break;
|
|
92542
92580
|
case PhysicalType::INT8:
|
|
92543
|
-
|
|
92581
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int8_t>(
|
|
92582
|
+
result, state_vector.state_vector, count);
|
|
92544
92583
|
break;
|
|
92545
92584
|
case PhysicalType::INT16:
|
|
92546
|
-
|
|
92585
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int16_t>(
|
|
92586
|
+
result, state_vector.state_vector, count);
|
|
92547
92587
|
break;
|
|
92548
92588
|
case PhysicalType::INT32:
|
|
92549
|
-
|
|
92589
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92590
|
+
result, state_vector.state_vector, count);
|
|
92550
92591
|
break;
|
|
92551
92592
|
case PhysicalType::INT64:
|
|
92552
|
-
|
|
92593
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92594
|
+
result, state_vector.state_vector, count);
|
|
92553
92595
|
break;
|
|
92554
92596
|
case PhysicalType::FLOAT:
|
|
92555
|
-
|
|
92597
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, float>(
|
|
92598
|
+
result, state_vector.state_vector, count);
|
|
92556
92599
|
break;
|
|
92557
92600
|
case PhysicalType::DOUBLE:
|
|
92558
|
-
|
|
92601
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, double>(
|
|
92602
|
+
result, state_vector.state_vector, count);
|
|
92559
92603
|
break;
|
|
92560
92604
|
case PhysicalType::DATE32:
|
|
92561
|
-
|
|
92605
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92606
|
+
result, state_vector.state_vector, count);
|
|
92562
92607
|
break;
|
|
92563
92608
|
case PhysicalType::DATE64:
|
|
92564
|
-
|
|
92609
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92610
|
+
result, state_vector.state_vector, count);
|
|
92565
92611
|
break;
|
|
92566
92612
|
case PhysicalType::TIMESTAMP:
|
|
92567
|
-
|
|
92613
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92614
|
+
result, state_vector.state_vector, count);
|
|
92568
92615
|
break;
|
|
92569
92616
|
case PhysicalType::TIME32:
|
|
92570
|
-
|
|
92617
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92618
|
+
result, state_vector.state_vector, count);
|
|
92571
92619
|
break;
|
|
92572
92620
|
case PhysicalType::TIME64:
|
|
92573
|
-
|
|
92621
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92622
|
+
result, state_vector.state_vector, count);
|
|
92574
92623
|
break;
|
|
92575
92624
|
case PhysicalType::STRING:
|
|
92576
|
-
|
|
92625
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92626
|
+
result, state_vector.state_vector, count);
|
|
92577
92627
|
break;
|
|
92578
92628
|
case PhysicalType::LARGE_STRING:
|
|
92579
|
-
|
|
92629
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92630
|
+
result, state_vector.state_vector, count);
|
|
92580
92631
|
break;
|
|
92581
92632
|
case PhysicalType::VARCHAR:
|
|
92582
|
-
|
|
92633
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92634
|
+
result, state_vector.state_vector, count);
|
|
92583
92635
|
break;
|
|
92584
92636
|
default:
|
|
92585
92637
|
throw InternalException("Unimplemented histogram aggregate");
|
|
@@ -129089,44 +129141,75 @@ FilterResult FilterCombiner::AddFilter(Expression *expr) {
|
|
|
129089
129141
|
if (expr->GetExpressionClass() == ExpressionClass::BOUND_BETWEEN) {
|
|
129090
129142
|
auto &comparison = (BoundBetweenExpression &)*expr;
|
|
129091
129143
|
//! check if one of the sides is a scalar value
|
|
129092
|
-
bool
|
|
129093
|
-
bool
|
|
129094
|
-
if (
|
|
129095
|
-
//! comparison with scalar
|
|
129144
|
+
bool lower_is_scalar = comparison.lower->IsFoldable();
|
|
129145
|
+
bool upper_is_scalar = comparison.upper->IsFoldable();
|
|
129146
|
+
if (lower_is_scalar || upper_is_scalar) {
|
|
129147
|
+
//! comparison with scalar - break apart
|
|
129096
129148
|
auto node = GetNode(comparison.input.get());
|
|
129097
129149
|
idx_t equivalence_set = GetEquivalenceSet(node);
|
|
129098
|
-
auto
|
|
129099
|
-
|
|
129150
|
+
auto result = FilterResult::UNSATISFIABLE;
|
|
129151
|
+
|
|
129152
|
+
if (lower_is_scalar) {
|
|
129153
|
+
auto scalar = comparison.lower.get();
|
|
129154
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129155
|
+
|
|
129156
|
+
// create the ExpressionValueInformation
|
|
129157
|
+
ExpressionValueInformation info;
|
|
129158
|
+
if (comparison.lower_inclusive) {
|
|
129159
|
+
info.comparison_type = ExpressionType::COMPARE_GREATERTHANOREQUALTO;
|
|
129160
|
+
} else {
|
|
129161
|
+
info.comparison_type = ExpressionType::COMPARE_GREATERTHAN;
|
|
129162
|
+
}
|
|
129163
|
+
info.constant = constant_value;
|
|
129100
129164
|
|
|
129101
|
-
|
|
129102
|
-
|
|
129103
|
-
|
|
129104
|
-
|
|
129165
|
+
// get the current bucket of constant values
|
|
129166
|
+
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129167
|
+
auto &info_list = constant_values.find(equivalence_set)->second;
|
|
129168
|
+
// check the existing constant comparisons to see if we can do any pruning
|
|
129169
|
+
result = AddConstantComparison(info_list, info);
|
|
129105
129170
|
} else {
|
|
129106
|
-
|
|
129171
|
+
D_ASSERT(upper_is_scalar);
|
|
129172
|
+
const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
|
|
129173
|
+
: ExpressionType::COMPARE_LESSTHAN;
|
|
129174
|
+
auto left = comparison.lower->Copy();
|
|
129175
|
+
auto right = comparison.input->Copy();
|
|
129176
|
+
auto lower_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
|
|
129177
|
+
result = AddBoundComparisonFilter(lower_comp.get());
|
|
129178
|
+
}
|
|
129179
|
+
|
|
129180
|
+
// Stop if we failed
|
|
129181
|
+
if (result != FilterResult::SUCCESS) {
|
|
129182
|
+
return result;
|
|
129107
129183
|
}
|
|
129108
|
-
info.constant = constant_value;
|
|
129109
129184
|
|
|
129110
|
-
|
|
129111
|
-
|
|
129112
|
-
|
|
129113
|
-
// check the existing constant comparisons to see if we can do any pruning
|
|
129114
|
-
AddConstantComparison(info_list, info);
|
|
129115
|
-
scalar = comparison.upper.get();
|
|
129116
|
-
constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129185
|
+
if (upper_is_scalar) {
|
|
129186
|
+
auto scalar = comparison.upper.get();
|
|
129187
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(*scalar);
|
|
129117
129188
|
|
|
129118
|
-
|
|
129119
|
-
|
|
129120
|
-
|
|
129189
|
+
// create the ExpressionValueInformation
|
|
129190
|
+
ExpressionValueInformation info;
|
|
129191
|
+
if (comparison.upper_inclusive) {
|
|
129192
|
+
info.comparison_type = ExpressionType::COMPARE_LESSTHANOREQUALTO;
|
|
129193
|
+
} else {
|
|
129194
|
+
info.comparison_type = ExpressionType::COMPARE_LESSTHAN;
|
|
129195
|
+
}
|
|
129196
|
+
info.constant = constant_value;
|
|
129197
|
+
|
|
129198
|
+
// get the current bucket of constant values
|
|
129199
|
+
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129200
|
+
// check the existing constant comparisons to see if we can do any pruning
|
|
129201
|
+
result = AddConstantComparison(constant_values.find(equivalence_set)->second, info);
|
|
129121
129202
|
} else {
|
|
129122
|
-
|
|
129203
|
+
D_ASSERT(lower_is_scalar);
|
|
129204
|
+
const auto type = comparison.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO
|
|
129205
|
+
: ExpressionType::COMPARE_LESSTHAN;
|
|
129206
|
+
auto left = comparison.input->Copy();
|
|
129207
|
+
auto right = comparison.upper->Copy();
|
|
129208
|
+
auto upper_comp = make_unique<BoundComparisonExpression>(type, move(left), move(right));
|
|
129209
|
+
result = AddBoundComparisonFilter(upper_comp.get());
|
|
129123
129210
|
}
|
|
129124
|
-
info.constant = constant_value;
|
|
129125
129211
|
|
|
129126
|
-
|
|
129127
|
-
D_ASSERT(constant_values.find(equivalence_set) != constant_values.end());
|
|
129128
|
-
// check the existing constant comparisons to see if we can do any pruning
|
|
129129
|
-
return AddConstantComparison(constant_values.find(equivalence_set)->second, info);
|
|
129212
|
+
return result;
|
|
129130
129213
|
}
|
|
129131
129214
|
} else if (expr->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON) {
|
|
129132
129215
|
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 "d8a2743d8"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev349"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -22808,8 +22808,8 @@ namespace duckdb {
|
|
|
22808
22808
|
|
|
22809
22809
|
class BetweenExpression : public ParsedExpression {
|
|
22810
22810
|
public:
|
|
22811
|
-
BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
|
|
22812
|
-
|
|
22811
|
+
DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
|
|
22812
|
+
unique_ptr<ParsedExpression> upper);
|
|
22813
22813
|
|
|
22814
22814
|
unique_ptr<ParsedExpression> input;
|
|
22815
22815
|
unique_ptr<ParsedExpression> lower;
|