duckdb 0.3.3-dev449.0 → 0.3.3-dev452.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.3-dev449.0",
4
+ "version": "0.3.3-dev452.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -44384,6 +44384,9 @@ static bool BlobCastSwitch(Vector &source, Vector &result, idx_t count, string *
44384
44384
  // blob to varchar
44385
44385
  VectorStringCast<string_t, duckdb::CastFromBlob>(source, result, count);
44386
44386
  break;
44387
+ case LogicalTypeId::AGGREGATE_STATE:
44388
+ result.Reinterpret(source);
44389
+ break;
44387
44390
  default:
44388
44391
  return TryVectorNullCast(source, result, count, error_message);
44389
44392
  }
@@ -44572,6 +44575,15 @@ static bool EnumCastSwitch(Vector &source, Vector &result, idx_t count, string *
44572
44575
  return true;
44573
44576
  }
44574
44577
 
44578
+ static bool AggregateStateToBlobCast(Vector &source, Vector &result, idx_t count, string *error_message, bool strict) {
44579
+ if (result.GetType().id() != LogicalTypeId::BLOB) {
44580
+ throw TypeMismatchException(source.GetType(), result.GetType(),
44581
+ "Cannot cast AGGREGATE_STATE to anything but BLOB");
44582
+ }
44583
+ result.Reinterpret(source);
44584
+ return true;
44585
+ }
44586
+
44575
44587
  static bool StructCastSwitch(Vector &source, Vector &result, idx_t count, string *error_message) {
44576
44588
  switch (result.GetType().id()) {
44577
44589
  case LogicalTypeId::STRUCT:
@@ -44687,6 +44699,8 @@ bool VectorOperations::TryCast(Vector &source, Vector &result, idx_t count, stri
44687
44699
  return ListCastSwitch(source, result, count, error_message);
44688
44700
  case LogicalTypeId::ENUM:
44689
44701
  return EnumCastSwitch(source, result, count, error_message, strict);
44702
+ case LogicalTypeId::AGGREGATE_STATE:
44703
+ return AggregateStateToBlobCast(source, result, count, error_message, strict);
44690
44704
  default:
44691
44705
  return TryVectorNullCast(source, result, count, error_message);
44692
44706
  }
@@ -71269,7 +71283,7 @@ struct FirstFunctionString : public FirstFunctionBase {
71269
71283
  if (!state->is_set || state->is_null) {
71270
71284
  mask.SetInvalid(idx);
71271
71285
  } else {
71272
- target[idx] = StringVector::AddString(result, state->value);
71286
+ target[idx] = StringVector::AddStringOrBlob(result, state->value);
71273
71287
  }
71274
71288
  }
71275
71289
 
@@ -92927,9 +92941,13 @@ static void AggregateStateCombine(DataChunk &input, ExpressionState &state_p, Ve
92927
92941
 
92928
92942
  D_ASSERT(input.data.size() == 2);
92929
92943
  D_ASSERT(input.data[0].GetType().id() == LogicalTypeId::AGGREGATE_STATE);
92930
- D_ASSERT(input.data[0].GetType() == input.data[1].GetType());
92931
92944
  D_ASSERT(input.data[0].GetType() == result.GetType());
92932
92945
 
92946
+ if (input.data[0].GetType().InternalType() != input.data[1].GetType().InternalType()) {
92947
+ throw IOException("Aggregate state combine type mismatch, expect %s, got %s",
92948
+ input.data[0].GetType().ToString(), input.data[1].GetType().ToString());
92949
+ }
92950
+
92933
92951
  VectorData state0_data, state1_data;
92934
92952
  input.data[0].Orrify(input.size(), state0_data);
92935
92953
  input.data[1].Orrify(input.size(), state1_data);
@@ -92960,8 +92978,10 @@ static void AggregateStateCombine(DataChunk &input, ExpressionState &state_p, Ve
92960
92978
  }
92961
92979
 
92962
92980
  // we actually have to combine
92963
- D_ASSERT(state0.GetSize() == bind_data.state_size);
92964
- D_ASSERT(state1.GetSize() == bind_data.state_size);
92981
+ if (state0.GetSize() != bind_data.state_size || state1.GetSize() != bind_data.state_size) {
92982
+ throw IOException("Aggregate state size mismatch, expect %llu, got %llu and %llu", bind_data.state_size,
92983
+ state0.GetSize(), state1.GetSize());
92984
+ }
92965
92985
 
92966
92986
  memcpy(local_state.state_buffer0.get(), state0.GetDataUnsafe(), bind_data.state_size);
92967
92987
  memcpy(local_state.state_buffer1.get(), state1.GetDataUnsafe(), bind_data.state_size);
@@ -92988,7 +93008,8 @@ static unique_ptr<FunctionData> BindAggregateState(ClientContext &context, Scala
92988
93008
  throw BinderException("Can only FINALIZE aggregate state, not %s", arg_return_type.ToString());
92989
93009
  }
92990
93010
  // combine
92991
- if (arguments.size() == 2 && arguments[0]->return_type != arguments[1]->return_type) {
93011
+ if (arguments.size() == 2 && arguments[0]->return_type != arguments[1]->return_type &&
93012
+ arguments[1]->return_type.id() != LogicalTypeId::BLOB) {
92992
93013
  throw BinderException("Cannot COMBINE aggregate states from different functions, %s <> %s",
92993
93014
  arguments[0]->return_type.ToString(), arguments[1]->return_type.ToString());
92994
93015
  }
@@ -93094,7 +93115,7 @@ ScalarFunction ExportAggregateFunction::GetFinalize() {
93094
93115
  }
93095
93116
 
93096
93117
  ScalarFunction ExportAggregateFunction::GetCombine() {
93097
- return ScalarFunction("combine", {LogicalTypeId::AGGREGATE_STATE, LogicalTypeId::AGGREGATE_STATE},
93118
+ return ScalarFunction("combine", {LogicalTypeId::AGGREGATE_STATE, LogicalTypeId::ANY},
93098
93119
  LogicalTypeId::AGGREGATE_STATE, AggregateStateCombine, false, BindAggregateState, nullptr,
93099
93120
  nullptr, InitCombineState);
93100
93121
  }
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 "1355f4f7a"
15
- #define DUCKDB_VERSION "v0.3.3-dev449"
14
+ #define DUCKDB_SOURCE_ID "079877f47"
15
+ #define DUCKDB_VERSION "v0.3.3-dev452"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //