duckdb 0.9.1-dev0.0 → 0.9.1-dev143.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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/parquet/column_reader.cpp +26 -1
  3. package/src/duckdb/extension/parquet/include/column_reader.hpp +2 -0
  4. package/src/duckdb/extension/parquet/include/parquet_bss_decoder.hpp +49 -0
  5. package/src/duckdb/src/common/enum_util.cpp +1 -1
  6. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +4 -2
  7. package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
  8. package/src/duckdb/src/core_functions/scalar/map/map.cpp +66 -32
  9. package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
  10. package/src/duckdb/src/execution/expression_executor_state.cpp +8 -2
  11. package/src/duckdb/src/execution/operator/csv_scanner/csv_state_machine_cache.cpp +41 -48
  12. package/src/duckdb/src/execution/operator/csv_scanner/parallel_csv_reader.cpp +13 -9
  13. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +22 -24
  14. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +6 -11
  15. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +8 -3
  16. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +5 -9
  17. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +8 -13
  18. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +2 -2
  19. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +1 -4
  20. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +2 -4
  21. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +4 -6
  22. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +1 -1
  23. package/src/duckdb/src/function/table/read_csv.cpp +1 -1
  24. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  25. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +1 -0
  26. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
  27. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_sniffer.hpp +12 -10
  28. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state.hpp +28 -0
  29. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine.hpp +9 -14
  30. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine_cache.hpp +20 -6
  31. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/parallel_csv_reader.hpp +1 -1
  32. package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
  33. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +2 -2
  34. package/src/duckdb/src/include/duckdb.h +5 -5
  35. package/src/duckdb/src/main/config.cpp +14 -0
  36. package/src/duckdb/src/main/extension/extension_helper.cpp +7 -0
  37. package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +2 -2
  38. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +5 -7
  39. package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +4 -2
  40. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +17 -14
  41. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +5 -12
  42. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +3 -0
  43. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +13 -9
  44. package/src/duckdb/third_party/parquet/parquet_types.h +2 -1
@@ -222,10 +222,7 @@ void Binder::BindModifierTypes(BoundQueryNode &result, const vector<LogicalType>
222
222
  for (auto &target_distinct : distinct.target_distincts) {
223
223
  auto &bound_colref = target_distinct->Cast<BoundColumnRefExpression>();
224
224
  const auto &sql_type = sql_types[bound_colref.binding.column_index];
225
- if (sql_type.id() == LogicalTypeId::VARCHAR) {
226
- target_distinct = ExpressionBinder::PushCollation(context, std::move(target_distinct),
227
- StringType::GetCollation(sql_type), true);
228
- }
225
+ ExpressionBinder::PushCollation(context, target_distinct, sql_type, true);
229
226
  }
230
227
  break;
231
228
  }
@@ -253,10 +250,7 @@ void Binder::BindModifierTypes(BoundQueryNode &result, const vector<LogicalType>
253
250
  D_ASSERT(bound_colref.binding.column_index < sql_types.size());
254
251
  const auto &sql_type = sql_types[bound_colref.binding.column_index];
255
252
  bound_colref.return_type = sql_types[bound_colref.binding.column_index];
256
- if (sql_type.id() == LogicalTypeId::VARCHAR) {
257
- order_node.expression = ExpressionBinder::PushCollation(context, std::move(order_node.expression),
258
- StringType::GetCollation(sql_type));
259
- }
253
+ ExpressionBinder::PushCollation(context, order_node.expression, sql_type);
260
254
  }
261
255
  break;
262
256
  }
