duckdb 0.7.2-dev1637.0 → 0.7.2-dev1684.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 (71) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/src/execution/expression_executor.cpp +1 -1
  3. package/src/duckdb/src/execution/expression_executor_state.cpp +2 -3
  4. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +1 -1
  5. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +10 -0
  6. package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +0 -5
  7. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -0
  8. package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +0 -5
  9. package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +2 -2
  10. package/src/duckdb/src/execution/operator/set/physical_union.cpp +13 -2
  11. package/src/duckdb/src/execution/physical_operator.cpp +0 -15
  12. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +24 -4
  13. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  14. package/src/duckdb/src/include/duckdb/common/enums/order_preservation_type.hpp +24 -0
  15. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -3
  16. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +9 -2
  17. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +8 -1
  18. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +2 -2
  19. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +6 -0
  20. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +6 -3
  21. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +0 -1
  22. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +4 -0
  23. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +5 -1
  24. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +5 -1
  25. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +4 -0
  26. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -0
  27. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +4 -0
  28. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +4 -0
  29. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +4 -0
  30. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +4 -0
  31. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +4 -1
  32. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +4 -0
  33. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +1 -1
  34. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +4 -0
  35. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +4 -0
  36. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +6 -5
  37. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +4 -1
  38. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +3 -4
  39. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +7 -1
  40. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +8 -1
  41. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +7 -0
  42. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +4 -0
  43. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +5 -1
  44. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +4 -0
  45. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +4 -0
  46. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +8 -0
  47. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +4 -0
  48. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +4 -0
  49. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +4 -0
  50. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +4 -0
  51. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +4 -0
  52. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +3 -0
  53. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +4 -0
  54. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +4 -0
  55. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +4 -0
  56. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +4 -0
  57. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +4 -0
  58. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +4 -0
  59. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +4 -0
  60. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +4 -0
  61. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +4 -0
  62. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +4 -0
  63. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +4 -0
  64. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +4 -0
  65. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +15 -9
  66. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -1
  67. package/src/duckdb/src/include/duckdb/planner/pragma_handler.hpp +3 -2
  68. package/src/duckdb/src/main/extension/extension_helper.cpp +17 -2
  69. package/src/duckdb/src/main/query_profiler.cpp +1 -1
  70. package/src/duckdb/src/parallel/pipeline.cpp +24 -9
  71. package/src/duckdb/src/planner/pragma_handler.cpp +7 -5
@@ -41,7 +41,7 @@ public:
41
41
  LocalSourceState &lstate) const override;
42
42
 
43
43
  bool IsSource() const override {
44
- return false;
44
+ return true;
45
45
  }
46
46
 
47
47
  bool ParallelSource() const override {
@@ -52,6 +52,10 @@ public:
52
52
  return true;
53
53
  }
54
54
 
55
+ OrderPreservationType SourceOrder() const override {
56
+ return OrderPreservationType::FIXED_ORDER;
57
+ }
58
+
55
59
  public:
56
60
  // Sink interface
57
61
  unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const override;
@@ -68,6 +72,9 @@ public:
68
72
  bool ParallelSink() const override {
69
73
  return true;
70
74
  }
75
+ bool SinkOrderDependent() const override {
76
+ return false;
77
+ }
71
78
 
72
79
  public:
73
80
  string ParamsToString() const override;
@@ -34,6 +34,13 @@ public:
34
34
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
35
35
  LocalSourceState &lstate) const override;
36
36
 
37
+ bool IsSource() const override {
38
+ return true;
39
+ }
40
+ OrderPreservationType SourceOrder() const override {
41
+ return OrderPreservationType::FIXED_ORDER;
42
+ }
43
+
37
44
  public:
38
45
  SinkResultType Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate,
39
46
  DataChunk &input) const override;
@@ -46,6 +46,10 @@ public:
46
46
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
47
47
  LocalSourceState &lstate) const override;
48
48
 
49
+ bool IsSource() const override {
50
+ return true;
51
+ }
52
+
49
53
  public:
50
54
  // Sink interface
51
55
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -42,6 +42,10 @@ public:
42
42
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
43
43
  LocalSourceState &lstate) const override;
44
44
 
45
+ bool IsSource() const override {
46
+ return true;
47
+ }
48
+
45
49
  public:
