duckdb 0.2.10-dev488.0 → 0.3.1-dev2.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 +200 -8
- package/src/duckdb.hpp +50 -2
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -22120,6 +22120,30 @@ template <>
|
|
|
22120
22120
|
bool TryCastToBlob::Operation(string_t input, string_t &result, Vector &result_vector, string *error_message,
|
|
22121
22121
|
bool strict);
|
|
22122
22122
|
|
|
22123
|
+
//===--------------------------------------------------------------------===//
|
|
22124
|
+
// UUID
|
|
22125
|
+
//===--------------------------------------------------------------------===//
|
|
22126
|
+
struct CastFromUUID {
|
|
22127
|
+
template <class SRC>
|
|
22128
|
+
static inline string_t Operation(SRC input, Vector &result) {
|
|
22129
|
+
throw duckdb::NotImplementedException("Cast from uuid could not be performed!");
|
|
22130
|
+
}
|
|
22131
|
+
};
|
|
22132
|
+
template <>
|
|
22133
|
+
duckdb::string_t CastFromUUID::Operation(duckdb::hugeint_t input, Vector &vector);
|
|
22134
|
+
|
|
22135
|
+
struct TryCastToUUID {
|
|
22136
|
+
template <class SRC, class DST>
|
|
22137
|
+
static inline bool Operation(SRC input, DST &result, Vector &result_vector, string *error_message,
|
|
22138
|
+
bool strict = false) {
|
|
22139
|
+
throw InternalException("Unsupported type for try cast to uuid");
|
|
22140
|
+
}
|
|
22141
|
+
};
|
|
22142
|
+
|
|
22143
|
+
template <>
|
|
22144
|
+
bool TryCastToUUID::Operation(string_t input, hugeint_t &result, Vector &result_vector, string *error_message,
|
|
22145
|
+
bool strict);
|
|
22146
|
+
|
|
22123
22147
|
} // namespace duckdb
|
|
22124
22148
|
|
|
22125
22149
|
//===----------------------------------------------------------------------===//
|
|
@@ -23454,6 +23478,7 @@ struct IntervalToStringCast {
|
|
|
23454
23478
|
|
|
23455
23479
|
|
|
23456
23480
|
|
|
23481
|
+
|
|
23457
23482
|
#include <cctype>
|
|
23458
23483
|
#include <cmath>
|
|
23459
23484
|
#include <cstdlib>
|
|
@@ -24700,6 +24725,7 @@ bool TryCastToTimestampSec::Operation(string_t input, timestamp_t &result, bool
|
|
|
24700
24725
|
result = Timestamp::GetEpochSeconds(result);
|
|
24701
24726
|
return true;
|
|
24702
24727
|
}
|
|
24728
|
+
|
|
24703
24729
|
//===--------------------------------------------------------------------===//
|
|
24704
24730
|
// Cast From Blob
|
|
24705
24731
|
//===--------------------------------------------------------------------===//
|
|
@@ -24730,6 +24756,26 @@ bool TryCastToBlob::Operation(string_t input, string_t &result, Vector &result_v
|
|
|
24730
24756
|
return true;
|
|
24731
24757
|
}
|
|
24732
24758
|
|
|
24759
|
+
//===--------------------------------------------------------------------===//
|
|
24760
|
+
// Cast From UUID
|
|
24761
|
+
//===--------------------------------------------------------------------===//
|
|
24762
|
+
template <>
|
|
24763
|
+
string_t CastFromUUID::Operation(hugeint_t input, Vector &vector) {
|
|
24764
|
+
string_t result = StringVector::EmptyString(vector, 36);
|
|
24765
|
+
UUID::ToString(input, result.GetDataWriteable());
|
|
24766
|
+
result.Finalize();
|
|
24767
|
+
return result;
|
|
24768
|
+
}
|
|
24769
|
+
|
|
24770
|
+
//===--------------------------------------------------------------------===//
|
|
24771
|
+
// Cast To UUID
|
|
24772
|
+
//===--------------------------------------------------------------------===//
|
|
24773
|
+
template <>
|
|
24774
|
+
bool TryCastToUUID::Operation(string_t input, hugeint_t &result, Vector &result_vector, string *error_message,
|
|
24775
|
+
bool strict) {
|
|
24776
|
+
return UUID::FromString(input.GetString(), result);
|
|
24777
|
+
}
|
|
24778
|
+
|
|
24733
24779
|
//===--------------------------------------------------------------------===//
|
|
24734
24780
|
// Cast To Date
|
|
24735
24781
|
//===--------------------------------------------------------------------===//
|
|
@@ -37124,6 +37170,93 @@ int64_t Timestamp::GetEpochNanoSeconds(timestamp_t timestamp) {
|
|
|
37124
37170
|
} // namespace duckdb
|
|
37125
37171
|
|
|
37126
37172
|
|
|
37173
|
+
namespace duckdb {
|
|
37174
|
+
|
|
37175
|
+
bool UUID::FromString(string str, hugeint_t &result) {
|
|
37176
|
+
auto hex2char = [](char ch) -> unsigned char {
|
|
37177
|
+
if (ch >= '0' && ch <= '9') {
|
|
37178
|
+
return ch - '0';
|
|
37179
|
+
}
|
|
37180
|
+
if (ch >= 'a' && ch <= 'f') {
|
|
37181
|
+
return 10 + ch - 'a';
|
|
37182
|
+
}
|
|
37183
|
+
if (ch >= 'A' && ch <= 'F') {
|
|
37184
|
+
return 10 + ch - 'A';
|
|
37185
|
+
}
|
|
37186
|
+
return 0;
|
|
37187
|
+
};
|
|
37188
|
+
auto is_hex = [](char ch) -> bool {
|
|
37189
|
+
return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F');
|
|
37190
|
+
};
|
|
37191
|
+
|
|
37192
|
+
if (str.empty()) {
|
|
37193
|
+
return false;
|
|
37194
|
+
}
|
|
37195
|
+
int has_braces = 0;
|
|
37196
|
+
if (str.front() == '{') {
|
|
37197
|
+
has_braces = 1;
|
|
37198
|
+
}
|
|
37199
|
+
if (has_braces && str.back() != '}') {
|
|
37200
|
+
return false;
|
|
37201
|
+
}
|
|
37202
|
+
|
|
37203
|
+
result.lower = 0;
|
|
37204
|
+
result.upper = 0;
|
|
37205
|
+
size_t count = 0;
|
|
37206
|
+
for (size_t i = has_braces; i < str.size() - has_braces; ++i) {
|
|
37207
|
+
if (str[i] == '-') {
|
|
37208
|
+
continue;
|
|
37209
|
+
}
|
|
37210
|
+
if (count >= 32 || !is_hex(str[i])) {
|
|
37211
|
+
return false;
|
|
37212
|
+
}
|
|
37213
|
+
if (count >= 16) {
|
|
37214
|
+
result.lower = (result.lower << 4) | hex2char(str[i]);
|
|
37215
|
+
} else {
|
|
37216
|
+
result.upper = (result.upper << 4) | hex2char(str[i]);
|
|
37217
|
+
}
|
|
37218
|
+
count++;
|
|
37219
|
+
}
|
|
37220
|
+
// Flip the first bit to make `order by uuid` same as `order by uuid::varchar`
|
|
37221
|
+
result.upper ^= (int64_t(1) << 63);
|
|
37222
|
+
return count == 32;
|
|
37223
|
+
}
|
|
37224
|
+
|
|
37225
|
+
void UUID::ToString(hugeint_t input, char *buf) {
|
|
37226
|
+
auto byte_to_hex = [](char byte_val, char *buf, idx_t &pos) {
|
|
37227
|
+
static char const HEX_DIGITS[] = "0123456789abcdef";
|
|
37228
|
+
buf[pos++] = HEX_DIGITS[(byte_val >> 4) & 0xf];
|
|
37229
|
+
buf[pos++] = HEX_DIGITS[byte_val & 0xf];
|
|
37230
|
+
};
|
|
37231
|
+
|
|
37232
|
+
// Flip back before convert to string
|
|
37233
|
+
int64_t upper = input.upper ^ (int64_t(1) << 63);
|
|
37234
|
+
idx_t pos = 0;
|
|
37235
|
+
byte_to_hex(upper >> 56 & 0xFF, buf, pos);
|
|
37236
|
+
byte_to_hex(upper >> 48 & 0xFF, buf, pos);
|
|
37237
|
+
byte_to_hex(upper >> 40 & 0xFF, buf, pos);
|
|
37238
|
+
byte_to_hex(upper >> 32 & 0xFF, buf, pos);
|
|
37239
|
+
buf[pos++] = '-';
|
|
37240
|
+
byte_to_hex(upper >> 24 & 0xFF, buf, pos);
|
|
37241
|
+
byte_to_hex(upper >> 16 & 0xFF, buf, pos);
|
|
37242
|
+
buf[pos++] = '-';
|
|
37243
|
+
byte_to_hex(upper >> 8 & 0xFF, buf, pos);
|
|
37244
|
+
byte_to_hex(upper & 0xFF, buf, pos);
|
|
37245
|
+
buf[pos++] = '-';
|
|
37246
|
+
byte_to_hex(input.lower >> 56 & 0xFF, buf, pos);
|
|
37247
|
+
byte_to_hex(input.lower >> 48 & 0xFF, buf, pos);
|
|
37248
|
+
buf[pos++] = '-';
|
|
37249
|
+
byte_to_hex(input.lower >> 40 & 0xFF, buf, pos);
|
|
37250
|
+
byte_to_hex(input.lower >> 32 & 0xFF, buf, pos);
|
|
37251
|
+
byte_to_hex(input.lower >> 24 & 0xFF, buf, pos);
|
|
37252
|
+
byte_to_hex(input.lower >> 16 & 0xFF, buf, pos);
|
|
37253
|
+
byte_to_hex(input.lower >> 8 & 0xFF, buf, pos);
|
|
37254
|
+
byte_to_hex(input.lower & 0xFF, buf, pos);
|
|
37255
|
+
}
|
|
37256
|
+
|
|
37257
|
+
} // namespace duckdb
|
|
37258
|
+
|
|
37259
|
+
|
|
37127
37260
|
namespace duckdb {
|
|
37128
37261
|
|
|
37129
37262
|
ValidityData::ValidityData(idx_t count) : TemplatedValidityData(count) {
|
|
@@ -37349,6 +37482,7 @@ hugeint_t ModuloOperator::Operation(hugeint_t left, hugeint_t right);
|
|
|
37349
37482
|
|
|
37350
37483
|
|
|
37351
37484
|
|
|
37485
|
+
|
|
37352
37486
|
namespace duckdb {
|
|
37353
37487
|
|
|
37354
37488
|
Value::Value(LogicalType type) : type_(move(type)), is_null(true) {
|
|
@@ -37406,6 +37540,8 @@ Value Value::MinimumValue(const LogicalType &type) {
|
|
|
37406
37540
|
return Value::BIGINT(NumericLimits<int64_t>::Minimum());
|
|
37407
37541
|
case LogicalTypeId::HUGEINT:
|
|
37408
37542
|
return Value::HUGEINT(NumericLimits<hugeint_t>::Minimum());
|
|
37543
|
+
case LogicalTypeId::UUID:
|
|
37544
|
+
return Value::UUID(NumericLimits<hugeint_t>::Minimum());
|
|
37409
37545
|
case LogicalTypeId::UTINYINT:
|
|
37410
37546
|
return Value::UTINYINT(NumericLimits<uint8_t>::Minimum());
|
|
37411
37547
|
case LogicalTypeId::USMALLINT:
|
|
@@ -37471,6 +37607,8 @@ Value Value::MaximumValue(const LogicalType &type) {
|
|
|
37471
37607
|
return Value::BIGINT(NumericLimits<int64_t>::Maximum());
|
|
37472
37608
|
case LogicalTypeId::HUGEINT:
|
|
37473
37609
|
return Value::HUGEINT(NumericLimits<hugeint_t>::Maximum());
|
|
37610
|
+
case LogicalTypeId::UUID:
|
|
37611
|
+
return Value::UUID(NumericLimits<hugeint_t>::Maximum());
|
|
37474
37612
|
case LogicalTypeId::UTINYINT:
|
|
37475
37613
|
return Value::UTINYINT(NumericLimits<uint8_t>::Maximum());
|
|
37476
37614
|
case LogicalTypeId::USMALLINT:
|
|
@@ -37563,6 +37701,20 @@ Value Value::HUGEINT(hugeint_t value) {
|
|
|
37563
37701
|
return result;
|
|
37564
37702
|
}
|
|
37565
37703
|
|
|
37704
|
+
Value Value::UUID(hugeint_t value) {
|
|
37705
|
+
Value result(LogicalType::UUID);
|
|
37706
|
+
result.value_.hugeint = value;
|
|
37707
|
+
result.is_null = false;
|
|
37708
|
+
return result;
|
|
37709
|
+
}
|
|
37710
|
+
|
|
37711
|
+
Value Value::UUID(const string &value) {
|
|
37712
|
+
Value result(LogicalType::UUID);
|
|
37713
|
+
result.value_.hugeint = UUID::FromString(value);
|
|
37714
|
+
result.is_null = false;
|
|
37715
|
+
return result;
|
|
37716
|
+
}
|
|
37717
|
+
|
|
37566
37718
|
Value Value::UTINYINT(uint8_t value) {
|
|
37567
37719
|
Value result(LogicalType::UTINYINT);
|
|
37568
37720
|
result.value_.utinyint = value;
|
|
@@ -37945,6 +38097,7 @@ T Value::GetValueInternal() const {
|
|
|
37945
38097
|
case LogicalTypeId::BIGINT:
|
|
37946
38098
|
return Cast::Operation<int64_t, T>(value_.bigint);
|
|
37947
38099
|
case LogicalTypeId::HUGEINT:
|
|
38100
|
+
case LogicalTypeId::UUID:
|
|
37948
38101
|
return Cast::Operation<hugeint_t, T>(value_.hugeint);
|
|
37949
38102
|
case LogicalTypeId::DATE:
|
|
37950
38103
|
return Cast::Operation<date_t, T>(value_.date);
|
|
@@ -38245,6 +38398,8 @@ string Value::ToString() const {
|
|
|
38245
38398
|
return to_string(value_.ubigint);
|
|
38246
38399
|
case LogicalTypeId::HUGEINT:
|
|
38247
38400
|
return Hugeint::ToString(value_.hugeint);
|
|
38401
|
+
case LogicalTypeId::UUID:
|
|
38402
|
+
return UUID::ToString(value_.hugeint);
|
|
38248
38403
|
case LogicalTypeId::FLOAT:
|
|
38249
38404
|
return to_string(value_.float_);
|
|
38250
38405
|
case LogicalTypeId::DOUBLE:
|
|
@@ -38945,6 +39100,7 @@ void Vector::SetValue(idx_t index, const Value &val) {
|
|
|
38945
39100
|
((uint64_t *)data)[index] = val.value_.ubigint;
|
|
38946
39101
|
break;
|
|
38947
39102
|
case LogicalTypeId::HUGEINT:
|
|
39103
|
+
case LogicalTypeId::UUID:
|
|
38948
39104
|
((hugeint_t *)data)[index] = val.value_.hugeint;
|
|
38949
39105
|
break;
|
|
38950
39106
|
case LogicalTypeId::DECIMAL:
|
|
@@ -39077,6 +39233,8 @@ Value Vector::GetValue(idx_t index) const {
|
|
|
39077
39233
|
return Value::TimestampSec(((timestamp_t *)data)[index]);
|
|
39078
39234
|
case LogicalTypeId::HUGEINT:
|
|
39079
39235
|
return Value::HUGEINT(((hugeint_t *)data)[index]);
|
|
39236
|
+
case LogicalTypeId::UUID:
|
|
39237
|
+
return Value::UUID(((hugeint_t *)data)[index]);
|
|
39080
39238
|
case LogicalTypeId::DECIMAL: {
|
|
39081
39239
|
auto width = DecimalType::GetWidth(GetType());
|
|
39082
39240
|
auto scale = DecimalType::GetScale(GetType());
|
|
@@ -40868,6 +41026,7 @@ PhysicalType LogicalType::GetInternalType() {
|
|
|
40868
41026
|
case LogicalTypeId::UBIGINT:
|
|
40869
41027
|
return PhysicalType::UINT64;
|
|
40870
41028
|
case LogicalTypeId::HUGEINT:
|
|
41029
|
+
case LogicalTypeId::UUID:
|
|
40871
41030
|
return PhysicalType::INT128;
|
|
40872
41031
|
case LogicalTypeId::FLOAT:
|
|
40873
41032
|
return PhysicalType::FLOAT;
|
|
@@ -40938,6 +41097,7 @@ const LogicalType LogicalType::UINTEGER = LogicalType(LogicalTypeId::UINTEGER);
|
|
|
40938
41097
|
const LogicalType LogicalType::BIGINT = LogicalType(LogicalTypeId::BIGINT);
|
|
40939
41098
|
const LogicalType LogicalType::UBIGINT = LogicalType(LogicalTypeId::UBIGINT);
|
|
40940
41099
|
const LogicalType LogicalType::HUGEINT = LogicalType(LogicalTypeId::HUGEINT);
|
|
41100
|
+
const LogicalType LogicalType::UUID = LogicalType(LogicalTypeId::UUID);
|
|
40941
41101
|
const LogicalType LogicalType::FLOAT = LogicalType(LogicalTypeId::FLOAT);
|
|
40942
41102
|
const LogicalType LogicalType::DOUBLE = LogicalType(LogicalTypeId::DOUBLE);
|
|
40943
41103
|
const LogicalType LogicalType::DATE = LogicalType(LogicalTypeId::DATE);
|
|
@@ -40976,7 +41136,7 @@ const vector<LogicalType> LogicalType::ALL_TYPES = {
|
|
|
40976
41136
|
LogicalType::FLOAT, LogicalType::VARCHAR, LogicalType::BLOB, LogicalType::INTERVAL,
|
|
40977
41137
|
LogicalType::HUGEINT, LogicalTypeId::DECIMAL, LogicalType::UTINYINT, LogicalType::USMALLINT,
|
|
40978
41138
|
LogicalType::UINTEGER, LogicalType::UBIGINT, LogicalType::TIME, LogicalTypeId::LIST,
|
|
40979
|
-
LogicalTypeId::STRUCT, LogicalTypeId::MAP};
|
|
41139
|
+
LogicalTypeId::STRUCT, LogicalTypeId::MAP, LogicalType::UUID};
|
|
40980
41140
|
|
|
40981
41141
|
const LogicalType LOGICAL_ROW_TYPE = LogicalType::BIGINT;
|
|
40982
41142
|
const PhysicalType ROW_TYPE = PhysicalType::INT64;
|
|
@@ -41133,6 +41293,8 @@ string LogicalTypeIdToString(LogicalTypeId id) {
|
|
|
41133
41293
|
return "BIGINT";
|
|
41134
41294
|
case LogicalTypeId::HUGEINT:
|
|
41135
41295
|
return "HUGEINT";
|
|
41296
|
+
case LogicalTypeId::UUID:
|
|
41297
|
+
return "UUID";
|
|
41136
41298
|
case LogicalTypeId::UTINYINT:
|
|
41137
41299
|
return "UTINYINT";
|
|
41138
41300
|
case LogicalTypeId::USMALLINT:
|
|
@@ -41289,6 +41451,8 @@ LogicalTypeId TransformStringToLogicalType(const string &str) {
|
|
|
41289
41451
|
return LogicalTypeId::INTERVAL;
|
|
41290
41452
|
} else if (lower_str == "hugeint" || lower_str == "int128") {
|
|
41291
41453
|
return LogicalTypeId::HUGEINT;
|
|
41454
|
+
} else if (lower_str == "uuid" || lower_str == "guid") {
|
|
41455
|
+
return LogicalTypeId::UUID;
|
|
41292
41456
|
} else if (lower_str == "struct" || lower_str == "row") {
|
|
41293
41457
|
return LogicalTypeId::STRUCT;
|
|
41294
41458
|
} else if (lower_str == "map") {
|
|
@@ -44479,6 +44643,9 @@ static bool StringCastSwitch(Vector &source, Vector &result, idx_t count, bool s
|
|
|
44479
44643
|
case LogicalTypeId::BLOB:
|
|
44480
44644
|
return VectorTryCastStringLoop<string_t, string_t, duckdb::TryCastToBlob>(source, result, count, strict,
|
|
44481
44645
|
error_message);
|
|
44646
|
+
case LogicalTypeId::UUID:
|
|
44647
|
+
return VectorTryCastStringLoop<string_t, hugeint_t, duckdb::TryCastToUUID>(source, result, count, strict,
|
|
44648
|
+
error_message);
|
|
44482
44649
|
case LogicalTypeId::SQLNULL:
|
|
44483
44650
|
return TryVectorNullCast(source, result, count, error_message);
|
|
44484
44651
|
default:
|
|
@@ -44610,6 +44777,19 @@ static bool IntervalCastSwitch(Vector &source, Vector &result, idx_t count, stri
|
|
|
44610
44777
|
return true;
|
|
44611
44778
|
}
|
|
44612
44779
|
|
|
44780
|
+
static bool UUIDCastSwitch(Vector &source, Vector &result, idx_t count, string *error_message) {
|
|
44781
|
+
// now switch on the result type
|
|
44782
|
+
switch (result.GetType().id()) {
|
|
44783
|
+
case LogicalTypeId::VARCHAR:
|
|
44784
|
+
// uuid to varchar
|
|
44785
|
+
VectorStringCast<hugeint_t, duckdb::CastFromUUID>(source, result, count);
|
|
44786
|
+
break;
|
|
44787
|
+
default:
|
|
44788
|
+
return TryVectorNullCast(source, result, count, error_message);
|
|
44789
|
+
}
|
|
44790
|
+
return true;
|
|
44791
|
+
}
|
|
44792
|
+
|
|
44613
44793
|
static bool BlobCastSwitch(Vector &source, Vector &result, idx_t count, string *error_message) {
|
|
44614
44794
|
// now switch on the result type
|
|
44615
44795
|
switch (result.GetType().id()) {
|
|
@@ -44752,6 +44932,8 @@ bool VectorOperations::TryCast(Vector &source, Vector &result, idx_t count, stri
|
|
|
44752
44932
|
return NumericCastSwitch<uint64_t>(source, result, count, error_message);
|
|
44753
44933
|
case LogicalTypeId::HUGEINT:
|
|
44754
44934
|
return NumericCastSwitch<hugeint_t>(source, result, count, error_message);
|
|
44935
|
+
case LogicalTypeId::UUID:
|
|
44936
|
+
return UUIDCastSwitch(source, result, count, error_message);
|
|
44755
44937
|
case LogicalTypeId::DECIMAL:
|
|
44756
44938
|
return DecimalCastSwitch(source, result, count, error_message);
|
|
44757
44939
|
case LogicalTypeId::FLOAT:
|
|
@@ -70569,6 +70751,7 @@ static AggregateFunction GetUnaryAggregate(LogicalType type) {
|
|
|
70569
70751
|
case LogicalTypeId::UBIGINT:
|
|
70570
70752
|
return AggregateFunction::UnaryAggregate<MinMaxState<uint64_t>, uint64_t, uint64_t, OP>(type, type);
|
|
70571
70753
|
case LogicalTypeId::HUGEINT:
|
|
70754
|
+
case LogicalTypeId::UUID:
|
|
70572
70755
|
return AggregateFunction::UnaryAggregate<MinMaxState<hugeint_t>, hugeint_t, hugeint_t, OP>(type, type);
|
|
70573
70756
|
case LogicalTypeId::FLOAT:
|
|
70574
70757
|
return AggregateFunction::UnaryAggregate<MinMaxState<float>, float, float, OP>(type, type);
|
|
@@ -89612,6 +89795,7 @@ void StructPackFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
89612
89795
|
|
|
89613
89796
|
|
|
89614
89797
|
|
|
89798
|
+
|
|
89615
89799
|
namespace duckdb {
|
|
89616
89800
|
|
|
89617
89801
|
// current_query
|
|
@@ -89624,6 +89808,11 @@ struct SystemBindData : public FunctionData {
|
|
|
89624
89808
|
unique_ptr<FunctionData> Copy() override {
|
|
89625
89809
|
return make_unique<SystemBindData>(context);
|
|
89626
89810
|
}
|
|
89811
|
+
|
|
89812
|
+
static SystemBindData &GetFrom(ExpressionState &state) {
|
|
89813
|
+
auto &func_expr = (BoundFunctionExpression &)state.expr;
|
|
89814
|
+
return (SystemBindData &)*func_expr.bind_info;
|
|
89815
|
+
}
|
|
89627
89816
|
};
|
|
89628
89817
|
|
|
89629
89818
|
unique_ptr<FunctionData> BindSystemFunction(ClientContext &context, ScalarFunction &bound_function,
|
|
@@ -89632,8 +89821,7 @@ unique_ptr<FunctionData> BindSystemFunction(ClientContext &context, ScalarFuncti
|
|
|
89632
89821
|
}
|
|
89633
89822
|
|
|
89634
89823
|
static void CurrentQueryFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
89635
|
-
auto &
|
|
89636
|
-
auto &info = (SystemBindData &)*func_expr.bind_info;
|
|
89824
|
+
auto &info = SystemBindData::GetFrom(state);
|
|
89637
89825
|
|
|
89638
89826
|
Value val(info.context.query);
|
|
89639
89827
|
result.Reference(val);
|
|
@@ -89641,13 +89829,16 @@ static void CurrentQueryFunction(DataChunk &input, ExpressionState &state, Vecto
|
|
|
89641
89829
|
|
|
89642
89830
|
// current_schema
|
|
89643
89831
|
static void CurrentSchemaFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
89644
|
-
Value val(
|
|
89832
|
+
Value val(SystemBindData::GetFrom(state).context.catalog_search_path->GetDefault());
|
|
89645
89833
|
result.Reference(val);
|
|
89646
89834
|
}
|
|
89647
89835
|
|
|
89648
89836
|
// current_schemas
|
|
89649
89837
|
static void CurrentSchemasFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
89650
|
-
vector<Value> schema_list
|
|
89838
|
+
vector<Value> schema_list;
|
|
89839
|
+
vector<string> search_path = SystemBindData::GetFrom(state).context.catalog_search_path->Get();
|
|
89840
|
+
std::transform(search_path.begin(), search_path.end(), std::back_inserter(schema_list),
|
|
89841
|
+
[](const string &s) -> Value { return Value(s); });
|
|
89651
89842
|
auto val = Value::LIST(schema_list);
|
|
89652
89843
|
result.Reference(val);
|
|
89653
89844
|
}
|
|
@@ -89673,9 +89864,10 @@ void SystemFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
89673
89864
|
|
|
89674
89865
|
set.AddFunction(
|
|
89675
89866
|
ScalarFunction("current_query", {}, LogicalType::VARCHAR, CurrentQueryFunction, false, BindSystemFunction));
|
|
89676
|
-
set.AddFunction(ScalarFunction("current_schema", {}, LogicalType::VARCHAR, CurrentSchemaFunction));
|
|
89677
89867
|
set.AddFunction(
|
|
89678
|
-
ScalarFunction("
|
|
89868
|
+
ScalarFunction("current_schema", {}, LogicalType::VARCHAR, CurrentSchemaFunction, false, BindSystemFunction));
|
|
89869
|
+
set.AddFunction(ScalarFunction("current_schemas", {LogicalType::BOOLEAN}, varchar_list_type, CurrentSchemasFunction,
|
|
89870
|
+
false, BindSystemFunction));
|
|
89679
89871
|
set.AddFunction(
|
|
89680
89872
|
ScalarFunction("txid_current", {}, LogicalType::BIGINT, TransactionIdCurrent, false, BindSystemFunction));
|
|
89681
89873
|
set.AddFunction(ScalarFunction("version", {}, LogicalType::VARCHAR, VersionFunction));
|
|
@@ -148128,7 +148320,7 @@ string ValidityStatistics::ToString() {
|
|
|
148128
148320
|
|
|
148129
148321
|
namespace duckdb {
|
|
148130
148322
|
|
|
148131
|
-
const uint64_t VERSION_NUMBER =
|
|
148323
|
+
const uint64_t VERSION_NUMBER = 25;
|
|
148132
148324
|
|
|
148133
148325
|
} // namespace duckdb
|
|
148134
148326
|
|
package/src/duckdb.hpp
CHANGED
|
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
|
-
#define DUCKDB_SOURCE_ID "
|
|
14
|
-
#define DUCKDB_VERSION "0.
|
|
13
|
+
#define DUCKDB_SOURCE_ID "97106596e"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.1-dev2"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -908,6 +908,7 @@ enum class LogicalTypeId : uint8_t {
|
|
|
908
908
|
POINTER = 51,
|
|
909
909
|
HASH = 52,
|
|
910
910
|
VALIDITY = 53,
|
|
911
|
+
UUID = 54,
|
|
911
912
|
|
|
912
913
|
STRUCT = 100,
|
|
913
914
|
LIST = 101,
|
|
@@ -1008,6 +1009,7 @@ public:
|
|
|
1008
1009
|
DUCKDB_API static const LogicalType BLOB;
|
|
1009
1010
|
DUCKDB_API static const LogicalType INTERVAL;
|
|
1010
1011
|
DUCKDB_API static const LogicalType HUGEINT;
|
|
1012
|
+
DUCKDB_API static const LogicalType UUID;
|
|
1011
1013
|
DUCKDB_API static const LogicalType HASH;
|
|
1012
1014
|
DUCKDB_API static const LogicalType POINTER;
|
|
1013
1015
|
DUCKDB_API static const LogicalType TABLE;
|
|
@@ -2537,6 +2539,10 @@ public:
|
|
|
2537
2539
|
DUCKDB_API static Value UBIGINT(uint64_t value);
|
|
2538
2540
|
//! Create a hugeint Value from a specified value
|
|
2539
2541
|
DUCKDB_API static Value HUGEINT(hugeint_t value);
|
|
2542
|
+
//! Create a uuid Value from a specified value
|
|
2543
|
+
DUCKDB_API static Value UUID(const string &value);
|
|
2544
|
+
//! Create a uuid Value from a specified value
|
|
2545
|
+
DUCKDB_API static Value UUID(hugeint_t value);
|
|
2540
2546
|
//! Create a hash Value from a specified value
|
|
2541
2547
|
DUCKDB_API static Value HASH(hash_t value);
|
|
2542
2548
|
//! Create a pointer Value from a specified value
|
|
@@ -11570,6 +11576,48 @@ public:
|
|
|
11570
11576
|
static string ToString(int64_t value, uint8_t scale);
|
|
11571
11577
|
static string ToString(hugeint_t value, uint8_t scale);
|
|
11572
11578
|
};
|
|
11579
|
+
} // namespace duckdb
|
|
11580
|
+
//===----------------------------------------------------------------------===//
|
|
11581
|
+
// DuckDB
|
|
11582
|
+
//
|
|
11583
|
+
// duckdb/common/types/uuid.hpp
|
|
11584
|
+
//
|
|
11585
|
+
//
|
|
11586
|
+
//===----------------------------------------------------------------------===//
|
|
11587
|
+
|
|
11588
|
+
|
|
11589
|
+
|
|
11590
|
+
|
|
11591
|
+
|
|
11592
|
+
|
|
11593
|
+
namespace duckdb {
|
|
11594
|
+
|
|
11595
|
+
//! The UUID class contains static operations for the UUID type
|
|
11596
|
+
class UUID {
|
|
11597
|
+
public:
|
|
11598
|
+
//! Convert a uuid string to a hugeint object
|
|
11599
|
+
static bool FromString(string str, hugeint_t &result);
|
|
11600
|
+
//! Convert a uuid string to a hugeint object
|
|
11601
|
+
static bool FromCString(const char *str, idx_t len, hugeint_t &result) {
|
|
11602
|
+
return FromString(string(str, 0, len), result);
|
|
11603
|
+
}
|
|
11604
|
+
//! Convert a hugeint object to a uuid style string
|
|
11605
|
+
static void ToString(hugeint_t input, char *buf);
|
|
11606
|
+
|
|
11607
|
+
//! Convert a hugeint object to a uuid style string
|
|
11608
|
+
static string ToString(hugeint_t input) {
|
|
11609
|
+
char buff[36];
|
|
11610
|
+
ToString(input, buff);
|
|
11611
|
+
return string(buff, 36);
|
|
11612
|
+
}
|
|
11613
|
+
|
|
11614
|
+
static hugeint_t FromString(string str) {
|
|
11615
|
+
hugeint_t result;
|
|
11616
|
+
FromString(str, result);
|
|
11617
|
+
return result;
|
|
11618
|
+
}
|
|
11619
|
+
};
|
|
11620
|
+
|
|
11573
11621
|
} // namespace duckdb
|
|
11574
11622
|
//===----------------------------------------------------------------------===//
|
|
11575
11623
|
// DuckDB
|