duckdb 0.7.2-dev16.0 → 0.7.2-dev314.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 (242) hide show
  1. package/binding.gyp +2 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-extension.cpp +2 -0
  4. package/src/duckdb/extension/icu/icu-table-range.cpp +194 -0
  5. package/src/duckdb/extension/icu/include/icu-table-range.hpp +17 -0
  6. package/src/duckdb/extension/parquet/column_reader.cpp +5 -6
  7. package/src/duckdb/extension/parquet/column_writer.cpp +0 -1
  8. package/src/duckdb/extension/parquet/include/column_reader.hpp +1 -2
  9. package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +1 -11
  10. package/src/duckdb/extension/parquet/parquet-extension.cpp +11 -2
  11. package/src/duckdb/extension/parquet/parquet_statistics.cpp +26 -32
  12. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +4 -0
  13. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +7 -6
  14. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +20 -1
  15. package/src/duckdb/src/common/enums/statement_type.cpp +2 -0
  16. package/src/duckdb/src/common/sort/sort_state.cpp +5 -7
  17. package/src/duckdb/src/common/types/bit.cpp +95 -58
  18. package/src/duckdb/src/common/types/value.cpp +149 -53
  19. package/src/duckdb/src/common/types/vector.cpp +13 -10
  20. package/src/duckdb/src/execution/column_binding_resolver.cpp +6 -0
  21. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +4 -5
  22. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +1 -1
  23. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +2 -3
  24. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +32 -6
  25. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1 -1
  26. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +15 -15
  27. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +18 -12
  28. package/src/duckdb/src/function/aggregate/algebraic/avg.cpp +0 -6
  29. package/src/duckdb/src/function/aggregate/distributive/bitagg.cpp +99 -95
  30. package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +254 -0
  31. package/src/duckdb/src/function/aggregate/distributive/count.cpp +2 -4
  32. package/src/duckdb/src/function/aggregate/distributive/sum.cpp +11 -16
  33. package/src/duckdb/src/function/aggregate/distributive_functions.cpp +1 -0
  34. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +16 -5
  35. package/src/duckdb/src/function/cast/bit_cast.cpp +0 -2
  36. package/src/duckdb/src/function/cast/blob_cast.cpp +0 -1
  37. package/src/duckdb/src/function/scalar/bit/bitstring.cpp +99 -0
  38. package/src/duckdb/src/function/scalar/date/date_diff.cpp +0 -1
  39. package/src/duckdb/src/function/scalar/date/date_part.cpp +17 -25
  40. package/src/duckdb/src/function/scalar/date/date_sub.cpp +0 -1
  41. package/src/duckdb/src/function/scalar/date/date_trunc.cpp +10 -14
  42. package/src/duckdb/src/function/scalar/generic/stats.cpp +2 -4
  43. package/src/duckdb/src/function/scalar/list/flatten.cpp +5 -12
  44. package/src/duckdb/src/function/scalar/list/list_concat.cpp +3 -8
  45. package/src/duckdb/src/function/scalar/list/list_extract.cpp +5 -12
  46. package/src/duckdb/src/function/scalar/list/list_value.cpp +5 -9
  47. package/src/duckdb/src/function/scalar/map/map_entries.cpp +61 -0
  48. package/src/duckdb/src/function/scalar/map/map_keys_values.cpp +97 -0
  49. package/src/duckdb/src/function/scalar/math/numeric.cpp +14 -17
  50. package/src/duckdb/src/function/scalar/nested_functions.cpp +3 -0
  51. package/src/duckdb/src/function/scalar/operators/add.cpp +0 -9
  52. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +29 -48
  53. package/src/duckdb/src/function/scalar/operators/bitwise.cpp +0 -63
  54. package/src/duckdb/src/function/scalar/operators/multiply.cpp +0 -6
  55. package/src/duckdb/src/function/scalar/operators/subtract.cpp +0 -6
  56. package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -6
  57. package/src/duckdb/src/function/scalar/string/instr.cpp +2 -6
  58. package/src/duckdb/src/function/scalar/string/length.cpp +2 -6
  59. package/src/duckdb/src/function/scalar/string/like.cpp +2 -6
  60. package/src/duckdb/src/function/scalar/string/substring.cpp +2 -6
  61. package/src/duckdb/src/function/scalar/string_functions.cpp +1 -0
  62. package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +4 -9
  63. package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +10 -13
  64. package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +5 -6
  65. package/src/duckdb/src/function/table/read_csv.cpp +9 -0
  66. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  67. package/src/duckdb/src/function/table_function.cpp +19 -0
  68. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +6 -8
  69. package/src/duckdb/src/include/duckdb/common/constants.hpp +0 -19
  70. package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +2 -1
  71. package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +2 -1
  72. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +5 -1
  73. package/src/duckdb/src/include/duckdb/common/types/value.hpp +2 -8
  74. package/src/duckdb/src/include/duckdb/common/types.hpp +1 -2
  75. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
  76. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +5 -0
  77. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +12 -3
  78. package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +4 -0
  79. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +12 -0
  80. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -2
  81. package/src/duckdb/src/include/duckdb/function/table_function.hpp +2 -0
  82. package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +2 -0
  83. package/src/duckdb/src/include/duckdb/main/config.hpp +3 -0
  84. package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
  85. package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +2 -2
  86. package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -0
  87. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -1
  88. package/src/duckdb/src/include/duckdb/parser/parsed_data/{alter_function_info.hpp → alter_scalar_function_info.hpp} +13 -13
  89. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_function_info.hpp +47 -0
  90. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_function_info.hpp +2 -1
  91. package/src/duckdb/src/include/duckdb/parser/query_node.hpp +2 -1
  92. package/src/duckdb/src/include/duckdb/parser/statement/multi_statement.hpp +28 -0
  93. package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +1 -0
  94. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +76 -0
  95. package/src/duckdb/src/include/duckdb/parser/tokens.hpp +2 -0
  96. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +28 -0
  97. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -0
  98. package/src/duckdb/src/include/duckdb/planner/binder.hpp +8 -0
  99. package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +2 -0
  100. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +76 -44
  101. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -2
  102. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +2 -2
  103. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
  104. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +1 -1
  105. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +2 -2
  106. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
  107. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +1 -1
  108. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +5 -2
  109. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
  110. package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +93 -29
  111. package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +22 -3
  112. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +6 -6
  113. package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +41 -0
  114. package/src/duckdb/src/include/duckdb/storage/statistics/node_statistics.hpp +26 -0
  115. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +157 -0
  116. package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -7
  117. package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +74 -0
  118. package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +42 -0
  119. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +2 -3
  120. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
  121. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
  122. package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +2 -1
  123. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +4 -3
  124. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +3 -2
  125. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +2 -0
  126. package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +5 -0
  127. package/src/duckdb/src/include/duckdb.h +49 -1
  128. package/src/duckdb/src/include/duckdb.hpp +0 -1
  129. package/src/duckdb/src/main/capi/pending-c.cpp +16 -3
  130. package/src/duckdb/src/main/capi/result-c.cpp +27 -1
  131. package/src/duckdb/src/main/capi/stream-c.cpp +25 -0
  132. package/src/duckdb/src/main/client_context.cpp +8 -1
  133. package/src/duckdb/src/main/config.cpp +66 -1
  134. package/src/duckdb/src/main/database.cpp +10 -2
  135. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +98 -67
  136. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +16 -3
  137. package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +9 -3
  138. package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +6 -7
  139. package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +14 -11
  140. package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
  141. package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +13 -15
  142. package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +0 -1
  143. package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +3 -75
  144. package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +7 -2
  145. package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +10 -0
  146. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +2 -3
  147. package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +28 -31
  148. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +4 -5
  149. package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +3 -3
  150. package/src/duckdb/src/optimizer/statistics_propagator.cpp +1 -1
  151. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +7 -3
  152. package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +56 -0
  153. package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +51 -0
  154. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -2
  155. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +6 -0
  156. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +8 -0
  157. package/src/duckdb/src/parser/query_node.cpp +1 -1
  158. package/src/duckdb/src/parser/statement/multi_statement.cpp +18 -0
  159. package/src/duckdb/src/parser/tableref/pivotref.cpp +296 -0
  160. package/src/duckdb/src/parser/tableref.cpp +3 -0
  161. package/src/duckdb/src/parser/transform/helpers/transform_alias.cpp +12 -6
  162. package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +24 -0
  163. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +4 -0
  164. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +4 -0
  165. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +150 -0
  166. package/src/duckdb/src/parser/transform/statement/transform_select.cpp +8 -0
  167. package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +1 -1
  168. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +4 -0
  169. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +105 -0
  170. package/src/duckdb/src/parser/transform/tableref/transform_tableref.cpp +2 -0
  171. package/src/duckdb/src/parser/transformer.cpp +15 -3
  172. package/src/duckdb/src/planner/bind_context.cpp +16 -0
  173. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +11 -3
  174. package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +0 -1
  175. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +1 -1
  176. package/src/duckdb/src/planner/binder/statement/bind_logical_plan.cpp +17 -0
  177. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +9 -0
  178. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +365 -0
  179. package/src/duckdb/src/planner/binder.cpp +7 -1
  180. package/src/duckdb/src/planner/bound_result_modifier.cpp +1 -1
  181. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +1 -1
  182. package/src/duckdb/src/planner/filter/constant_filter.cpp +4 -6
  183. package/src/duckdb/src/planner/pragma_handler.cpp +10 -2
  184. package/src/duckdb/src/storage/buffer_manager.cpp +44 -46
  185. package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +1 -1
  186. package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +1 -4
  187. package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +4 -4
  188. package/src/duckdb/src/storage/compression/bitpacking.cpp +28 -24
  189. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +43 -45
  190. package/src/duckdb/src/storage/compression/numeric_constant.cpp +9 -10
  191. package/src/duckdb/src/storage/compression/patas.cpp +1 -1
  192. package/src/duckdb/src/storage/compression/rle.cpp +19 -15
  193. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +5 -5
  194. package/src/duckdb/src/storage/data_table.cpp +4 -6
  195. package/src/duckdb/src/storage/statistics/base_statistics.cpp +373 -128
  196. package/src/duckdb/src/storage/statistics/column_statistics.cpp +58 -3
  197. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +4 -9
  198. package/src/duckdb/src/storage/statistics/list_stats.cpp +117 -0
  199. package/src/duckdb/src/storage/statistics/numeric_stats.cpp +529 -0
  200. package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -11
  201. package/src/duckdb/src/storage/statistics/string_stats.cpp +273 -0
  202. package/src/duckdb/src/storage/statistics/struct_stats.cpp +131 -0
  203. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  204. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -4
  205. package/src/duckdb/src/storage/table/column_data.cpp +16 -11
  206. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +2 -3
  207. package/src/duckdb/src/storage/table/column_segment.cpp +6 -8
  208. package/src/duckdb/src/storage/table/list_column_data.cpp +39 -58
  209. package/src/duckdb/src/storage/table/row_group.cpp +24 -23
  210. package/src/duckdb/src/storage/table/row_group_collection.cpp +12 -12
  211. package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -6
  212. package/src/duckdb/src/storage/table/struct_column_data.cpp +15 -16
  213. package/src/duckdb/src/storage/table/table_statistics.cpp +27 -7
  214. package/src/duckdb/src/storage/table/update_segment.cpp +10 -12
  215. package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +3 -0
  216. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +34 -1
  217. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +1020 -530
  218. package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +7 -0
  219. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +23560 -22737
  220. package/src/duckdb/ub_src_function_aggregate_distributive.cpp +2 -0
  221. package/src/duckdb/ub_src_function_scalar_bit.cpp +2 -0
  222. package/src/duckdb/ub_src_function_scalar_map.cpp +4 -0
  223. package/src/duckdb/ub_src_main_capi.cpp +2 -0
  224. package/src/duckdb/ub_src_parser_parsed_data.cpp +4 -2
  225. package/src/duckdb/ub_src_parser_statement.cpp +2 -0
  226. package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
  227. package/src/duckdb/ub_src_parser_transform_statement.cpp +2 -0
  228. package/src/duckdb/ub_src_parser_transform_tableref.cpp +2 -0
  229. package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
  230. package/src/duckdb/ub_src_storage_statistics.cpp +4 -6
  231. package/src/duckdb/src/include/duckdb/main/loadable_extension.hpp +0 -59
  232. package/src/duckdb/src/include/duckdb/storage/statistics/list_statistics.hpp +0 -36
  233. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_statistics.hpp +0 -75
  234. package/src/duckdb/src/include/duckdb/storage/statistics/string_statistics.hpp +0 -49
  235. package/src/duckdb/src/include/duckdb/storage/statistics/struct_statistics.hpp +0 -36
  236. package/src/duckdb/src/include/duckdb/storage/statistics/validity_statistics.hpp +0 -45
  237. package/src/duckdb/src/parser/parsed_data/alter_function_info.cpp +0 -55
  238. package/src/duckdb/src/storage/statistics/list_statistics.cpp +0 -94
  239. package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +0 -307
  240. package/src/duckdb/src/storage/statistics/string_statistics.cpp +0 -220
  241. package/src/duckdb/src/storage/statistics/struct_statistics.cpp +0 -108
  242. package/src/duckdb/src/storage/statistics/validity_statistics.cpp +0 -91