46
50
  // Sink interface
47
51
  SinkResultType Sink(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate,
@@ -56,7 +60,7 @@ public:
56
60
  return true;
57
61
  }
58
62
 
59
- bool IsOrderDependent() const override {
63
+ bool SinkOrderDependent() const override {
60
64
  return true;
61
65
  }
62
66
 
@@ -36,6 +36,10 @@ public:
36
36
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
37
37
  LocalSourceState &lstate) const override;
38
38
 
39
+ bool IsSource() const override {
40
+ return true;
41
+ }
42
+
39
43
  public:
40
44
  // Sink interface
41
45
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -41,6 +41,10 @@ public:
41
41
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
42
42
  LocalSourceState &lstate) const override;
43
43
 
44
+ bool IsSource() const override {
45
+ return true;
46
+ }
47
+
44
48
  public:
45
49
  // Sink interface
46
50
  SinkResultType Sink(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate,
@@ -80,6 +80,10 @@ public:
80
80
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
81
81
  LocalSourceState &lstate) const override;
82
82
 
83
+ bool IsSource() const override {
84
+ return true;
85
+ }
86
+
83
87
  public:
84
88
  // Sink interface
85
89
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -98,6 +102,10 @@ public:
98
102
  return parallel;
99
103
  }
100
104
 
105
+ bool SinkOrderDependent() const override {
106
+ return true;
107
+ }
108
+
101
109
  public:
102
110
  static void GetInsertInfo(const BoundCreateTableInfo &info, vector<LogicalType> &insert_types,
103
111
  vector<unique_ptr<Expression>> &bound_defaults);
@@ -39,6 +39,10 @@ public:
39
39
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
40
40
  LocalSourceState &lstate) const override;
41
41
 
42
+ bool IsSource() const override {
43
+ return true;
44
+ }
45
+
42
46
  public:
43
47
  // Sink interface
44
48
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -33,6 +33,10 @@ public:
33
33
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
34
34
  LocalSourceState &lstate) const override;
35
35
 
36
+ bool IsSource() const override {
37
+ return true;
38
+ }
39
+
36
40
  public:
37
41
  void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline) override;
38
42
  };
@@ -25,5 +25,9 @@ public:
25
25
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
26
26
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
27
27
  LocalSourceState &lstate) const override;
28
+
29
+ bool IsSource() const override {
30
+ return true;
31
+ }
28
32
  };
29
33
  } // namespace duckdb
@@ -24,5 +24,9 @@ public:
24
24
  public:
25
25
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
26
26
  LocalSourceState &lstate) const override;
27
+
28
+ bool IsSource() const override {
29
+ return true;
30
+ }
27
31
  };
28
32
  } // namespace duckdb
@@ -39,6 +39,10 @@ public:
39
39
  LocalSourceState &lstate) const override;
40
40
 
41
41
  double GetProgress(ClientContext &context, GlobalSourceState &gstate) const override;
42
+
43
+ bool IsSource() const override {
44
+ return true;
45
+ }
42
46
  };
43
47
 
44
48
  } // namespace duckdb
@@ -60,6 +60,9 @@ public:
60
60
  idx_t GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
61
61
  LocalSourceState &lstate) const override;
62
62
 
63
+ bool IsSource() const override {
64
+ return true;
65
+ }
63
66
  bool ParallelSource() const override {
64
67
  return true;
65
68
  }
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -43,6 +43,10 @@ public:
43
43
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
44
44
  LocalSourceState &lstate) const override;
45
45
 
46
+ bool IsSource() const override {
47
+ return true;
48
+ }
49
+
46
50
  public:
47
51
  //! Sink interface, thread-local sink states
48
52
  unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const override;
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -32,5 +32,9 @@ public:
32
32
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
33
33
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
34
34
  LocalSourceState &lstate) const override;
35
+
36
+ bool IsSource() const override {
37
+ return true;
38
+ }
35
39
  };
36
40
  } // namespace duckdb
@@ -29,6 +29,10 @@ public:
29
29
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
30
30
  LocalSourceState &lstate) const override;
31
31
 
32
+ bool IsSource() const override {
33
+ return true;
34
+ }
35
+
32
36
  public:
