duckdb 0.5.1-dev72.0 → 0.5.1-dev88.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 +90 -33
- package/src/duckdb.hpp +116 -4
- package/src/parquet-amalgamation.cpp +33529 -33529
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -47701,11 +47701,36 @@ Value Value::CreateValue(dtime_t value) {
|
|
|
47701
47701
|
return Value::TIME(value);
|
|
47702
47702
|
}
|
|
47703
47703
|
|
|
47704
|
+
template <>
|
|
47705
|
+
Value Value::CreateValue(dtime_tz_t value) {
|
|
47706
|
+
return Value::TIMETZ(value);
|
|
47707
|
+
}
|
|
47708
|
+
|
|
47704
47709
|
template <>
|
|
47705
47710
|
Value Value::CreateValue(timestamp_t value) {
|
|
47706
47711
|
return Value::TIMESTAMP(value);
|
|
47707
47712
|
}
|
|
47708
47713
|
|
|
47714
|
+
template <>
|
|
47715
|
+
Value Value::CreateValue(timestamp_sec_t value) {
|
|
47716
|
+
return Value::TIMESTAMPSEC(value);
|
|
47717
|
+
}
|
|
47718
|
+
|
|
47719
|
+
template <>
|
|
47720
|
+
Value Value::CreateValue(timestamp_ms_t value) {
|
|
47721
|
+
return Value::TIMESTAMPMS(value);
|
|
47722
|
+
}
|
|
47723
|
+
|
|
47724
|
+
template <>
|
|
47725
|
+
Value Value::CreateValue(timestamp_ns_t value) {
|
|
47726
|
+
return Value::TIMESTAMPNS(value);
|
|
47727
|
+
}
|
|
47728
|
+
|
|
47729
|
+
template <>
|
|
47730
|
+
Value Value::CreateValue(timestamp_tz_t value) {
|
|
47731
|
+
return Value::TIMESTAMPTZ(value);
|
|
47732
|
+
}
|
|
47733
|
+
|
|
47709
47734
|
template <>
|
|
47710
47735
|
Value Value::CreateValue(const char *value) {
|
|
47711
47736
|
return Value(string(value));
|
|
@@ -49278,19 +49303,6 @@ void Vector::Resize(idx_t cur_size, idx_t new_size) {
|
|
|
49278
49303
|
}
|
|
49279
49304
|
}
|
|
49280
49305
|
|
|
49281
|
-
// FIXME Just like DECIMAL, it's important that type_info gets considered when determining whether or not to cast
|
|
49282
|
-
// just comparing internal type is not always enough
|
|
49283
|
-
static bool ValueShouldBeCast(const LogicalType &incoming, const LogicalType &target) {
|
|
49284
|
-
if (incoming.InternalType() != target.InternalType()) {
|
|
49285
|
-
return true;
|
|
49286
|
-
}
|
|
49287
|
-
if (incoming.id() == LogicalTypeId::DECIMAL && incoming.id() == target.id()) {
|
|
49288
|
-
//! Compare the type_info
|
|
49289
|
-
return incoming != target;
|
|
49290
|
-
}
|
|
49291
|
-
return false;
|
|
49292
|
-
}
|
|
49293
|
-
|
|
49294
49306
|
void Vector::SetValue(idx_t index, const Value &val) {
|
|
49295
49307
|
if (GetVectorType() == VectorType::DICTIONARY_VECTOR) {
|
|
49296
49308
|
// dictionary: apply dictionary and forward to child
|
|
@@ -49298,10 +49310,11 @@ void Vector::SetValue(idx_t index, const Value &val) {
|
|
|
49298
49310
|
auto &child = DictionaryVector::Child(*this);
|
|
49299
49311
|
return child.SetValue(sel_vector.get_index(index), val);
|
|
49300
49312
|
}
|
|
49301
|
-
if (
|
|
49313
|
+
if (val.type() != GetType()) {
|
|
49302
49314
|
SetValue(index, val.CastAs(GetType()));
|
|
49303
49315
|
return;
|
|
49304
49316
|
}
|
|
49317
|
+
D_ASSERT(val.type().InternalType() == GetType().InternalType());
|
|
49305
49318
|
|
|
49306
49319
|
validity.EnsureWritable();
|
|
49307
49320
|
validity.Set(index, !val.IsNull());
|
|
@@ -49552,7 +49565,10 @@ Value Vector::GetValue(const Vector &v_p, idx_t index_p) {
|
|
|
49552
49565
|
auto value = GetValueInternal(v_p, index_p);
|
|
49553
49566
|
// set the alias of the type to the correct value, if there is a type alias
|
|
49554
49567
|
if (v_p.GetType().HasAlias()) {
|
|
49555
|
-
value.type().
|
|
49568
|
+
value.type().CopyAuxInfo(v_p.GetType());
|
|
49569
|
+
}
|
|
49570
|
+
if (v_p.GetType().id() != LogicalTypeId::AGGREGATE_STATE && value.type().id() != LogicalTypeId::AGGREGATE_STATE) {
|
|
49571
|
+
D_ASSERT(v_p.GetType() == value.type());
|
|
49556
49572
|
}
|
|
49557
49573
|
return value;
|
|
49558
49574
|
}
|
|
@@ -51619,6 +51635,7 @@ public:
|
|
|
51619
51635
|
if (!alias.empty()) {
|
|
51620
51636
|
return false;
|
|
51621
51637
|
}
|
|
51638
|
+
//! We only need to compare aliases when both types have them in this case
|
|
51622
51639
|
return true;
|
|
51623
51640
|
}
|
|
51624
51641
|
if (alias != other_p->alias) {
|
|
@@ -51632,8 +51649,7 @@ public:
|
|
|
51632
51649
|
if (type != other_p->type) {
|
|
51633
51650
|
return false;
|
|
51634
51651
|
}
|
|
51635
|
-
|
|
51636
|
-
return alias == other.alias && EqualsInternal(other_p);
|
|
51652
|
+
return alias == other_p->alias && EqualsInternal(other_p);
|
|
51637
51653
|
}
|
|
51638
51654
|
//! Serializes a ExtraTypeInfo to a stand-alone binary blob
|
|
51639
51655
|
virtual void Serialize(FieldWriter &writer) const {};
|
|
@@ -52312,10 +52328,7 @@ LogicalType LogicalType::Deserialize(Deserializer &source) {
|
|
|
52312
52328
|
return LogicalType(id, move(info));
|
|
52313
52329
|
}
|
|
52314
52330
|
|
|
52315
|
-
bool LogicalType::
|
|
52316
|
-
if (id_ != rhs.id_) {
|
|
52317
|
-
return false;
|
|
52318
|
-
}
|
|
52331
|
+
bool LogicalType::EqualTypeInfo(const LogicalType &rhs) const {
|
|
52319
52332
|
if (type_info_.get() == rhs.type_info_.get()) {
|
|
52320
52333
|
return true;
|
|
52321
52334
|
}
|
|
@@ -52327,6 +52340,13 @@ bool LogicalType::operator==(const LogicalType &rhs) const {
|
|
|
52327
52340
|
}
|
|
52328
52341
|
}
|
|
52329
52342
|
|
|
52343
|
+
bool LogicalType::operator==(const LogicalType &rhs) const {
|
|
52344
|
+
if (id_ != rhs.id_) {
|
|
52345
|
+
return false;
|
|
52346
|
+
}
|
|
52347
|
+
return EqualTypeInfo(rhs);
|
|
52348
|
+
}
|
|
52349
|
+
|
|
52330
52350
|
} // namespace duckdb
|
|
52331
52351
|
|
|
52332
52352
|
|
|
@@ -93411,21 +93431,21 @@ AggregateFunction GetHistogramFunction(const LogicalType &type) {
|
|
|
93411
93431
|
case LogicalType::VARCHAR:
|
|
93412
93432
|
return GetMapType<HistogramStringFunctor, string, IS_ORDERED>(type);
|
|
93413
93433
|
case LogicalType::TIMESTAMP:
|
|
93414
|
-
return GetMapType<HistogramFunctor,
|
|
93434
|
+
return GetMapType<HistogramFunctor, timestamp_t, IS_ORDERED>(type);
|
|
93415
93435
|
case LogicalType::TIMESTAMP_TZ:
|
|
93416
|
-
return GetMapType<HistogramFunctor,
|
|
93436
|
+
return GetMapType<HistogramFunctor, timestamp_tz_t, IS_ORDERED>(type);
|
|
93417
93437
|
case LogicalType::TIMESTAMP_S:
|
|
93418
|
-
return GetMapType<HistogramFunctor,
|
|
93438
|
+
return GetMapType<HistogramFunctor, timestamp_sec_t, IS_ORDERED>(type);
|
|
93419
93439
|
case LogicalType::TIMESTAMP_MS:
|
|
93420
|
-
return GetMapType<HistogramFunctor,
|
|
93440
|
+
return GetMapType<HistogramFunctor, timestamp_ms_t, IS_ORDERED>(type);
|
|
93421
93441
|
case LogicalType::TIMESTAMP_NS:
|
|
93422
|
-
return GetMapType<HistogramFunctor,
|
|
93442
|
+
return GetMapType<HistogramFunctor, timestamp_ns_t, IS_ORDERED>(type);
|
|
93423
93443
|
case LogicalType::TIME:
|
|
93424
|
-
return GetMapType<HistogramFunctor,
|
|
93444
|
+
return GetMapType<HistogramFunctor, dtime_t, IS_ORDERED>(type);
|
|
93425
93445
|
case LogicalType::TIME_TZ:
|
|
93426
|
-
return GetMapType<HistogramFunctor,
|
|
93446
|
+
return GetMapType<HistogramFunctor, dtime_tz_t, IS_ORDERED>(type);
|
|
93427
93447
|
case LogicalType::DATE:
|
|
93428
|
-
return GetMapType<HistogramFunctor,
|
|
93448
|
+
return GetMapType<HistogramFunctor, date_t, IS_ORDERED>(type);
|
|
93429
93449
|
default:
|
|
93430
93450
|
throw InternalException("Unimplemented histogram aggregate");
|
|
93431
93451
|
}
|
|
@@ -103374,12 +103394,49 @@ static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
103374
103394
|
result, state_vector.state_vector, count);
|
|
103375
103395
|
break;
|
|
103376
103396
|
case PhysicalType::INT32:
|
|
103377
|
-
|
|
103378
|
-
|
|
103397
|
+
if (key_type.id() == LogicalTypeId::DATE) {
|
|
103398
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, date_t>(
|
|
103399
|
+
result, state_vector.state_vector, count);
|
|
103400
|
+
} else {
|
|
103401
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
103402
|
+
result, state_vector.state_vector, count);
|
|
103403
|
+
}
|
|
103379
103404
|
break;
|
|
103380
103405
|
case PhysicalType::INT64:
|
|
103381
|
-
|
|
103382
|
-
|
|
103406
|
+
switch (key_type.id()) {
|
|
103407
|
+
case LogicalTypeId::TIME:
|
|
103408
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, dtime_t>(
|
|
103409
|
+
result, state_vector.state_vector, count);
|
|
103410
|
+
break;
|
|
103411
|
+
case LogicalTypeId::TIME_TZ:
|
|
103412
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, dtime_tz_t>(
|
|
103413
|
+
result, state_vector.state_vector, count);
|
|
103414
|
+
break;
|
|
103415
|
+
case LogicalTypeId::TIMESTAMP:
|
|
103416
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, timestamp_t>(
|
|
103417
|
+
result, state_vector.state_vector, count);
|
|
103418
|
+
break;
|
|
103419
|
+
case LogicalTypeId::TIMESTAMP_MS:
|
|
103420
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, timestamp_ms_t>(
|
|
103421
|
+
result, state_vector.state_vector, count);
|
|
103422
|
+
break;
|
|
103423
|
+
case LogicalTypeId::TIMESTAMP_NS:
|
|
103424
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, timestamp_ns_t>(
|
|
103425
|
+
result, state_vector.state_vector, count);
|
|
103426
|
+
break;
|
|
103427
|
+
case LogicalTypeId::TIMESTAMP_SEC:
|
|
103428
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, timestamp_sec_t>(
|
|
103429
|
+
result, state_vector.state_vector, count);
|
|
103430
|
+
break;
|
|
103431
|
+
case LogicalTypeId::TIMESTAMP_TZ:
|
|
103432
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, timestamp_tz_t>(
|
|
103433
|
+
result, state_vector.state_vector, count);
|
|
103434
|
+
break;
|
|
103435
|
+
default:
|
|
103436
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
103437
|
+
result, state_vector.state_vector, count);
|
|
103438
|
+
break;
|
|
103439
|
+
}
|
|
103383
103440
|
break;
|
|
103384
103441
|
case PhysicalType::FLOAT:
|
|
103385
103442
|
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, float>(
|
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.5.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "0d13deb75"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.1-dev88"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -670,7 +670,7 @@ struct date_t { // NOLINT
|
|
|
670
670
|
|
|
671
671
|
//! Type used to represent time (microseconds)
|
|
672
672
|
struct dtime_t { // NOLINT
|
|
673
|
-
|
|
673
|
+
int64_t micros;
|
|
674
674
|
|
|
675
675
|
dtime_t() = default;
|
|
676
676
|
explicit inline dtime_t(int64_t micros_p) : micros(micros_p) {}
|
|
@@ -705,9 +705,11 @@ struct dtime_t { // NOLINT
|
|
|
705
705
|
static inline dtime_t allballs() {return dtime_t(0); } // NOLINT
|
|
706
706
|
};
|
|
707
707
|
|
|
708
|
+
struct dtime_tz_t : public dtime_t {};
|
|
709
|
+
|
|
708
710
|
//! Type used to represent timestamps (seconds,microseconds,milliseconds or nanoseconds since 1970-01-01)
|
|
709
711
|
struct timestamp_t { // NOLINT
|
|
710
|
-
|
|
712
|
+
int64_t value;
|
|
711
713
|
|
|
712
714
|
timestamp_t() = default;
|
|
713
715
|
explicit inline timestamp_t(int64_t value_p) : value(value_p) {}
|
|
@@ -738,6 +740,11 @@ struct timestamp_t { // NOLINT
|
|
|
738
740
|
static inline timestamp_t epoch() {return timestamp_t(0); } // NOLINT
|
|
739
741
|
};
|
|
740
742
|
|
|
743
|
+
struct timestamp_tz_t : public timestamp_t {};
|
|
744
|
+
struct timestamp_ns_t : public timestamp_t {};
|
|
745
|
+
struct timestamp_ms_t : public timestamp_t {};
|
|
746
|
+
struct timestamp_sec_t : public timestamp_t {};
|
|
747
|
+
|
|
741
748
|
struct interval_t {
|
|
742
749
|
int32_t months;
|
|
743
750
|
int32_t days;
|
|
@@ -1021,6 +1028,10 @@ struct LogicalType {
|
|
|
1021
1028
|
inline const ExtraTypeInfo *AuxInfo() const {
|
|
1022
1029
|
return type_info_.get();
|
|
1023
1030
|
}
|
|
1031
|
+
inline void CopyAuxInfo(const LogicalType& other) {
|
|
1032
|
+
type_info_ = other.type_info_;
|
|
1033
|
+
}
|
|
1034
|
+
bool EqualTypeInfo(const LogicalType& rhs) const;
|
|
1024
1035
|
|
|
1025
1036
|
// copy assignment
|
|
1026
1037
|
inline LogicalType& operator=(const LogicalType &other) {
|
|
@@ -1047,6 +1058,16 @@ struct LogicalType {
|
|
|
1047
1058
|
//! Deserializes a blob back into an LogicalType
|
|
1048
1059
|
DUCKDB_API static LogicalType Deserialize(Deserializer &source);
|
|
1049
1060
|
|
|
1061
|
+
DUCKDB_API static bool TypeIsTimestamp(LogicalTypeId id) {
|
|
1062
|
+
return (id == LogicalTypeId::TIMESTAMP ||
|
|
1063
|
+
id == LogicalTypeId::TIMESTAMP_MS ||
|
|
1064
|
+
id == LogicalTypeId::TIMESTAMP_NS ||
|
|
1065
|
+
id == LogicalTypeId::TIMESTAMP_SEC ||
|
|
1066
|
+
id == LogicalTypeId::TIMESTAMP_TZ);
|
|
1067
|
+
}
|
|
1068
|
+
DUCKDB_API static bool TypeIsTimestamp(const LogicalType& type) {
|
|
1069
|
+
return TypeIsTimestamp(type.id());
|
|
1070
|
+
}
|
|
1050
1071
|
DUCKDB_API string ToString() const;
|
|
1051
1072
|
DUCKDB_API bool IsIntegral() const;
|
|
1052
1073
|
DUCKDB_API bool IsNumeric() const;
|
|
@@ -1263,6 +1284,87 @@ struct aggregate_state_t {
|
|
|
1263
1284
|
|
|
1264
1285
|
} // namespace duckdb
|
|
1265
1286
|
|
|
1287
|
+
namespace std {
|
|
1288
|
+
|
|
1289
|
+
//! Date
|
|
1290
|
+
template <>
|
|
1291
|
+
struct hash<duckdb::date_t>
|
|
1292
|
+
{
|
|
1293
|
+
std::size_t operator()(const duckdb::date_t& k) const
|
|
1294
|
+
{
|
|
1295
|
+
using std::hash;
|
|
1296
|
+
return hash<int32_t>()((int32_t)k);
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
//! Time
|
|
1301
|
+
template <>
|
|
1302
|
+
struct hash<duckdb::dtime_t>
|
|
1303
|
+
{
|
|
1304
|
+
std::size_t operator()(const duckdb::dtime_t& k) const
|
|
1305
|
+
{
|
|
1306
|
+
using std::hash;
|
|
1307
|
+
return hash<int64_t>()((int64_t)k);
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
template <>
|
|
1311
|
+
struct hash<duckdb::dtime_tz_t>
|
|
1312
|
+
{
|
|
1313
|
+
std::size_t operator()(const duckdb::dtime_tz_t& k) const
|
|
1314
|
+
{
|
|
1315
|
+
using std::hash;
|
|
1316
|
+
return hash<int64_t>()((int64_t)k);
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
//! Timestamp
|
|
1321
|
+
template <>
|
|
1322
|
+
struct hash<duckdb::timestamp_t>
|
|
1323
|
+
{
|
|
1324
|
+
std::size_t operator()(const duckdb::timestamp_t& k) const
|
|
1325
|
+
{
|
|
1326
|
+
using std::hash;
|
|
1327
|
+
return hash<int64_t>()((int64_t)k);
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
template <>
|
|
1331
|
+
struct hash<duckdb::timestamp_ms_t>
|
|
1332
|
+
{
|
|
1333
|
+
std::size_t operator()(const duckdb::timestamp_ms_t& k) const
|
|
1334
|
+
{
|
|
1335
|
+
using std::hash;
|
|
1336
|
+
return hash<int64_t>()((int64_t)k);
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
template <>
|
|
1340
|
+
struct hash<duckdb::timestamp_ns_t>
|
|
1341
|
+
{
|
|
1342
|
+
std::size_t operator()(const duckdb::timestamp_ns_t& k) const
|
|
1343
|
+
{
|
|
1344
|
+
using std::hash;
|
|
1345
|
+
return hash<int64_t>()((int64_t)k);
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
template <>
|
|
1349
|
+
struct hash<duckdb::timestamp_sec_t>
|
|
1350
|
+
{
|
|
1351
|
+
std::size_t operator()(const duckdb::timestamp_sec_t& k) const
|
|
1352
|
+
{
|
|
1353
|
+
using std::hash;
|
|
1354
|
+
return hash<int64_t>()((int64_t)k);
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
template <>
|
|
1358
|
+
struct hash<duckdb::timestamp_tz_t>
|
|
1359
|
+
{
|
|
1360
|
+
std::size_t operator()(const duckdb::timestamp_tz_t& k) const
|
|
1361
|
+
{
|
|
1362
|
+
using std::hash;
|
|
1363
|
+
return hash<int64_t>()((int64_t)k);
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1266
1368
|
|
|
1267
1369
|
namespace duckdb {
|
|
1268
1370
|
|
|
@@ -3161,8 +3263,18 @@ Value DUCKDB_API Value::CreateValue(date_t value);
|
|
|
3161
3263
|
template <>
|
|
3162
3264
|
Value DUCKDB_API Value::CreateValue(dtime_t value);
|
|
3163
3265
|
template <>
|
|
3266
|
+
Value DUCKDB_API Value::CreateValue(dtime_tz_t value);
|
|
3267
|
+
template <>
|
|
3164
3268
|
Value DUCKDB_API Value::CreateValue(timestamp_t value);
|
|
3165
3269
|
template <>
|
|
3270
|
+
Value DUCKDB_API Value::CreateValue(timestamp_sec_t value);
|
|
3271
|
+
template <>
|
|
3272
|
+
Value DUCKDB_API Value::CreateValue(timestamp_ms_t value);
|
|
3273
|
+
template <>
|
|
3274
|
+
Value DUCKDB_API Value::CreateValue(timestamp_ns_t value);
|
|
3275
|
+
template <>
|
|
3276
|
+
Value DUCKDB_API Value::CreateValue(timestamp_tz_t value);
|
|
3277
|
+
template <>
|
|
3166
3278
|
Value DUCKDB_API Value::CreateValue(const char *value);
|
|
3167
3279
|
template <>
|
|
3168
3280
|
Value DUCKDB_API Value::CreateValue(string value);
|