@@ -2,6 +2,8 @@
2
2
 
3
3
  #include "src/function/aggregate/distributive/bitagg.cpp"
4
4
 
5
+ #include "src/function/aggregate/distributive/bitstring_agg.cpp"
6
+
5
7
  #include "src/function/aggregate/distributive/count.cpp"
6
8
 
7
9
  #include "src/function/aggregate/distributive/first.cpp"
@@ -0,0 +1,2 @@
1
+ #include "src/function/scalar/bit/bitstring.cpp"
2
+
@@ -4,5 +4,9 @@
4
4
 
5
5
  #include "src/function/scalar/map/map_from_entries.cpp"
6
6
 
7
+ #include "src/function/scalar/map/map_entries.cpp"
8
+
9
+ #include "src/function/scalar/map/map_keys_values.cpp"
10
+
7
11
  #include "src/function/scalar/map/cardinality.cpp"
8
12
 
@@ -26,6 +26,8 @@
26
26
 
27
27
  #include "src/main/capi/result-c.cpp"
28
28
 
29
+ #include "src/main/capi/stream-c.cpp"
30
+
29
31
  #include "src/main/capi/table_function-c.cpp"
30
32
 
31
33
  #include "src/main/capi/threading-c.cpp"
@@ -1,7 +1,9 @@
1
- #include "src/parser/parsed_data/alter_function_info.cpp"
2
-
3
1
  #include "src/parser/parsed_data/alter_info.cpp"