@@ -389,9 +383,8 @@ unique_ptr<BoundQueryNode> Binder::BindSelectNode(SelectNode &statement, unique_
389
383
  bool contains_subquery = bound_expr_ref.HasSubquery();
390
384
 
391
385
  // push a potential collation, if necessary
392
- auto collated_expr = ExpressionBinder::PushCollation(context, std::move(bound_expr),
393
- StringType::GetCollation(group_type), true);
394
- if (!contains_subquery && !collated_expr->Equals(bound_expr_ref)) {
386
+ bool requires_collation = ExpressionBinder::PushCollation(context, bound_expr, group_type, true);
387
+ if (!contains_subquery && requires_collation) {
395
388
  // if there is a collation on a group x, we should group by the collated expr,
396
389
  // but also push a first(x) aggregate in case x is selected (uncollated)
397
390
  info.collated_groups[i] = result->aggregates.size();
@@ -405,7 +398,7 @@ unique_ptr<BoundQueryNode> Binder::BindSelectNode(SelectNode &statement, unique_
405
398
  auto function = function_binder.BindAggregateFunction(first_fun, std::move(first_children));
406
399
  result->aggregates.push_back(std::move(function));
407
400
  }
408
- result->groups.group_expressions.push_back(std::move(collated_expr));
401
+ result->groups.group_expressions.push_back(std::move(bound_expr));
409
402
 
410
403
  // in the unbound expression we DO bind the table names of any ColumnRefs
411
404
  // we do this to make sure that "table.a" and "a" are treated the same
@@ -135,6 +135,9 @@ unique_ptr<LogicalOperator> LogicalComparisonJoin::CreateJoin(ClientContext &con
135
135
  bool need_to_consider_arbitrary_expressions = true;
136
136
  switch (reftype) {
137
137
  case JoinRefType::ASOF: {
138
+ if (!arbitrary_expressions.empty()) {
139
+ throw BinderException("Invalid ASOF JOIN condition");
140
+ }
138
141
  need_to_consider_arbitrary_expressions = false;
139
142
  auto asof_idx = conditions.size();
140
143
  for (size_t c = 0; c < conditions.size(); ++c) {
@@ -252,6 +252,7 @@ void DuckTransactionManager::RollbackTransaction(Transaction *transaction_p) {
252
252
  }
253
253
 
254
254
  void DuckTransactionManager::RemoveTransaction(DuckTransaction &transaction) noexcept {
255
+ bool changes_made = transaction.ChangesMade();
255
256
  // remove the transaction from the list of active transactions
256
257
  idx_t t_index = active_transactions.size();
257
258
  // check for the lowest and highest start time in the list of transactions
@@ -275,15 +276,18 @@ void DuckTransactionManager::RemoveTransaction(DuckTransaction &transaction) noe
275
276
  D_ASSERT(t_index != active_transactions.size());
276
277
  auto current_transaction = std::move(active_transactions[t_index]);
277
278
  auto current_query = DatabaseManager::Get(db).ActiveQueryNumber();
278
- if (transaction.commit_id != 0) {
279
- // the transaction was committed, add it to the list of recently
280
- // committed transactions
281
- recently_committed_transactions.push_back(std::move(current_transaction));
282
- } else {
283
- // the transaction was aborted, but we might still need its information
284
- // add it to the set of transactions awaiting GC
285
- current_transaction->highest_active_query = current_query;
286
- old_transactions.push_back(std::move(current_transaction));
279
+ if (changes_made) {
280
+ // if the transaction made any changes we need to keep it around
281
+ if (transaction.commit_id != 0) {
282
+ // the transaction was committed, add it to the list of recently
283
+ // committed transactions
284
+ recently_committed_transactions.push_back(std::move(current_transaction));
285
+ } else {
286
+ // the transaction was aborted, but we might still need its information
287
+ // add it to the set of transactions awaiting GC
288
+ current_transaction->highest_active_query = current_query;
289
+ old_transactions.push_back(std::move(current_transaction));
290
+ }
287
291
  }
288
292
  // remove the transaction from the set of currently active transactions
289
293
  active_transactions.erase(active_transactions.begin() + t_index);
@@ -92,7 +92,8 @@ struct Encoding {
92
92
  DELTA_BINARY_PACKED = 5,
93
93
  DELTA_LENGTH_BYTE_ARRAY = 6,
94
94
  DELTA_BYTE_ARRAY = 7,
95
- RLE_DICTIONARY = 8
95
+ RLE_DICTIONARY = 8,
96
+ BYTE_STREAM_SPLIT = 9,
96
97
  };
97
98
  };
98
99