33
37
  // Sink interface
34
38
  unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -30,6 +30,10 @@ public:
30
30
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
31
31
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
32
32
  LocalSourceState &lstate) const override;
33
+
34
+ bool IsSource() const override {
35
+ return true;
36
+ }
33
37
  };
34
38
 
35
39
  } // namespace duckdb
@@ -31,6 +31,10 @@ public:
31
31
  unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
32
32
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
33
33
  LocalSourceState &lstate) const override;
34
+
35
+ bool IsSource() const override {
36
+ return true;
37
+ }
34
38
  };
35
39
 
36
40
  } // namespace duckdb
@@ -33,6 +33,10 @@ public:
33
33
  void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
34
34
  LocalSourceState &lstate) const override;
35
35
 
36
+ bool IsSource() const override {
37
+ return true;
38
+ }
39
+
36
40
  public:
37
41
  // Sink interface
38
42
  SinkResultType Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate,
@@ -16,6 +16,7 @@
16
16
  #include "duckdb/execution/execution_context.hpp"
17
17
  #include "duckdb/optimizer/join_order/join_node.hpp"
18
18
  #include "duckdb/execution/physical_operator_states.hpp"
19
+ #include "duckdb/common/enums/order_preservation_type.hpp"
19
20
 
20
21
  namespace duckdb {
21
22
  class Event;
@@ -74,12 +75,6 @@ public:
74
75
 
75
76
  virtual void Verify();
76
77
 
77
- //! Whether or not the operator depends on the order of the input chunks
78
- //! If this is set to true, we cannot do things like caching intermediate vectors
79
- virtual bool IsOrderDependent() const {
80
- return false;
81
- }
82
-
83
78
  public:
84
79
  // Operator interface
85
80
  virtual unique_ptr<OperatorState> GetOperatorState(ExecutionContext &context) const;
@@ -97,6 +92,11 @@ public:
97
92
  return false;
98
93
  }
99
94
 
95
+ //! The influence the operator has on order (insertion order means no influence)
96
+ virtual OrderPreservationType OperatorOrder() const {
97
+ return OrderPreservationType::INSERTION_ORDER;
98
+ }
99
+
100
100
  public:
101
101
  // Source interface
102
102
  virtual unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context,
@@ -119,8 +119,9 @@ public:
119
119
  return false;
120
120
  }
121
121
 
122
- virtual bool IsOrderPreserving() const {
123
- return true;
122
+ //! The type of order emitted by the operator (as a source)
123
+ virtual OrderPreservationType SourceOrder() const {
124
+ return OrderPreservationType::INSERTION_ORDER;
124
125
  }
125
126
 
126
127
  //! Returns the current progress percentage, or a negative value if progress bars are not supported
@@ -161,11 +162,16 @@ public:
161
162
  return false;
162
163
  }
163
164
 
165
+ //! Whether or not the sink operator depends on the order of the input chunks
166
+ //! If this is set to true, we cannot do things like caching intermediate vectors
167
+ virtual bool SinkOrderDependent() const {
168
+ return false;
169
+ }
170
+
164
171
  public:
165
172
  // Pipeline construction
166
173
  virtual vector<const PhysicalOperator *> GetSources() const;
167
174
  bool AllSourcesSupportBatchIndex() const;
168
- virtual bool AllOperatorsPreserveOrder() const;
169
175
 
170
176
  virtual void BuildPipelines(Pipeline &current, MetaPipeline &meta_pipeline);
171
177
 
@@ -90,7 +90,7 @@ public:
90
90
  return source;
91
91
  }
92
92
 
93
- //! Returns whether any of the operators in the pipeline care about preserving insertion order
93
+ //! Returns whether any of the operators in the pipeline care about preserving order
94
94
  bool IsOrderDependent() const;
95
95
 
96
96
  private:
@@ -29,8 +29,9 @@ private:
29
29
  ClientContext &context;
30
30
 
31
31
  private:
32
- //! Handles a pragma statement, (potentially) returning a new statement to replace the current one
33
- string HandlePragma(SQLStatement *statement);
32
+ //! Handles a pragma statement, returns whether the statement was expanded, if it was expanded the 'resulting_query'
33
+ //! contains the statement(s) to replace the current one
34
+ bool HandlePragma(SQLStatement *statement, string &resulting_query);
34
35
 