4
2
 
3
+ #include "src/parser/parsed_data/alter_scalar_function_info.cpp"
4
+
5
+ #include "src/parser/parsed_data/alter_table_function_info.cpp"
6
+
5
7
  #include "src/parser/parsed_data/alter_table_info.cpp"
6
8
 
7
9
  #include "src/parser/parsed_data/create_info.cpp"
@@ -26,6 +26,8 @@
26
26
 
27
27
  #include "src/parser/statement/load_statement.cpp"
28
28
 
29
+ #include "src/parser/statement/multi_statement.cpp"
30
+
29
31
  #include "src/parser/statement/pragma_statement.cpp"
30
32
 
31
33
  #include "src/parser/statement/prepare_statement.cpp"
@@ -6,6 +6,8 @@
6
6
 
7
7
  #include "src/parser/tableref/joinref.cpp"
8
8
 
9
+ #include "src/parser/tableref/pivotref.cpp"
10
+
9
11
  #include "src/parser/tableref/subqueryref.cpp"
10
12
 
11
13
  #include "src/parser/tableref/table_function.cpp"
@@ -50,6 +50,8 @@
50
50
 
51
51
  #include "src/parser/transform/statement/transform_set.cpp"
52
52
 
53
+ #include "src/parser/transform/statement/transform_pivot_stmt.cpp"
54
+
53
55
  #include "src/parser/transform/statement/transform_prepare.cpp"
