duckdb 0.5.1-dev2.0 → 0.5.1-dev201.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 +553 -208
- package/src/duckdb.hpp +137 -12
- package/src/parquet-amalgamation.cpp +32028 -32004
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 "cb8ebc692"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.1-dev201"
|
|
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);
|
|
@@ -3372,8 +3484,8 @@ public:
|
|
|
3372
3484
|
DUCKDB_API AllocatedData(Allocator &allocator, data_ptr_t pointer, idx_t allocated_size);
|
|
3373
3485
|
DUCKDB_API ~AllocatedData();
|
|
3374
3486
|
// disable copy constructors
|
|
3375
|
-
|
|
3376
|
-
|
|
3487
|
+
AllocatedData(const AllocatedData &other) = delete;
|
|
3488
|
+
AllocatedData &operator=(const AllocatedData &) = delete;
|
|
3377
3489
|
//! enable move constructors
|
|
3378
3490
|
DUCKDB_API AllocatedData(AllocatedData &&other) noexcept;
|
|
3379
3491
|
DUCKDB_API AllocatedData &operator=(AllocatedData &&) noexcept;
|
|
@@ -9819,10 +9931,13 @@ public:
|
|
|
9819
9931
|
//! Returns a reference to the column of the specified name. Throws an
|
|
9820
9932
|
//! exception if the column does not exist.
|
|
9821
9933
|
ColumnDefinition &GetColumn(const string &name);
|
|
9822
|
-
//! Returns a list of types of the table
|
|
9934
|
+
//! Returns a list of types of the table, excluding generated columns
|
|
9823
9935
|
vector<LogicalType> GetTypes();
|
|
9824
9936
|
string ToSQL() override;
|
|
9825
9937
|
|
|
9938
|
+
//! Get statistics of a column (physical or virtual) within the table
|
|
9939
|
+
unique_ptr<BaseStatistics> GetStatistics(ClientContext &context, column_t column_id);
|
|
9940
|
+
|
|
9826
9941
|
//! Serialize the meta information of the TableCatalogEntry a serializer
|
|
9827
9942
|
virtual void Serialize(Serializer &serializer);
|
|
9828
9943
|
//! Deserializes to a CreateTableInfo
|
|
@@ -12919,6 +13034,8 @@ private:
|
|
|
12919
13034
|
atomic<idx_t> completed_pipelines;
|
|
12920
13035
|
//! The total amount of pipelines in the query
|
|
12921
13036
|
idx_t total_pipelines;
|
|
13037
|
+
//! Whether or not execution is cancelled
|
|
13038
|
+
bool cancelled;
|
|
12922
13039
|
|
|
12923
13040
|
//! The adjacent union pipelines of each pipeline
|
|
12924
13041
|
//! Union pipelines have the same sink, but can be run concurrently along with this pipeline
|
|
@@ -22639,6 +22756,11 @@ public:
|
|
|
22639
22756
|
void CommitAppend(transaction_t commit_id, idx_t start, idx_t end) override;
|
|
22640
22757
|
|
|
22641
22758
|
void Append(idx_t start, idx_t end, transaction_t commit_id);
|
|
22759
|
+
//! Performs a delete in the ChunkVectorInfo - returns how many tuples were actually deleted
|
|
22760
|
+
//! The number of rows that were actually deleted might be lower than the input count
|
|
22761
|
+
//! In case we delete rows that were already deleted
|
|
22762
|
+
//! Note that "rows" is written to to reflect the row ids that were actually deleted
|
|
22763
|
+
//! i.e. after calling this function, rows will hold [0..actual_delete_count] row ids of the actually deleted tuples
|
|
22642
22764
|
idx_t Delete(Transaction &transaction, row_t rows[], idx_t count);
|
|
22643
22765
|
void CommitDelete(transaction_t commit_id, row_t rows[], idx_t count);
|
|
22644
22766
|
|
|
@@ -24185,7 +24307,7 @@ public:
|
|
|
24185
24307
|
DataTable(ClientContext &context, DataTable &parent, idx_t changed_idx, const LogicalType &target_type,
|
|
24186
24308
|
vector<column_t> bound_columns, Expression &cast_expr);
|
|
24187
24309
|
//! Constructs a DataTable as a delta on an existing data table but with one column added new constraint
|
|
24188
|
-
DataTable(ClientContext &context, DataTable &parent, unique_ptr<
|
|
24310
|
+
DataTable(ClientContext &context, DataTable &parent, unique_ptr<BoundConstraint> constraint);
|
|
24189
24311
|
|
|
24190
24312
|
shared_ptr<DataTableInfo> info;
|
|
24191
24313
|
|
|
@@ -24270,7 +24392,9 @@ public:
|
|
|
24270
24392
|
this->is_root = true;
|
|
24271
24393
|
}
|
|
24272
24394
|
|
|
24395
|
+
//! Get statistics of a physical column within the table
|
|
24273
24396
|
unique_ptr<BaseStatistics> GetStatistics(ClientContext &context, column_t column_id);
|
|
24397
|
+
//! Sets statistics of a physical column within the table
|
|
24274
24398
|
void SetStatistics(column_t column_id, const std::function<void(BaseStatistics &)> &set_fun);
|
|
24275
24399
|
|
|
24276
24400
|
//! Checkpoint the table to the specified table data writer
|
|
@@ -24288,7 +24412,7 @@ public:
|
|
|
24288
24412
|
|
|
24289
24413
|
private:
|
|
24290
24414
|
//! Verify the new added constraints against current persistent&local data
|
|
24291
|
-
void VerifyNewConstraint(ClientContext &context, DataTable &parent, const
|
|
24415
|
+
void VerifyNewConstraint(ClientContext &context, DataTable &parent, const BoundConstraint *constraint);
|
|
24292
24416
|
//! Verify constraints with a chunk from the Append containing all columns of the table
|
|
24293
24417
|
void VerifyAppendConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk);
|
|
24294
24418
|
//! Verify constraints with a chunk from the Update containing only the specified column_ids
|
|
@@ -27089,8 +27213,8 @@ public:
|
|
|
27089
27213
|
return function_name + "(" + entry.children[0]->ToString() + ")";
|
|
27090
27214
|
}
|
|
27091
27215
|
} else if (entry.children.size() == 2) {
|
|
27092
|
-
return "(
|
|
27093
|
-
|
|
27216
|
+
return StringUtil::Format("(%s) %s (%s)", entry.children[0]->ToString(), function_name,
|
|
27217
|
+
entry.children[1]->ToString());
|
|
27094
27218
|
}
|
|
27095
27219
|
}
|
|
27096
27220
|
// standard function call
|
|
@@ -27469,7 +27593,8 @@ public:
|
|
|
27469
27593
|
public:
|
|
27470
27594
|
template <class T, class BASE>
|
|
27471
27595
|
static string ToString(const T &entry) {
|
|
27472
|
-
return entry.left->ToString()
|
|
27596
|
+
return StringUtil::Format("(%s) %s (%s)", entry.left->ToString(), ExpressionTypeToOperator(entry.type),
|
|
27597
|
+
entry.right->ToString());
|
|
27473
27598
|
}
|
|
27474
27599
|
};
|
|
27475
27600
|
} // namespace duckdb
|