35
36
  void HandlePragmaStatementsInternal(vector<unique_ptr<SQLStatement>> &statements);
36
37
  };
@@ -78,6 +78,13 @@
78
78
  #include "inet-extension.hpp"
79
79
  #endif
80
80
 
81
+ #if defined(BUILD_AUTOCOMPLETE_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
82
+ #define AUTOCOMPLETE_STATICALLY_LOADED true
83
+ #include "sql_auto_complete-extension.hpp"
84
+ #else
85
+ #define AUTOCOMPLETE_STATICALLY_LOADED false
86
+ #endif
87
+
81
88
  // Load the generated header file containing our list of extension headers
82
89
  #if defined(OOTE_HEADERS_AVAILABLE) && OOTE_HEADERS_AVAILABLE
83
90
  #include "extension_oote_loader.hpp"
@@ -97,6 +104,7 @@ static DefaultExtension internal_extensions[] = {
97
104
  {"httpfs", "Adds support for reading and writing files over a HTTP(S) connection", HTTPFS_STATICALLY_LOADED},
98
105
  {"json", "Adds support for JSON operations", JSON_STATICALLY_LOADED},
99
106
  {"jemalloc", "Overwrites system allocator with JEMalloc", JEMALLOC_STATICALLY_LOADED},
107
+ {"autocomplete", "Add supports for autocomplete in the shell", AUTOCOMPLETE_STATICALLY_LOADED},
100
108
  {"motherduck", "Enables motherduck integration with the system", false},
101
109
  {"sqlite_scanner", "Adds support for reading SQLite database files", false},
102
110
  {"postgres_scanner", "Adds support for reading from a Postgres database", false},
@@ -134,8 +142,8 @@ bool ExtensionHelper::AllowAutoInstall(const string &extension) {
134
142
  // Load Statically Compiled Extension
135
143
  //===--------------------------------------------------------------------===//
136
144
  void ExtensionHelper::LoadAllExtensions(DuckDB &db) {
137
- unordered_set<string> extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs",
138
- "visualizer", "json", "excel", "sqlsmith", "inet", "jemalloc"};
145
+ unordered_set<string> extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs", "visualizer",
146
+ "json", "excel", "sqlsmith", "inet", "jemalloc", "autocomplete"};
139
147
  for (auto &ext : extensions) {
140
148
  LoadExtensionInternal(db, ext, true);
141
149
  }
@@ -244,6 +252,13 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std
244
252
  #else
245
253
  // jemalloc extension required but not build: skip this test
246
254
  return ExtensionLoadResult::NOT_LOADED;
255
+ #endif
256
+ } else if (extension == "autocomplete") {
257
+ #if defined(BUILD_AUTOCOMPLETE_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
258
+ db.LoadExtension<SQLAutoCompleteExtension>();
259
+ #else
260
+ // autocomplete extension required but not build: skip this test
261
+ return ExtensionLoadResult::NOT_LOADED;
247
262
  #endif
248
263
  } else if (extension == "inet") {
249
264
  #if defined(BUILD_INET_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
@@ -690,7 +690,7 @@ ExpressionExecutorInfo::ExpressionExecutorInfo(ExpressionExecutor &executor, con
690
690
  ExpressionRootInfo::ExpressionRootInfo(ExpressionExecutorState &state, string name)
691
691
  : current_count(state.profiler.current_count), sample_count(state.profiler.sample_count),
692
692
  sample_tuples_count(state.profiler.sample_tuples_count), tuples_count(state.profiler.tuples_count),
693
- name(state.name), time(state.profiler.time) {
693
+ name("expression"), time(state.profiler.time) {
694
694
  // Use the name of expression-tree as extra-info
695
695
  extra_info = std::move(name);
696
696
  auto expression_info_p = make_uniq<ExpressionInfo>();
@@ -98,20 +98,29 @@ bool Pipeline::ScheduleParallel(shared_ptr<Event> &event) {
98
98
 
99
99
  bool Pipeline::IsOrderDependent() const {
100
100
  auto &config = DBConfig::GetConfig(executor.context);
101
- if (!config.options.preserve_insertion_order) {
102
- return false;
103
- }
104
- if (sink && sink->IsOrderDependent()) {
105
- return true;
106
- }
107
- if (source && source->IsOrderDependent()) {
108
- return true;
101
+ if (source) {
102
+ auto source_order = source->SourceOrder();
103
+ if (source_order == OrderPreservationType::FIXED_ORDER) {
104
+ return true;
105
+ }
106
+ if (source_order == OrderPreservationType::NO_ORDER) {
107
+ return false;
108
+ }
109
109
  }
110
110
  for (auto &op : operators) {
111
- if (op->IsOrderDependent()) {
111
+ if (op->OperatorOrder() == OrderPreservationType::NO_ORDER) {
112
+ return false;
113
+ }
114
+ if (op->OperatorOrder() == OrderPreservationType::FIXED_ORDER) {
112
115
  return true;
113
116
  }
114
117
  }
118
+ if (!config.options.preserve_insertion_order) {
119
+ return false;
120
+ }
121
+ if (sink && sink->SinkOrderDependent()) {
122
+ return true;
123
+ }
115
124
  return false;
116
125
  }
117
126
 
@@ -148,6 +157,9 @@ bool Pipeline::LaunchScanTasks(shared_ptr<Event> &event, idx_t max_threads) {
148
157
 
149
158
  void Pipeline::ResetSink() {
150
159
  if (sink) {
160
+ if (!sink->IsSink()) {
161
+ throw InternalException("Sink of pipeline does not have IsSink set");
162
+ }
151
163
  lock_guard<mutex> guard(sink->lock);
152
164
  if (!sink->sink_state) {
153
165
  sink->sink_state = sink->GetGlobalSinkState(GetClientContext());
@@ -172,6 +184,9 @@ void Pipeline::Reset() {
172
184
  }
173
185
 
174
186
  void Pipeline::ResetSource(bool force) {
187
+ if (source && !source->IsSource()) {
188
+ throw InternalException("Source of pipeline does not have IsSource set");
189
+ }
175
190
  if (force || !source_state) {
176
191
  source_state = source->GetGlobalSourceState(GetClientContext());
177
192
  }
@@ -32,8 +32,9 @@ void PragmaHandler::HandlePragmaStatementsInternal(vector<unique_ptr<SQLStatemen
32
32
  if (statements[i]->type == StatementType::PRAGMA_STATEMENT) {
33
33
  // PRAGMA statement: check if we need to replace it by a new set of statements
34
34
  PragmaHandler handler(context);
35
- auto new_query = handler.HandlePragma(statements[i].get());
36
- if (!new_query.empty()) {
35
+ string new_query;
36
+ bool expanded = handler.HandlePragma(statements[i].get(), new_query);
37
+ if (expanded) {
37
38
  // this PRAGMA statement gets replaced by a new query string
38
39
  // push the new query string through the parser again and add it to the transformer
39
40
  Parser parser(context.GetParserOptions());
@@ -67,7 +68,7 @@ void PragmaHandler::HandlePragmaStatements(ClientContextLock &lock, vector<uniqu
67
68
  context.RunFunctionInTransactionInternal(lock, [&]() { HandlePragmaStatementsInternal(statements); });
68
69
  }
69
70
 
70
- string PragmaHandler::HandlePragma(SQLStatement *statement) { // PragmaInfo &info
71
+ bool PragmaHandler::HandlePragma(SQLStatement *statement, string &resulting_query) { // PragmaInfo &info
71
72
  auto info = *(statement->Cast<PragmaStatement>()).info;
72
73
  auto entry =
73
74
  Catalog::GetEntry<PragmaFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.name, false);
@@ -84,9 +85,10 @@ string PragmaHandler::HandlePragma(SQLStatement *statement) { // PragmaInfo &inf
84
85
  Binder::BindNamedParameters(bound_function.named_parameters, info.named_parameters, error_context,
85
86
  bound_function.name);
86
87
  FunctionParameters parameters {info.parameters, info.named_parameters};
87
- return bound_function.query(context, parameters);
88
+ resulting_query = bound_function.query(context, parameters);
89
+ return true;
88
90
  }
89
- return string();
91
+ return false;
90
92
  }
91
93
 
92
94
  } // namespace duckdb