54
56
 
55
57
  #include "src/parser/transform/statement/transform_show.cpp"
@@ -4,6 +4,8 @@
4
4
 
5
5
  #include "src/parser/transform/tableref/transform_from.cpp"
6
6
 
7
+ #include "src/parser/transform/tableref/transform_pivot.cpp"
8
+
7
9
  #include "src/parser/transform/tableref/transform_subquery.cpp"
8
10
 
9
11
  #include "src/parser/transform/tableref/transform_table_function.cpp"
@@ -6,6 +6,8 @@
6
6
 
7
7
  #include "src/planner/binder/tableref/bind_joinref.cpp"
8
8
 
9
+ #include "src/planner/binder/tableref/bind_pivot.cpp"
10
+
9
11
  #include "src/planner/binder/tableref/bind_subqueryref.cpp"
10
12
 
11
13
  #include "src/planner/binder/tableref/bind_table_function.cpp"
@@ -4,15 +4,13 @@
4
4
 
5
5
  #include "src/storage/statistics/distinct_statistics.cpp"
6
6
 
7
- #include "src/storage/statistics/list_statistics.cpp"
7
+ #include "src/storage/statistics/list_stats.cpp"
8
8
 
9
- #include "src/storage/statistics/numeric_statistics.cpp"
9
+ #include "src/storage/statistics/numeric_stats.cpp"
10
10
 
