duckdb 0.3.5-dev2.0 → 0.3.5-dev22.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.5-dev2.0",
4
+ "version": "0.3.5-dev22.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -103872,44 +103872,74 @@ void BaseAppender::AppendValueInternal(T input) {
103872
103872
  throw InvalidInputException("Too many appends for chunk!");
103873
103873
  }
103874
103874
  auto &col = chunk->data[column];
103875
- switch (col.GetType().InternalType()) {
103876
- case PhysicalType::BOOL:
103875
+ switch (col.GetType().id()) {
103876
+ case LogicalTypeId::BOOLEAN:
103877
103877
  AppendValueInternal<T, bool>(col, input);
103878
103878
  break;
103879
- case PhysicalType::UINT8:
103879
+ case LogicalTypeId::UTINYINT:
103880
103880
  AppendValueInternal<T, uint8_t>(col, input);
103881
103881
  break;
103882
- case PhysicalType::INT8:
103882
+ case LogicalTypeId::TINYINT:
103883
103883
  AppendValueInternal<T, int8_t>(col, input);
103884
103884
  break;
103885
- case PhysicalType::UINT16:
103885
+ case LogicalTypeId::USMALLINT:
103886
103886
  AppendValueInternal<T, uint16_t>(col, input);
103887
103887
  break;
103888
- case PhysicalType::INT16:
103888
+ case LogicalTypeId::SMALLINT:
103889
103889
  AppendValueInternal<T, int16_t>(col, input);
103890
103890
  break;
103891
- case PhysicalType::UINT32:
103891
+ case LogicalTypeId::UINTEGER:
103892
103892
  AppendValueInternal<T, uint32_t>(col, input);
103893
103893
  break;
103894
- case PhysicalType::INT32:
103894
+ case LogicalTypeId::INTEGER:
103895
103895
  AppendValueInternal<T, int32_t>(col, input);
103896
103896
  break;
103897
- case PhysicalType::UINT64:
103897
+ case LogicalTypeId::UBIGINT:
103898
103898
  AppendValueInternal<T, uint64_t>(col, input);
103899
103899
  break;
103900
- case PhysicalType::INT64:
103900
+ case LogicalTypeId::BIGINT:
103901
103901
  AppendValueInternal<T, int64_t>(col, input);
103902
103902
  break;
103903
- case PhysicalType::INT128:
103903
+ case LogicalTypeId::HUGEINT:
103904
103904
  AppendValueInternal<T, hugeint_t>(col, input);
103905
103905
  break;
103906
- case PhysicalType::FLOAT:
103906
+ case LogicalTypeId::FLOAT:
103907
103907
  AppendValueInternal<T, float>(col, input);
103908
103908
  break;
103909
- case PhysicalType::DOUBLE:
103909
+ case LogicalTypeId::DOUBLE:
103910
103910
  AppendValueInternal<T, double>(col, input);
103911
103911
  break;
103912
- case PhysicalType::VARCHAR:
103912
+ case LogicalTypeId::DECIMAL:
103913
+ switch (col.GetType().InternalType()) {
103914
+ case PhysicalType::INT8:
103915
+ AppendValueInternal<T, int8_t>(col, input);
103916
+ break;
103917
+ case PhysicalType::INT16:
103918
+ AppendValueInternal<T, int16_t>(col, input);
103919
+ break;
103920
+ case PhysicalType::INT32:
103921
+ AppendValueInternal<T, int32_t>(col, input);
103922
+ break;
103923
+ default:
103924
+ AppendValueInternal<T, int64_t>(col, input);
103925
+ break;
103926
+ }
103927
+ break;
103928
+ case LogicalTypeId::DATE:
103929
+ AppendValueInternal<T, date_t>(col, input);
103930
+ break;
103931
+ case LogicalTypeId::TIMESTAMP:
103932
+ case LogicalTypeId::TIMESTAMP_TZ:
103933
+ AppendValueInternal<T, timestamp_t>(col, input);
103934
+ break;
103935
+ case LogicalTypeId::TIME:
103936
+ case LogicalTypeId::TIME_TZ:
103937
+ AppendValueInternal<T, dtime_t>(col, input);
103938
+ break;
103939
+ case LogicalTypeId::INTERVAL:
103940
+ AppendValueInternal<T, interval_t>(col, input);
103941
+ break;
103942
+ case LogicalTypeId::VARCHAR:
103913
103943
  FlatVector::GetData<string_t>(col)[chunk->size()] = StringCast::Operation<T>(input, col);
103914
103944
  break;
103915
103945
  default:
@@ -103995,17 +104025,17 @@ void BaseAppender::Append(double value) {
103995
104025
 
103996
104026
  template <>
103997
104027
  void BaseAppender::Append(date_t value) {
103998
- AppendValueInternal<int32_t>(value.days);
104028
+ AppendValueInternal<date_t>(value);
103999
104029
  }
104000
104030
 
104001
104031
  template <>
104002
104032
  void BaseAppender::Append(dtime_t value) {
104003
- AppendValueInternal<int64_t>(value.micros);
104033
+ AppendValueInternal<dtime_t>(value);
104004
104034
  }
104005
104035
 
104006
104036
  template <>
104007
104037
  void BaseAppender::Append(timestamp_t value) {
104008
- AppendValueInternal<int64_t>(value.value);
104038
+ AppendValueInternal<timestamp_t>(value);
104009
104039
  }
104010
104040
 
104011
104041
  template <>
@@ -105104,6 +105134,24 @@ duckdb_logical_type duckdb_create_logical_type(duckdb_type type) {
105104
105134
  return new duckdb::LogicalType(duckdb::ConvertCTypeToCPP(type));
105105
105135
  }
105106
105136
 
105137
+ duckdb_logical_type duckdb_create_list_type(duckdb_logical_type type) {
105138
+ if (!type) {
105139
+ return nullptr;
105140
+ }
105141
+ duckdb::LogicalType *ltype = new duckdb::LogicalType;
105142
+ *ltype = duckdb::LogicalType::LIST(*(duckdb::LogicalType *)type);
105143
+ return ltype;
105144
+ }
105145
+
105146
+ duckdb_logical_type duckdb_create_map_type(duckdb_logical_type key_type, duckdb_logical_type value_type) {
105147
+ if (!key_type || !value_type) {
105148
+ return nullptr;
105149
+ }
105150
+ duckdb::LogicalType *mtype = new duckdb::LogicalType;
105151
+ *mtype = duckdb::LogicalType::MAP(*(duckdb::LogicalType *)key_type, *(duckdb::LogicalType *)value_type);
105152
+ return mtype;
105153
+ }
105154
+
105107
105155
  duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale) {
105108
105156
  return new duckdb::LogicalType(duckdb::LogicalType::DECIMAL(width, scale));
105109
105157
  }
@@ -105223,6 +105271,28 @@ duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type) {
105223
105271
  return new duckdb::LogicalType(duckdb::ListType::GetChildType(ltype));
105224
105272
  }
105225
105273
 
105274
+ duckdb_logical_type duckdb_map_type_key_type(duckdb_logical_type type) {
105275
+ if (!type) {
105276
+ return nullptr;
105277
+ }
105278
+ auto &mtype = *((duckdb::LogicalType *)type);
105279
+ if (mtype.id() != duckdb::LogicalTypeId::MAP) {
105280
+ return nullptr;
105281
+ }
105282
+ return new duckdb::LogicalType(duckdb::MapType::KeyType(mtype));
105283
+ }
105284
+
105285
+ duckdb_logical_type duckdb_map_type_value_type(duckdb_logical_type type) {
105286
+ if (!type) {
105287
+ return nullptr;
105288
+ }
105289
+ auto &mtype = *((duckdb::LogicalType *)type);
105290
+ if (mtype.id() != duckdb::LogicalTypeId::MAP) {
105291
+ return nullptr;
105292
+ }
105293
+ return new duckdb::LogicalType(duckdb::MapType::ValueType(mtype));
105294
+ }
105295
+
105226
105296
  idx_t duckdb_struct_type_child_count(duckdb_logical_type type) {
105227
105297
  if (!type) {
105228
105298
  return 0;
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 "0c68c88e5"
15
- #define DUCKDB_VERSION "v0.3.5-dev2"
14
+ #define DUCKDB_SOURCE_ID "339bd4003"
15
+ #define DUCKDB_VERSION "v0.3.5-dev22"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -15975,6 +15975,24 @@ This should not be used with `DUCKDB_TYPE_DECIMAL`.
15975
15975
  */
15976
15976
  DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type);
15977
15977
 
15978
+ /*!
15979
+ Creates a list type from its child type.
15980
+ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
15981
+
15982
+ * type: The child type of list type to create.
15983
+ * returns: The logical type.
15984
+ */
15985
+ DUCKDB_API duckdb_logical_type duckdb_create_list_type(duckdb_logical_type type);
15986
+
15987
+ /*!
15988
+ Creates a map type from its key type and value type.
15989
+ The resulting type should be destroyed with `duckdb_destroy_logical_type`.
15990
+
15991
+ * type: The key type and value type of map type to create.
15992
+ * returns: The logical type.
15993
+ */
15994
+ DUCKDB_API duckdb_logical_type duckdb_create_map_type(duckdb_logical_type key_type, duckdb_logical_type value_type);
15995
+
15978
15996
  /*!
15979
15997
  Creates a `duckdb_logical_type` of type decimal with the specified width and scale
15980
15998
  The resulting type should be destroyed with `duckdb_destroy_logical_type`.
@@ -16054,6 +16072,26 @@ The result must be freed with `duckdb_destroy_logical_type`
16054
16072
  */
16055
16073
  DUCKDB_API duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type);
16056
16074
 
16075
+ /*!
16076
+ Retrieves the key type of the given map type.
16077
+
16078
+ The result must be freed with `duckdb_destroy_logical_type`
16079
+
16080
+ * type: The logical type object
16081
+ * returns: The key type of the map type. Must be destroyed with `duckdb_destroy_logical_type`.
16082
+ */
16083
+ DUCKDB_API duckdb_logical_type duckdb_map_type_key_type(duckdb_logical_type type);
16084
+
16085
+ /*!
16086
+ Retrieves the value type of the given map type.
16087
+
16088
+ The result must be freed with `duckdb_destroy_logical_type`
16089
+
16090
+ * type: The logical type object
16091
+ * returns: The value type of the map type. Must be destroyed with `duckdb_destroy_logical_type`.
16092
+ */
16093
+ DUCKDB_API duckdb_logical_type duckdb_map_type_value_type(duckdb_logical_type type);
16094
+
16057
16095
  /*!
16058
16096
  Returns the number of children of a struct type.
16059
16097