duckdb 0.3.3-dev683.0 → 0.3.3-dev804.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/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 "dab8d8417"
15
- #define DUCKDB_VERSION "v0.3.3-dev683"
14
+ #define DUCKDB_SOURCE_ID "5588a2c9e"
15
+ #define DUCKDB_VERSION "v0.3.3-dev804"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -962,7 +962,7 @@ enum class LogicalTypeId : uint8_t {
962
962
  UBIGINT = 31,
963
963
  TIMESTAMP_TZ = 32,
964
964
  TIME_TZ = 34,
965
-
965
+ JSON = 35,
966
966
 
967
967
  HUGEINT = 50,
968
968
  POINTER = 51,
@@ -1078,7 +1078,7 @@ public:
1078
1078
  static constexpr const LogicalTypeId POINTER = LogicalTypeId::POINTER;
1079
1079
  static constexpr const LogicalTypeId TABLE = LogicalTypeId::TABLE;
1080
1080
  static constexpr const LogicalTypeId INVALID = LogicalTypeId::INVALID;
1081
-
1081
+ static constexpr const LogicalTypeId JSON = LogicalTypeId::JSON;
1082
1082
  static constexpr const LogicalTypeId ROW_TYPE = LogicalTypeId::BIGINT;
1083
1083
 
1084
1084
  // explicitly allowing these functions to be capitalized to be in-line with the remaining functions
@@ -1145,9 +1145,11 @@ struct AggregateStateType {
1145
1145
  };
1146
1146
 
1147
1147
 
1148
- string LogicalTypeIdToString(LogicalTypeId type);
1148
+ DUCKDB_API string LogicalTypeIdToString(LogicalTypeId type);
1149
+
1150
+ DUCKDB_API LogicalTypeId TransformStringToLogicalTypeId(const string &str);
1149
1151
 
1150
- LogicalTypeId TransformStringToLogicalType(const string &str);
1152
+ DUCKDB_API LogicalType TransformStringToLogicalType(const string &str);
1151
1153
 
1152
1154
  //! Returns the PhysicalType for the given type
1153
1155
  template <class T>
@@ -2737,6 +2739,10 @@ public:
2737
2739
  int32_t micros);
2738
2740
  DUCKDB_API static Value INTERVAL(int32_t months, int32_t days, int64_t micros);
2739
2741
  DUCKDB_API static Value INTERVAL(interval_t interval);
2742
+ //! Creates a JSON Value
2743
+ DUCKDB_API static Value JSON(const char *val);
2744
+ DUCKDB_API static Value JSON(string_t val);
2745
+ DUCKDB_API static Value JSON(string val);
2740
2746
 
2741
2747
  // Create a enum Value from a specified uint value
2742
2748
  DUCKDB_API static Value ENUM(uint64_t value, const LogicalType &original_type);
@@ -4335,7 +4341,8 @@ struct VectorOperations {
4335
4341
  //! Cast the data from the source type to the target type. Any elements that could not be converted are turned into
4336
4342
  //! NULLs. If any elements cannot be converted, returns false and fills in the error_message. If no error message is
4337
4343
  //! provided, an exception is thrown instead.
4338
- static bool TryCast(Vector &source, Vector &result, idx_t count, string *error_message, bool strict = false);
4344
+ DUCKDB_API static bool TryCast(Vector &source, Vector &result, idx_t count, string *error_message,
4345
+ bool strict = false);
4339
4346
  //! Cast the data from the source type to the target type. Throws an exception if the cast fails.
4340
4347
  static void Cast(Vector &source, Vector &result, idx_t count, bool strict = false);
4341
4348
 
@@ -4399,6 +4406,17 @@ struct BinaryLambdaWrapper {
4399
4406
  }
4400
4407
  };
4401
4408
 
4409
+ struct BinaryLambdaWrapperWithNulls {
4410
+ template <class FUNC, class OP, class LEFT_TYPE, class RIGHT_TYPE, class RESULT_TYPE>
4411
+ static inline RESULT_TYPE Operation(FUNC fun, LEFT_TYPE left, RIGHT_TYPE right, ValidityMask &mask, idx_t idx) {
4412
+ return fun(left, right, mask, idx);
4413
+ }
4414
+
4415
+ static bool AddsNulls() {
4416
+ return true;
4417
+ }
4418
+ };
4419
+
4402
4420
  struct BinaryExecutor {
4403
4421
  template <class LEFT_TYPE, class RIGHT_TYPE, class RESULT_TYPE, class OPWRAPPER, class OP, class FUNC,
4404
4422
  bool LEFT_CONSTANT, bool RIGHT_CONSTANT>
@@ -4597,6 +4615,13 @@ public:
4597
4615
  count, false);