11
11
  #include "src/storage/statistics/segment_statistics.cpp"
12
12
 
13
- #include "src/storage/statistics/string_statistics.cpp"
13
+ #include "src/storage/statistics/string_stats.cpp"
14
14
 
15
- #include "src/storage/statistics/struct_statistics.cpp"
16
-
17
- #include "src/storage/statistics/validity_statistics.cpp"
15
+ #include "src/storage/statistics/struct_stats.cpp"
18
16
 
@@ -1,59 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/main/loadable_extension.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #if defined(DUCKDB_BUILD_LOADABLE_EXTENSION) && defined(DUCKDB_EXTENSION_MAIN)
12
- #if defined(_WIN32) || defined(_WIN64)
13
- #ifndef NOMINMAX
14
- #define NOMINMAX
15
- #endif
16
-
17
- #ifndef _WINSOCKAPI_
18
- #define _WINSOCKAPI_
19
- #endif
20
- #include <windows.h>
21
-
22
- #undef CreateDirectory
23
- #undef MoveFile
24
- #undef RemoveDirectory
25
-
26
- #include <delayimp.h>
27
-
28
- extern "C" {
29
- /*
30
- This is interesting: Windows would normally require a duckdb.dll being on the DLL search path when we load an extension
31
- using LoadLibrary(). However, there is likely no such dll, because DuckDB was statically linked, or is running as part
32
- of an R or Python module with a completely different name (that we don't know) or something of the sorts. Amazingly,
33
- Windows supports lazy-loading DLLs by linking them with /DELAYLOAD. Then a callback will be triggered whenever we access
34
- symbols in the extension. Since DuckDB is already running in the host process (hopefully), we can use
35
- GetModuleHandle(NULL) to return the current process so the symbols are looked for there. See here for another
36
- explanation of this crazy process:
37
-
38
- * https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-160
39
- * https://docs.microsoft.com/en-us/cpp/build/reference/understanding-the-helper-function?view=msvc-160
40
- */
41
- FARPROC WINAPI duckdb_dllimport_delay_hook(unsigned dliNotify, PDelayLoadInfo pdli) {
42
- switch (dliNotify) {
43
- case dliNotePreLoadLibrary:
44
- if (strcmp(pdli->szDll, "duckdb.dll") != 0) {
45
- return NULL;
46
- }
47
- return (FARPROC)GetModuleHandle(NULL);
48
- default:
49
- return NULL;
50
- }
51
-
52
- return NULL;
53
- }
54
-
55
- ExternC const PfnDliHook __pfnDliNotifyHook2 = duckdb_dllimport_delay_hook;
56
- ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook;
57
- }
58
- #endif
59
- #endif
@@ -1,36 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/storage/statistics/list_statistics.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #include "duckdb/storage/statistics/base_statistics.hpp"
12
- #include "duckdb/common/enums/filter_propagate_result.hpp"
13
- #include "duckdb/storage/statistics/validity_statistics.hpp"
14
-
15
- namespace duckdb {
16
- class Value;
17
-
18
- class ListStatistics : public BaseStatistics {
19
- public:
20
- explicit ListStatistics(LogicalType type);
21
-
22
- unique_ptr<BaseStatistics> child_stats;
23
-
24
- public:
25
- void Merge(const BaseStatistics &other) override;
26
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
27
-
28
- unique_ptr<BaseStatistics> Copy() const override;
29
- void Serialize(FieldWriter &serializer) const override;
30
- static unique_ptr<BaseStatistics> Deserialize(FieldReader &source, LogicalType type);
31
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
32
-
33
- string ToString() const override;
34
- };
35
-
36
- } // namespace duckdb
@@ -1,75 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/storage/statistics/numeric_statistics.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #include "duckdb/storage/statistics/base_statistics.hpp"
12
- #include "duckdb/storage/statistics/segment_statistics.hpp"
13
- #include "duckdb/storage/statistics/validity_statistics.hpp"
14
- #include "duckdb/common/serializer.hpp"
15
- #include "duckdb/common/limits.hpp"
16
- #include "duckdb/common/exception.hpp"
17
- #include "duckdb/common/string_util.hpp"
18
- #include "duckdb/common/types/value.hpp"
19
- #include "duckdb/common/windows_undefs.hpp"
20
- #include "duckdb/common/enums/filter_propagate_result.hpp"
21
-
22
- namespace duckdb {
23
-
24
- class NumericStatistics : public BaseStatistics {
25
- public:
26
- DUCKDB_API explicit NumericStatistics(LogicalType type, StatisticsType stats_type);
27
- DUCKDB_API NumericStatistics(LogicalType type, Value min, Value max, StatisticsType stats_type);
28
-
29
- //! The minimum value of the segment
30
- Value min;
31
- //! The maximum value of the segment
32
- Value max;
33
-
34
- public:
35
- DUCKDB_API void Merge(const BaseStatistics &other) override;
36
-
37
- DUCKDB_API bool IsConstant() const override;
38
-
39
- DUCKDB_API FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
40
-
41
- unique_ptr<BaseStatistics> Copy() const override;
42
- void Serialize(FieldWriter &writer) const override;
43
- static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
44
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
45
-
46
- string ToString() const override;
47
-
48
- private:
49
- template <class T>
50
- void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count) const;
51
-
52
- public:
53
- template <class T>
54
- static inline void UpdateValue(T new_value, T &min, T &max) {
55
- if (LessThan::Operation(new_value, min)) {
56
- min = new_value;
57
- }
58
- if (GreaterThan::Operation(new_value, max)) {
59
- max = new_value;
60
- }
61
- }
62
-
63
- template <class T>
64
- static inline void Update(SegmentStatistics &stats, T new_value) {
65
- auto &nstats = (NumericStatistics &)*stats.statistics;
66
- UpdateValue<T>(new_value, nstats.min.GetReferenceUnsafe<T>(), nstats.max.GetReferenceUnsafe<T>());
67
- }
68
- };
69
-
70
- template <>
71
- void NumericStatistics::Update<interval_t>(SegmentStatistics &stats, interval_t new_value);
72
- template <>
73
- void NumericStatistics::Update<list_entry_t>(SegmentStatistics &stats, list_entry_t new_value);
74
-
75
- } // namespace duckdb
@@ -1,49 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/storage/statistics/string_statistics.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #include "duckdb/storage/statistics/base_statistics.hpp"
12
- #include "duckdb/common/enums/filter_propagate_result.hpp"
13
- #include "duckdb/storage/statistics/validity_statistics.hpp"
14
-
15
- namespace duckdb {
16
-
17
- class StringStatistics : public BaseStatistics {
18
- public:
19
- constexpr static uint32_t MAX_STRING_MINMAX_SIZE = 8;
20
-
21
- public:
22
- DUCKDB_API explicit StringStatistics(LogicalType type, StatisticsType stats_type);
23
-
24
- //! The minimum value of the segment, potentially truncated
25
- data_t min[MAX_STRING_MINMAX_SIZE];
26
- //! The maximum value of the segment, potentially truncated
27
- data_t max[MAX_STRING_MINMAX_SIZE];
28
- //! Whether or not the column can contain unicode characters
29
- bool has_unicode;
30
- //! The maximum string length in bytes
31
- uint32_t max_string_length;
32
- //! Whether or not the segment contains any big strings in overflow blocks
33
- bool has_overflow_strings;
34
-
35
- public:
36
- DUCKDB_API void Update(const string_t &value);
37
- DUCKDB_API void Merge(const BaseStatistics &other) override;
38
-
39
- unique_ptr<BaseStatistics> Copy() const override;
40
- void Serialize(FieldWriter &writer) const override;
41
- static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
42
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
43
-
44
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value) const;
45
-
46
- string ToString() const override;
47
- };
48
-
49
- } // namespace duckdb
@@ -1,36 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/storage/statistics/struct_statistics.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #include "duckdb/storage/statistics/base_statistics.hpp"
12
- #include "duckdb/common/enums/filter_propagate_result.hpp"
13
- #include "duckdb/storage/statistics/validity_statistics.hpp"
14
-
15
- namespace duckdb {
16
- class Value;
17
-
18
- class StructStatistics : public BaseStatistics {
19
- public:
20
- explicit StructStatistics(LogicalType type);
21
-
22
- vector<unique_ptr<BaseStatistics>> child_stats;
23
-
24
- public:
25
- void Merge(const BaseStatistics &other) override;
26
- FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
27
-
28
- unique_ptr<BaseStatistics> Copy() const override;
29
- void Serialize(FieldWriter &writer) const override;
30
- static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
31
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
32
-
33
- string ToString() const override;
34
- };
35
-
36
- } // namespace duckdb
@@ -1,45 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/storage/statistics/validity_statistics.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- #include "duckdb/storage/statistics/base_statistics.hpp"
12
-
13
- namespace duckdb {
14
- class Serializer;
15
- class Deserializer;
16
- class Vector;
17
-
18
- class ValidityStatistics : public BaseStatistics {
19
- public:
20
- DUCKDB_API explicit ValidityStatistics(bool has_null = false, bool has_no_null = true);
21
-
22
- //! Whether or not the segment can contain NULL values
23
- bool has_null;
24
- //! Whether or not the segment can contain values that are not null
25
- bool has_no_null;
26
-
27
- public:
28
- DUCKDB_API void Merge(const BaseStatistics &other) override;
29
-
30
- DUCKDB_API bool IsConstant() const override;
31
-
32
- unique_ptr<BaseStatistics> Copy() const override;
33
-
34
- void Serialize(FieldWriter &writer) const override;
35
- static unique_ptr<ValidityStatistics> Deserialize(FieldReader &reader);
36
-
37
- void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
38
-
39
- static unique_ptr<BaseStatistics> Combine(const unique_ptr<BaseStatistics> &lstats,
40
- const unique_ptr<BaseStatistics> &rstats);
41
-
42
- string ToString() const override;
43
- };
44
-
45
- } // namespace duckdb
@@ -1,55 +0,0 @@
1
- #include "duckdb/parser/parsed_data/alter_function_info.hpp"
2
-
3
- #include "duckdb/common/field_writer.hpp"
4
- #include "duckdb/parser/constraint.hpp"
5
-
6
- namespace duckdb {
7
-
8
- //===--------------------------------------------------------------------===//
9
- // AlterFunctionInfo
10
- //===--------------------------------------------------------------------===//
11
- AlterFunctionInfo::AlterFunctionInfo(AlterFunctionType type, AlterEntryData data)
12
- : AlterInfo(AlterType::ALTER_FUNCTION, std::move(data.catalog), std::move(data.schema), std::move(data.name),
13
- data.if_exists),
14
- alter_function_type(type) {
15
- }
16
- AlterFunctionInfo::~AlterFunctionInfo() {
17
- }
18
-
19
- CatalogType AlterFunctionInfo::GetCatalogType() const {
20
- return CatalogType::SCALAR_FUNCTION_ENTRY;
21
- }
22
-
23
- void AlterFunctionInfo::Serialize(FieldWriter &writer) const {
24
- writer.WriteField<AlterFunctionType>(alter_function_type);
25
- writer.WriteString(catalog);
26
- writer.WriteString(schema);
27
- writer.WriteString(name);
28
- writer.WriteField(if_exists);
29
- }
30
-
31
- unique_ptr<AlterInfo> AlterFunctionInfo::Deserialize(FieldReader &reader) {
32
- // auto type = reader.ReadRequired<AlterFunctionType>();
33
- // auto schema = reader.ReadRequired<string>();
34
- // auto table = reader.ReadRequired<string>();
35
- // auto if_exists = reader.ReadRequired<bool>();
36
-
37
- throw NotImplementedException("AlterFunctionInfo cannot be deserialized");
38
- }
39
-
40
- //===--------------------------------------------------------------------===//
41
- // AddFunctionOverloadInfo
42
- //===--------------------------------------------------------------------===//
43
- AddFunctionOverloadInfo::AddFunctionOverloadInfo(AlterEntryData data, ScalarFunctionSet new_overloads_p)
44
- : AlterFunctionInfo(AlterFunctionType::ADD_FUNCTION_OVERLOADS, std::move(data)),
45
- new_overloads(std::move(new_overloads_p)) {
46
- this->allow_internal = true;
47
- }
48
- AddFunctionOverloadInfo::~AddFunctionOverloadInfo() {
49
- }
50
-
51
- unique_ptr<AlterInfo> AddFunctionOverloadInfo::Copy() const {
52
- return make_unique_base<AlterInfo, AddFunctionOverloadInfo>(GetAlterEntryData(), new_overloads);
53
- }
54
-
55
- } // namespace duckdb
@@ -1,94 +0,0 @@
1
- #include "duckdb/storage/statistics/list_statistics.hpp"
2
-
3
- #include "duckdb/common/field_writer.hpp"
4
- #include "duckdb/common/string_util.hpp"
5
- #include "duckdb/common/types/vector.hpp"
6
-
7
- namespace duckdb {
8
-
9
- ListStatistics::ListStatistics(LogicalType type_p) : BaseStatistics(std::move(type_p), StatisticsType::LOCAL_STATS) {
10
- D_ASSERT(type.InternalType() == PhysicalType::LIST);
11
- InitializeBase();
12
- auto &child_type = ListType::GetChildType(type);
13
- child_stats = BaseStatistics::CreateEmpty(child_type, StatisticsType::LOCAL_STATS);
14
- }
15
-
16
- void ListStatistics::Merge(const BaseStatistics &other_p) {
17
- BaseStatistics::Merge(other_p);
18
-
19
- auto &other = (const ListStatistics &)other_p;
20
- if (child_stats && other.child_stats) {
21
- child_stats->Merge(*other.child_stats);
22
- } else {
23
- child_stats.reset();
24
- }
25
- }
26
-
27
- // LCOV_EXCL_START
28
- FilterPropagateResult ListStatistics::CheckZonemap(ExpressionType comparison_type, const Value &constant) const {
29
- throw InternalException("List zonemaps are not supported yet");
30
- }
31
- // LCOV_EXCL_STOP
32
-
33
- unique_ptr<BaseStatistics> ListStatistics::Copy() const {
34
- auto result = make_unique<ListStatistics>(type);
35
- result->CopyBase(*this);
36
-
37
- result->child_stats = child_stats ? child_stats->Copy() : nullptr;
38
- return std::move(result);
39
- }
40
-
41
- void ListStatistics::Serialize(FieldWriter &writer) const {
42
- writer.WriteSerializable(*child_stats);
43
- }
44
-
45
- unique_ptr<BaseStatistics> ListStatistics::Deserialize(FieldReader &reader, LogicalType type) {
46
- D_ASSERT(type.InternalType() == PhysicalType::LIST);
47
- auto result = make_unique<ListStatistics>(std::move(type));
48
- auto &child_type = ListType::GetChildType(result->type);
49
- result->child_stats = reader.ReadRequiredSerializable<BaseStatistics>(child_type);
50
- return std::move(result);
51
- }
52
-
53
- string ListStatistics::ToString() const {
54
- return StringUtil::Format("[%s]%s", child_stats ? child_stats->ToString() : "No Stats", BaseStatistics::ToString());
55
- }
56
-
57
- void ListStatistics::Verify(Vector &vector, const SelectionVector &sel, idx_t count) const {
58
- BaseStatistics::Verify(vector, sel, count);
59
-
60
- if (child_stats) {
61
- auto &child_entry = ListVector::GetEntry(vector);
62
- UnifiedVectorFormat vdata;
63
- vector.ToUnifiedFormat(count, vdata);
64
-
65
- auto list_data = (list_entry_t *)vdata.data;
66
- idx_t total_list_count = 0;
67
- for (idx_t i = 0; i < count; i++) {
68
- auto idx = sel.get_index(i);
69
- auto index = vdata.sel->get_index(idx);
70
- auto list = list_data[index];
71
- if (vdata.validity.RowIsValid(index)) {
72
- for (idx_t list_idx = 0; list_idx < list.length; list_idx++) {
73
- total_list_count++;
74
- }
75
- }
76
- }
77
- SelectionVector list_sel(total_list_count);
78
- idx_t list_count = 0;
79
- for (idx_t i = 0; i < count; i++) {
80
- auto idx = sel.get_index(i);
81
- auto index = vdata.sel->get_index(idx);
82
- auto list = list_data[index];
83
- if (vdata.validity.RowIsValid(index)) {
84
- for (idx_t list_idx = 0; list_idx < list.length; list_idx++) {
85
- list_sel.set_index(list_count++, list.offset + list_idx);
86
- }
87
- }
88
- }
89
-
90
- child_stats->Verify(child_entry, list_sel, list_count);
91
- }
92
- }
93
-
94
- } // namespace duckdb