duckdb 0.4.1-dev1110.0 → 0.4.1-dev1131.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 +164 -85
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +37337 -37337
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -46020,7 +46020,8 @@ Value Vector::GetValue(const Vector &v_p, idx_t index_p) {
|
|
|
46020
46020
|
case PhysicalType::INT128:
|
|
46021
46021
|
return Value::DECIMAL(((hugeint_t *)data)[index], width, scale);
|
|
46022
46022
|
default:
|
|
46023
|
-
throw InternalException("
|
|
46023
|
+
throw InternalException("Physical type '%s' has a width bigger than 38, which is not supported",
|
|
46024
|
+
TypeIdToString(type.InternalType()));
|
|
46024
46025
|
}
|
|
46025
46026
|
}
|
|
46026
46027
|
case LogicalTypeId::ENUM: {
|
|
@@ -47336,6 +47337,28 @@ const sel_t ConstantVector::ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0};
|
|
|
47336
47337
|
|
|
47337
47338
|
|
|
47338
47339
|
|
|
47340
|
+
//===----------------------------------------------------------------------===//
|
|
47341
|
+
// DuckDB
|
|
47342
|
+
//
|
|
47343
|
+
// duckdb/function/cast_rules.hpp
|
|
47344
|
+
//
|
|
47345
|
+
//
|
|
47346
|
+
//===----------------------------------------------------------------------===//
|
|
47347
|
+
|
|
47348
|
+
|
|
47349
|
+
|
|
47350
|
+
|
|
47351
|
+
|
|
47352
|
+
namespace duckdb {
|
|
47353
|
+
//! Contains a list of rules for casting
|
|
47354
|
+
class CastRules {
|
|
47355
|
+
public:
|
|
47356
|
+
//! Returns the cost of performing an implicit cost from "from" to "to", or -1 if an implicit cast is not possible
|
|
47357
|
+
static int64_t ImplicitCast(const LogicalType &from, const LogicalType &to);
|
|
47358
|
+
};
|
|
47359
|
+
|
|
47360
|
+
} // namespace duckdb
|
|
47361
|
+
|
|
47339
47362
|
|
|
47340
47363
|
#include <cmath>
|
|
47341
47364
|
|
|
@@ -47414,7 +47437,8 @@ PhysicalType LogicalType::GetInternalType() {
|
|
|
47414
47437
|
} else if (width <= Decimal::MAX_WIDTH_INT128) {
|
|
47415
47438
|
return PhysicalType::INT128;
|
|
47416
47439
|
} else {
|
|
47417
|
-
throw InternalException("
|
|
47440
|
+
throw InternalException("Decimal has a width of %d which is bigger than the maximum supported width of %d",
|
|
47441
|
+
width, DecimalType::MaxWidth());
|
|
47418
47442
|
}
|
|
47419
47443
|
}
|
|
47420
47444
|
case LogicalTypeId::VARCHAR:
|
|
@@ -47952,8 +47976,84 @@ bool LogicalType::GetDecimalProperties(uint8_t &width, uint8_t &scale) const {
|
|
|
47952
47976
|
return true;
|
|
47953
47977
|
}
|
|
47954
47978
|
|
|
47979
|
+
//! Grows Decimal width/scale when appropriate
|
|
47980
|
+
static LogicalType DecimalSizeCheck(const LogicalType &left, const LogicalType &right) {
|
|
47981
|
+
D_ASSERT(left.id() == LogicalTypeId::DECIMAL || right.id() == LogicalTypeId::DECIMAL);
|
|
47982
|
+
D_ASSERT(left.id() != right.id());
|
|
47983
|
+
|
|
47984
|
+
//! Make sure the 'right' is the DECIMAL type
|
|
47985
|
+
if (left.id() == LogicalTypeId::DECIMAL) {
|
|
47986
|
+
return DecimalSizeCheck(right, left);
|
|
47987
|
+
}
|
|
47988
|
+
auto width = DecimalType::GetWidth(right);
|
|
47989
|
+
auto scale = DecimalType::GetScale(right);
|
|
47990
|
+
|
|
47991
|
+
uint8_t other_width;
|
|
47992
|
+
uint8_t other_scale;
|
|
47993
|
+
bool success = left.GetDecimalProperties(other_width, other_scale);
|
|
47994
|
+
if (!success) {
|
|
47995
|
+
throw InternalException("Type provided to DecimalSizeCheck was not a numeric type");
|
|
47996
|
+
}
|
|
47997
|
+
D_ASSERT(other_scale == 0);
|
|
47998
|
+
const auto effective_width = width - scale;
|
|
47999
|
+
if (other_width > effective_width) {
|
|
48000
|
+
auto new_width = other_width + scale;
|
|
48001
|
+
//! Cap the width at max, if an actual value exceeds this, an exception will be thrown later
|
|
48002
|
+
if (new_width > DecimalType::MaxWidth()) {
|
|
48003
|
+
new_width = DecimalType::MaxWidth();
|
|
48004
|
+
}
|
|
48005
|
+
return LogicalType::DECIMAL(new_width, scale);
|
|
48006
|
+
}
|
|
48007
|
+
return right;
|
|
48008
|
+
}
|
|
48009
|
+
|
|
48010
|
+
static LogicalType CombineNumericTypes(const LogicalType &left, const LogicalType &right) {
|
|
48011
|
+
D_ASSERT(left.id() != right.id());
|
|
48012
|
+
if (left.id() > right.id()) {
|
|
48013
|
+
// this method is symmetric
|
|
48014
|
+
// arrange it so the left type is smaller to limit the number of options we need to check
|
|
48015
|
+
return CombineNumericTypes(right, left);
|
|
48016
|
+
}
|
|
48017
|
+
if (CastRules::ImplicitCast(left, right) >= 0) {
|
|
48018
|
+
// we can implicitly cast left to right, return right
|
|
48019
|
+
//! Depending on the type, we might need to grow the `width` of the DECIMAL type
|
|
48020
|
+
if (right.id() == LogicalTypeId::DECIMAL) {
|
|
48021
|
+
return DecimalSizeCheck(left, right);
|
|
48022
|
+
}
|
|
48023
|
+
return right;
|
|
48024
|
+
}
|
|
48025
|
+
if (CastRules::ImplicitCast(right, left) >= 0) {
|
|
48026
|
+
// we can implicitly cast right to left, return left
|
|
48027
|
+
//! Depending on the type, we might need to grow the `width` of the DECIMAL type
|
|
48028
|
+
if (left.id() == LogicalTypeId::DECIMAL) {
|
|
48029
|
+
return DecimalSizeCheck(right, left);
|
|
48030
|
+
}
|
|
48031
|
+
return left;
|
|
48032
|
+
}
|
|
48033
|
+
// we can't cast implicitly either way and types are not equal
|
|
48034
|
+
// this happens when left is signed and right is unsigned
|
|
48035
|
+
// e.g. INTEGER and UINTEGER
|
|
48036
|
+
// in this case we need to upcast to make sure the types fit
|
|
48037
|
+
|
|
48038
|
+
if (left.id() == LogicalTypeId::BIGINT || right.id() == LogicalTypeId::UBIGINT) {
|
|
48039
|
+
return LogicalType::HUGEINT;
|
|
48040
|
+
}
|
|
48041
|
+
if (left.id() == LogicalTypeId::INTEGER || right.id() == LogicalTypeId::UINTEGER) {
|
|
48042
|
+
return LogicalType::BIGINT;
|
|
48043
|
+
}
|
|
48044
|
+
if (left.id() == LogicalTypeId::SMALLINT || right.id() == LogicalTypeId::USMALLINT) {
|
|
48045
|
+
return LogicalType::INTEGER;
|
|
48046
|
+
}
|
|
48047
|
+
if (left.id() == LogicalTypeId::TINYINT || right.id() == LogicalTypeId::UTINYINT) {
|
|
48048
|
+
return LogicalType::SMALLINT;
|
|
48049
|
+
}
|
|
48050
|
+
throw InternalException("Cannot combine these numeric types!?");
|
|
48051
|
+
}
|
|
48052
|
+
|
|
47955
48053
|
LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalType &right) {
|
|
47956
|
-
if (left.id()
|
|
48054
|
+
if (left.id() != right.id() && left.IsNumeric() && right.IsNumeric()) {
|
|
48055
|
+
return CombineNumericTypes(left, right);
|
|
48056
|
+
} else if (left.id() == LogicalTypeId::UNKNOWN) {
|
|
47957
48057
|
return right;
|
|
47958
48058
|
} else if (right.id() == LogicalTypeId::UNKNOWN) {
|
|
47959
48059
|
return left;
|
|
@@ -48150,6 +48250,7 @@ TypeCatalogEntry *LogicalType::GetCatalog(const LogicalType &type) {
|
|
|
48150
48250
|
struct DecimalTypeInfo : public ExtraTypeInfo {
|
|
48151
48251
|
DecimalTypeInfo(uint8_t width_p, uint8_t scale_p)
|
|
48152
48252
|
: ExtraTypeInfo(ExtraTypeInfoType::DECIMAL_TYPE_INFO), width(width_p), scale(scale_p) {
|
|
48253
|
+
D_ASSERT(width_p >= scale_p);
|
|
48153
48254
|
}
|
|
48154
48255
|
|
|
48155
48256
|
uint8_t width;
|
|
@@ -48193,6 +48294,7 @@ uint8_t DecimalType::MaxWidth() {
|
|
|
48193
48294
|
}
|
|
48194
48295
|
|
|
48195
48296
|
LogicalType LogicalType::DECIMAL(int width, int scale) {
|
|
48297
|
+
D_ASSERT(width >= scale);
|
|
48196
48298
|
auto type_info = make_shared<DecimalTypeInfo>(width, scale);
|
|
48197
48299
|
return LogicalType(LogicalTypeId::DECIMAL, move(type_info));
|
|
48198
48300
|
}
|
|
@@ -88621,27 +88723,6 @@ unique_ptr<FunctionData> AggregateFunction::BindSortedAggregate(AggregateFunctio
|
|
|
88621
88723
|
return move(sorted_bind);
|
|
88622
88724
|
}
|
|
88623
88725
|
|
|
88624
|
-
} // namespace duckdb
|
|
88625
|
-
//===----------------------------------------------------------------------===//
|
|
88626
|
-
// DuckDB
|
|
88627
|
-
//
|
|
88628
|
-
// duckdb/function/cast_rules.hpp
|
|
88629
|
-
//
|
|
88630
|
-
//
|
|
88631
|
-
//===----------------------------------------------------------------------===//
|
|
88632
|
-
|
|
88633
|
-
|
|
88634
|
-
|
|
88635
|
-
|
|
88636
|
-
|
|
88637
|
-
namespace duckdb {
|
|
88638
|
-
//! Contains a list of rules for casting
|
|
88639
|
-
class CastRules {
|
|
88640
|
-
public:
|
|
88641
|
-
//! Returns the cost of performing an implicit cost from "from" to "to", or -1 if an implicit cast is not possible
|
|
88642
|
-
static int64_t ImplicitCast(const LogicalType &from, const LogicalType &to);
|
|
88643
|
-
};
|
|
88644
|
-
|
|
88645
88726
|
} // namespace duckdb
|
|
88646
88727
|
|
|
88647
88728
|
|
|
@@ -140137,7 +140218,7 @@ unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op,
|
|
|
140137
140218
|
!BoundCastExpression::CastIsInvertible(cast_expression->return_type, target_type)) {
|
|
140138
140219
|
return nullptr;
|
|
140139
140220
|
}
|
|
140140
|
-
auto new_constant = constant_value.TryCastAs(target_type);
|
|
140221
|
+
auto new_constant = constant_value.TryCastAs(target_type, true);
|
|
140141
140222
|
if (new_constant) {
|
|
140142
140223
|
auto child_expression = move(cast_expression->child);
|
|
140143
140224
|
auto new_constant_expr = make_unique<BoundConstantExpression>(constant_value);
|
|
@@ -143785,6 +143866,62 @@ void Event::SetTasks(vector<unique_ptr<Task>> tasks) {
|
|
|
143785
143866
|
|
|
143786
143867
|
|
|
143787
143868
|
|
|
143869
|
+
//===----------------------------------------------------------------------===//
|
|
143870
|
+
// DuckDB
|
|
143871
|
+
//
|
|
143872
|
+
// duckdb/parallel/pipeline_complete_event.hpp
|
|
143873
|
+
//
|
|
143874
|
+
//
|
|
143875
|
+
//===----------------------------------------------------------------------===//
|
|
143876
|
+
|
|
143877
|
+
|
|
143878
|
+
|
|
143879
|
+
|
|
143880
|
+
|
|
143881
|
+
namespace duckdb {
|
|
143882
|
+
class Executor;
|
|
143883
|
+
|
|
143884
|
+
class PipelineCompleteEvent : public Event {
|
|
143885
|
+
public:
|
|
143886
|
+
PipelineCompleteEvent(Executor &executor, bool complete_pipeline_p);
|
|
143887
|
+
|
|
143888
|
+
bool complete_pipeline;
|
|
143889
|
+
|
|
143890
|
+
public:
|
|
143891
|
+
void Schedule() override;
|
|
143892
|
+
void FinalizeFinish() override;
|
|
143893
|
+
};
|
|
143894
|
+
|
|
143895
|
+
} // namespace duckdb
|
|
143896
|
+
|
|
143897
|
+
//===----------------------------------------------------------------------===//
|
|
143898
|
+
// DuckDB
|
|
143899
|
+
//
|
|
143900
|
+
// duckdb/parallel/pipeline_event.hpp
|
|
143901
|
+
//
|
|
143902
|
+
//
|
|
143903
|
+
//===----------------------------------------------------------------------===//
|
|
143904
|
+
|
|
143905
|
+
|
|
143906
|
+
|
|
143907
|
+
|
|
143908
|
+
|
|
143909
|
+
|
|
143910
|
+
namespace duckdb {
|
|
143911
|
+
|
|
143912
|
+
class PipelineEvent : public Event {
|
|
143913
|
+
public:
|
|
143914
|
+
PipelineEvent(shared_ptr<Pipeline> pipeline);
|
|
143915
|
+
|
|
143916
|
+
//! The pipeline that this event belongs to
|
|
143917
|
+
shared_ptr<Pipeline> pipeline;
|
|
143918
|
+
|
|
143919
|
+
public:
|
|
143920
|
+
void Schedule() override;
|
|
143921
|
+
void FinishEvent() override;
|
|
143922
|
+
};
|
|
143923
|
+
|
|
143924
|
+
} // namespace duckdb
|
|
143788
143925
|
|
|
143789
143926
|
//===----------------------------------------------------------------------===//
|
|
143790
143927
|
// DuckDB
|
|
@@ -143894,36 +144031,6 @@ private:
|
|
|
143894
144031
|
|
|
143895
144032
|
} // namespace duckdb
|
|
143896
144033
|
|
|
143897
|
-
|
|
143898
|
-
//===----------------------------------------------------------------------===//
|
|
143899
|
-
// DuckDB
|
|
143900
|
-
//
|
|
143901
|
-
// duckdb/parallel/pipeline_event.hpp
|
|
143902
|
-
//
|
|
143903
|
-
//
|
|
143904
|
-
//===----------------------------------------------------------------------===//
|
|
143905
|
-
|
|
143906
|
-
|
|
143907
|
-
|
|
143908
|
-
|
|
143909
|
-
|
|
143910
|
-
|
|
143911
|
-
namespace duckdb {
|
|
143912
|
-
|
|
143913
|
-
class PipelineEvent : public Event {
|
|
143914
|
-
public:
|
|
143915
|
-
PipelineEvent(shared_ptr<Pipeline> pipeline);
|
|
143916
|
-
|
|
143917
|
-
//! The pipeline that this event belongs to
|
|
143918
|
-
shared_ptr<Pipeline> pipeline;
|
|
143919
|
-
|
|
143920
|
-
public:
|
|
143921
|
-
void Schedule() override;
|
|
143922
|
-
void FinishEvent() override;
|
|
143923
|
-
};
|
|
143924
|
-
|
|
143925
|
-
} // namespace duckdb
|
|
143926
|
-
|
|
143927
144034
|
//===----------------------------------------------------------------------===//
|
|
143928
144035
|
// DuckDB
|
|
143929
144036
|
//
|
|
@@ -143954,34 +144061,6 @@ public:
|
|
|
143954
144061
|
|
|
143955
144062
|
} // namespace duckdb
|
|
143956
144063
|
|
|
143957
|
-
//===----------------------------------------------------------------------===//
|
|
143958
|
-
// DuckDB
|
|
143959
|
-
//
|
|
143960
|
-
// duckdb/parallel/pipeline_complete_event.hpp
|
|
143961
|
-
//
|
|
143962
|
-
//
|
|
143963
|
-
//===----------------------------------------------------------------------===//
|
|
143964
|
-
|
|
143965
|
-
|
|
143966
|
-
|
|
143967
|
-
|
|
143968
|
-
|
|
143969
|
-
namespace duckdb {
|
|
143970
|
-
class Executor;
|
|
143971
|
-
|
|
143972
|
-
class PipelineCompleteEvent : public Event {
|
|
143973
|
-
public:
|
|
143974
|
-
PipelineCompleteEvent(Executor &executor, bool complete_pipeline_p);
|
|
143975
|
-
|
|
143976
|
-
bool complete_pipeline;
|
|
143977
|
-
|
|
143978
|
-
public:
|
|
143979
|
-
void Schedule() override;
|
|
143980
|
-
void FinalizeFinish() override;
|
|
143981
|
-
};
|
|
143982
|
-
|
|
143983
|
-
} // namespace duckdb
|
|
143984
|
-
|
|
143985
144064
|
|
|
143986
144065
|
|
|
143987
144066
|
|
|
@@ -144179,8 +144258,8 @@ void Executor::ExtractPipelines(shared_ptr<Pipeline> &pipeline, vector<shared_pt
|
|
|
144179
144258
|
}
|
|
144180
144259
|
auto child_entry = child_pipelines.find(pipeline_ptr);
|
|
144181
144260
|
if (child_entry != child_pipelines.end()) {
|
|
144182
|
-
for (auto
|
|
144183
|
-
ExtractPipelines(entry, result);
|
|
144261
|
+
for (auto entry = child_entry->second.rbegin(); entry != child_entry->second.rend(); ++entry) {
|
|
144262
|
+
ExtractPipelines(*entry, result);
|
|
144184
144263
|
}
|
|
144185
144264
|
child_pipelines.erase(pipeline_ptr);
|
|
144186
144265
|
}
|
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.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "67f1ed1a2"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev1131"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|