4598
4616
  }
4599
4617
 
4618
+ template <class LEFT_TYPE, class RIGHT_TYPE, class RESULT_TYPE,
4619
+ class FUNC = std::function<RESULT_TYPE(LEFT_TYPE, RIGHT_TYPE, ValidityMask &, idx_t)>>
4620
+ static void ExecuteWithNulls(Vector &left, Vector &right, Vector &result, idx_t count, FUNC fun) {
4621
+ ExecuteSwitch<LEFT_TYPE, RIGHT_TYPE, RESULT_TYPE, BinaryLambdaWrapperWithNulls, bool, FUNC>(left, right, result,
4622
+ count, fun);
4623
+ }
4624
+
4600
4625
  public:
4601
4626
  template <class LEFT_TYPE, class RIGHT_TYPE, class OP>
4602
4627
  static idx_t SelectConstant(Vector &left, Vector &right, const SelectionVector *sel, idx_t count,
@@ -5036,6 +5061,14 @@ struct GenericUnaryWrapper {
5036
5061
  }
5037
5062
  };
5038
5063
 
5064
+ struct UnaryLambdaWrapperWithNulls {
5065
+ template <class FUNC, class INPUT_TYPE, class RESULT_TYPE>
5066
+ static inline RESULT_TYPE Operation(INPUT_TYPE input, ValidityMask &mask, idx_t idx, void *dataptr) {
5067
+ auto fun = (FUNC *)dataptr;
5068
+ return (*fun)(input, mask, idx);
5069
+ }
5070
+ };
5071
+
5039
5072
  template <class OP>
5040
5073
  struct UnaryStringOperator {
5041
5074
  template <class INPUT_TYPE, class RESULT_TYPE>
@@ -5190,6 +5223,13 @@ public:
5190
5223
  ExecuteStandard<INPUT_TYPE, RESULT_TYPE, GenericUnaryWrapper, OP>(input, result, count, dataptr, adds_nulls);
5191
5224
  }
5192
5225
 
5226
+ template <class INPUT_TYPE, class RESULT_TYPE,
5227
+ class FUNC = std::function<RESULT_TYPE(INPUT_TYPE, ValidityMask &, idx_t)>>
5228
+ static void ExecuteWithNulls(Vector &input, Vector &result, idx_t count, FUNC fun) {
5229
+ ExecuteStandard<INPUT_TYPE, RESULT_TYPE, UnaryLambdaWrapperWithNulls, FUNC>(input, result, count, (void *)&fun,
5230
+ true);
5231
+ }
5232
+
5193
5233
  template <class INPUT_TYPE, class RESULT_TYPE, class OP>
5194
5234
  static void ExecuteString(Vector &input, Vector &result, idx_t count) {
5195
5235
  UnaryExecutor::GenericExecute<string_t, string_t, UnaryStringOperator<OP>>(input, result, count,
@@ -5861,6 +5901,7 @@ enum class ExpressionType : uint8_t {
5861
5901
  ARRAY_SLICE = 154,
5862
5902
  STRUCT_EXTRACT = 155,
5863
5903
  ARRAY_CONSTRUCTOR = 156,
5904
+ ARROW = 157,
5864
5905
 
5865
5906
  // -----------------------------
5866
5907
  // Subquery IN/EXISTS
@@ -21336,14 +21377,16 @@ private:
21336
21377
 
21337
21378
  namespace duckdb {
21338
21379
 
21339
- //! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
21380
+ //! LambdaExpression represents either:
21381
+ //! 1. A lambda operator that can be used for e.g. mapping an expression to a list
21382
+ //! 2. An OperatorExpression with the "->" operator
21340
21383
  //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
21341
21384
  class LambdaExpression : public ParsedExpression {
21342
21385
  public:
21343
- LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
21386
+ LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
21344
21387
 
21345
- vector<string> parameters;
21346
- unique_ptr<ParsedExpression> expression;
21388
+ unique_ptr<ParsedExpression> lhs;
21389
+ unique_ptr<ParsedExpression> rhs;
21347
21390
 
21348
21391
  public:
21349
21392
  string ToString() const override;