duckdb 1.1.2-dev2.0 → 1.1.2-dev6.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 (289) hide show
  1. package/binding.gyp +4 -2
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/third_party/icu/common/putil.cpp +0 -5
  4. package/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp +1 -1
  5. package/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp +1 -1
  6. package/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp +1 -1
  7. package/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp +1 -1
  8. package/src/duckdb/extension/icu/third_party/icu/common/uresimp.h +31 -31
  9. package/src/duckdb/extension/icu/third_party/icu/common/ustring.cpp +1 -1
  10. package/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +1 -1
  11. package/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +12 -12
  12. package/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +1 -1
  13. package/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp +4 -4
  14. package/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h +1 -1
  15. package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp +1 -1
  16. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coleitr.h +28 -28
  17. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/format.h +7 -7
  18. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucol.h +1 -1
  19. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucoleitr.h +41 -41
  20. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/umsg.h +41 -41
  21. package/src/duckdb/extension/icu/third_party/icu/i18n/usrchimp.h +3 -3
  22. package/src/duckdb/extension/json/include/json_common.hpp +1 -1
  23. package/src/duckdb/extension/json/json_functions/json_structure.cpp +13 -7
  24. package/src/duckdb/extension/parquet/column_writer.cpp +2 -1
  25. package/src/duckdb/extension/parquet/geo_parquet.cpp +24 -9
  26. package/src/duckdb/extension/parquet/include/geo_parquet.hpp +3 -1
  27. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +1 -0
  28. package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -1
  29. package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +0 -4
  30. package/src/duckdb/extension/parquet/parquet_extension.cpp +20 -6
  31. package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -2
  32. package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -1
  33. package/src/duckdb/extension/parquet/serialize_parquet.cpp +0 -2
  34. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +8 -1
  35. package/src/duckdb/src/catalog/default/default_functions.cpp +5 -5
  36. package/src/duckdb/src/common/allocator.cpp +3 -2
  37. package/src/duckdb/src/common/arrow/arrow_appender.cpp +1 -0
  38. package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -0
  39. package/src/duckdb/src/common/arrow/schema_metadata.cpp +6 -4
  40. package/src/duckdb/src/common/enum_util.cpp +33 -0
  41. package/src/duckdb/src/common/exception.cpp +3 -0
  42. package/src/duckdb/src/common/extra_type_info.cpp +1 -44
  43. package/src/duckdb/src/common/field_writer.cpp +97 -0
  44. package/src/duckdb/src/common/render_tree.cpp +7 -5
  45. package/src/duckdb/src/common/row_operations/row_match.cpp +359 -0
  46. package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +27 -0
  47. package/src/duckdb/src/common/serializer/buffered_serializer.cpp +36 -0
  48. package/src/duckdb/src/common/serializer/format_serializer.cpp +15 -0
  49. package/src/duckdb/src/common/serializer.cpp +24 -0
  50. package/src/duckdb/src/common/sort/comparators.cpp +2 -2
  51. package/src/duckdb/src/common/types/bit.cpp +57 -34
  52. package/src/duckdb/src/common/types/data_chunk.cpp +32 -29
  53. package/src/duckdb/src/common/types/vector_cache.cpp +12 -6
  54. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +14 -0
  55. package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +20 -1
  56. package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +2 -2
  57. package/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp +32 -7
  58. package/src/duckdb/src/core_functions/function_list.cpp +1 -2
  59. package/src/duckdb/src/core_functions/scalar/bit/bitstring.cpp +23 -5
  60. package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +12 -6
  61. package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +1 -1
  62. package/src/duckdb/src/execution/expression_executor/execute_between.cpp +4 -3
  63. package/src/duckdb/src/execution/expression_executor/execute_case.cpp +4 -3
  64. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -1
  65. package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +3 -2
  66. package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +2 -1
  67. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +2 -1
  68. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +3 -2
  69. package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
  70. package/src/duckdb/src/execution/expression_executor.cpp +9 -3
  71. package/src/duckdb/src/execution/expression_executor_state.cpp +11 -9
  72. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +238 -0
  73. package/src/duckdb/src/execution/index/art/plan_art.cpp +94 -0
  74. package/src/duckdb/src/execution/index/index_type_set.cpp +4 -1
  75. package/src/duckdb/src/execution/join_hashtable.cpp +7 -8
  76. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +6 -4
  77. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +4 -4
  78. package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +1 -1
  79. package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +44 -5
  80. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +28 -24
  81. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +25 -26
  82. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +5 -3
  83. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +4 -4
  84. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +2 -2
  85. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +1 -1
  86. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +1 -1
  87. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +1 -1
  88. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +2 -2
  89. package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +1 -1
  90. package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +1 -1
  91. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +73 -27
  92. package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +1 -1
  93. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +695 -0
  94. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1487 -0
  95. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +72 -0
  96. package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +158 -0
  97. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +280 -0
  98. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +666 -0
  99. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +14 -4
  100. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +207 -0
  101. package/src/duckdb/src/execution/partitionable_hashtable.cpp +207 -0
  102. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +6 -1
  103. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +0 -4
  104. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +14 -87
  105. package/src/duckdb/src/execution/physical_plan/plan_export.cpp +1 -1
  106. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +1 -1
  107. package/src/duckdb/src/execution/reservoir_sample.cpp +1 -1
  108. package/src/duckdb/src/execution/window_executor.cpp +3 -3
  109. package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
  110. package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -2
  111. package/src/duckdb/src/function/scalar/string/concat.cpp +118 -151
  112. package/src/duckdb/src/function/table/arrow.cpp +13 -0
  113. package/src/duckdb/src/function/table/arrow_conversion.cpp +12 -7
  114. package/src/duckdb/src/function/table/copy_csv.cpp +1 -1
  115. package/src/duckdb/src/function/table/read_csv.cpp +2 -30
  116. package/src/duckdb/src/function/table/sniff_csv.cpp +2 -1
  117. package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +15 -7
  118. package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
  119. package/src/duckdb/src/include/duckdb/catalog/catalog_entry_retriever.hpp +1 -1
  120. package/src/duckdb/src/include/duckdb/common/atomic.hpp +13 -1
  121. package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +3 -4
  122. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +8 -0
  123. package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +2 -0
  124. package/src/duckdb/src/include/duckdb/common/exception.hpp +10 -0
  125. package/src/duckdb/src/include/duckdb/common/extra_type_info/enum_type_info.hpp +53 -0
  126. package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +5 -5
  127. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -0
  128. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +36 -33
  129. package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +10 -13
  130. package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +1 -1
  131. package/src/duckdb/src/include/duckdb/common/types/vector_cache.hpp +7 -5
  132. package/src/duckdb/src/include/duckdb/common/windows_undefs.hpp +2 -1
  133. package/src/duckdb/src/include/duckdb/core_functions/aggregate/minmax_n_helpers.hpp +2 -0
  134. package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +1 -1
  135. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +0 -6
  136. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +1 -1
  137. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +3 -2
  138. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +3 -0
  139. package/src/duckdb/src/include/duckdb/execution/index/index_type.hpp +16 -1
  140. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +4 -4
  141. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +4 -2
  142. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +3 -2
  143. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +91 -36
  144. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/sniff_result.hpp +36 -0
  145. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +1 -1
  146. package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +0 -1
  147. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -5
  148. package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
  149. package/src/duckdb/src/include/duckdb/main/database.hpp +5 -0
  150. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
  151. package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +20 -22
  152. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +7 -9
  153. package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +8 -1
  154. package/src/duckdb/src/include/duckdb/main/table_description.hpp +14 -0
  155. package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +5 -5
  156. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +15 -5
  157. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
  158. package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +4 -0
  159. package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +10 -13
  160. package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +1 -0
  161. package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +2 -2
  162. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +1 -1
  163. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +0 -2
  164. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +1 -0
  165. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +5 -1
  166. package/src/duckdb/src/include/duckdb.h +2 -2
  167. package/src/duckdb/src/main/appender.cpp +3 -0
  168. package/src/duckdb/src/main/capi/profiling_info-c.cpp +5 -2
  169. package/src/duckdb/src/main/client_context.cpp +8 -2
  170. package/src/duckdb/src/main/connection.cpp +1 -1
  171. package/src/duckdb/src/main/database.cpp +13 -0
  172. package/src/duckdb/src/main/extension/extension_helper.cpp +1 -1
  173. package/src/duckdb/src/main/extension/extension_install.cpp +9 -1
  174. package/src/duckdb/src/main/extension/extension_load.cpp +3 -2
  175. package/src/duckdb/src/main/extension_install_info.cpp +1 -1
  176. package/src/duckdb/src/main/profiling_info.cpp +78 -58
  177. package/src/duckdb/src/main/query_profiler.cpp +79 -89
  178. package/src/duckdb/src/main/relation/read_csv_relation.cpp +1 -1
  179. package/src/duckdb/src/main/secret/secret.cpp +2 -1
  180. package/src/duckdb/src/main/secret/secret_manager.cpp +14 -0
  181. package/src/duckdb/src/optimizer/cte_filter_pusher.cpp +4 -2
  182. package/src/duckdb/src/optimizer/deliminator.cpp +0 -7
  183. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +7 -0
  184. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +4 -1
  185. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +21 -21
  186. package/src/duckdb/src/parallel/task_scheduler.cpp +9 -0
  187. package/src/duckdb/src/parser/parsed_data/exported_table_data.cpp +22 -0
  188. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +3 -0
  189. package/src/duckdb/src/parser/statement/insert_statement.cpp +7 -1
  190. package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +1 -1
  191. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +89 -87
  192. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -2
  193. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +4 -9
  194. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +4 -0
  195. package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +2 -2
  196. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +4 -1
  197. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +4 -3
  198. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +13 -3
  199. package/src/duckdb/src/planner/expression_binder.cpp +1 -1
  200. package/src/duckdb/src/planner/operator/logical_export.cpp +28 -0
  201. package/src/duckdb/src/planner/table_binding.cpp +1 -2
  202. package/src/duckdb/src/planner/table_filter.cpp +6 -2
  203. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +2 -1
  204. package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
  205. package/src/duckdb/src/storage/compression/bitpacking.cpp +7 -3
  206. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +1 -1
  207. package/src/duckdb/src/storage/metadata/metadata_manager.cpp +2 -2
  208. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +16 -0
  209. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +29 -0
  210. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +15 -0
  211. package/src/duckdb/src/storage/single_file_block_manager.cpp +2 -1
  212. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +3 -5
  213. package/src/duckdb/src/storage/storage_info.cpp +4 -4
  214. package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
  215. package/src/duckdb/src/storage/table/row_version_manager.cpp +5 -1
  216. package/src/duckdb/src/storage/temporary_file_manager.cpp +1 -1
  217. package/src/duckdb/src/transaction/duck_transaction.cpp +15 -14
  218. package/src/duckdb/third_party/brotli/common/brotli_platform.h +1 -1
  219. package/src/duckdb/third_party/brotli/dec/decode.cpp +1 -1
  220. package/src/duckdb/third_party/brotli/enc/memory.cpp +4 -4
  221. package/src/duckdb/third_party/fsst/libfsst.cpp +1 -1
  222. package/src/duckdb/third_party/hyperloglog/sds.cpp +1 -1
  223. package/src/duckdb/third_party/hyperloglog/sds.hpp +1 -1
  224. package/src/duckdb/third_party/libpg_query/include/common/keywords.hpp +1 -1
  225. package/src/duckdb/third_party/libpg_query/include/datatype/timestamp.hpp +1 -1
  226. package/src/duckdb/third_party/libpg_query/include/mb/pg_wchar.hpp +1 -1
  227. package/src/duckdb/third_party/libpg_query/include/nodes/bitmapset.hpp +1 -1
  228. package/src/duckdb/third_party/libpg_query/include/nodes/lockoptions.hpp +1 -1
  229. package/src/duckdb/third_party/libpg_query/include/nodes/makefuncs.hpp +1 -1
  230. package/src/duckdb/third_party/libpg_query/include/nodes/pg_list.hpp +1 -1
  231. package/src/duckdb/third_party/libpg_query/include/nodes/value.hpp +1 -1
  232. package/src/duckdb/third_party/libpg_query/include/parser/gramparse.hpp +1 -1
  233. package/src/duckdb/third_party/libpg_query/include/parser/parser.hpp +1 -1
  234. package/src/duckdb/third_party/libpg_query/include/parser/scanner.hpp +1 -1
  235. package/src/duckdb/third_party/libpg_query/include/parser/scansup.hpp +1 -1
  236. package/src/duckdb/third_party/libpg_query/include/pg_functions.hpp +1 -1
  237. package/src/duckdb/third_party/libpg_query/pg_functions.cpp +1 -1
  238. package/src/duckdb/third_party/libpg_query/src_backend_nodes_list.cpp +1 -1
  239. package/src/duckdb/third_party/libpg_query/src_backend_nodes_makefuncs.cpp +1 -1
  240. package/src/duckdb/third_party/libpg_query/src_backend_nodes_value.cpp +1 -1
  241. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +1964 -1964
  242. package/src/duckdb/third_party/libpg_query/src_backend_parser_parser.cpp +1 -1
  243. package/src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp +1 -1
  244. package/src/duckdb/third_party/libpg_query/src_common_keywords.cpp +1 -1
  245. package/src/duckdb/third_party/lz4/lz4.cpp +1 -1
  246. package/src/duckdb/third_party/mbedtls/include/des_alt.h +1 -1
  247. package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -1
  248. package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -1
  249. package/src/duckdb/third_party/mbedtls/include/mbedtls/asn1write.h +1 -1
  250. package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -1
  251. package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -1
  252. package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -1
  253. package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -1
  254. package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -1
  255. package/src/duckdb/third_party/mbedtls/include/mbedtls/config_psa.h +1 -1
  256. package/src/duckdb/third_party/mbedtls/include/mbedtls/ecdsa.h +1 -1
  257. package/src/duckdb/third_party/mbedtls/include/mbedtls/ecp.h +1 -1
  258. package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -1
  259. package/src/duckdb/third_party/mbedtls/include/mbedtls/md5.h +1 -1
  260. package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -1
  261. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs12.h +1 -1
  262. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs5.h +1 -1
  263. package/src/duckdb/third_party/mbedtls/include/mbedtls/psa_util.h +1 -1
  264. package/src/duckdb/third_party/mbedtls/include/mbedtls/ripemd160.h +1 -1
  265. package/src/duckdb/third_party/mbedtls/include/mbedtls/threading.h +1 -1
  266. package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -1
  267. package/src/duckdb/third_party/mbedtls/include/platform_alt.h +1 -1
  268. package/src/duckdb/third_party/mbedtls/include/psa/crypto.h +1 -1
  269. package/src/duckdb/third_party/mbedtls/include/rsa_alt.h +1 -1
  270. package/src/duckdb/third_party/mbedtls/include/sha1_alt.h +1 -1
  271. package/src/duckdb/third_party/mbedtls/include/sha256_alt.h +1 -1
  272. package/src/duckdb/third_party/mbedtls/include/sha512_alt.h +1 -1
  273. package/src/duckdb/third_party/mbedtls/include/ssl_misc.h +1 -1
  274. package/src/duckdb/third_party/mbedtls/library/aesni.h +1 -1
  275. package/src/duckdb/third_party/mbedtls/library/padlock.h +1 -1
  276. package/src/duckdb/third_party/miniz/miniz.cpp +1 -1
  277. package/src/duckdb/third_party/parquet/parquet_types.cpp +1 -1
  278. package/src/duckdb/third_party/parquet/windows_compatibility.h +1 -1
  279. package/src/duckdb/third_party/pcg/pcg_extras.hpp +1 -1
  280. package/src/duckdb/third_party/pcg/pcg_uint128.hpp +1 -1
  281. package/src/duckdb/third_party/skiplist/Node.h +4 -4
  282. package/src/duckdb/third_party/snappy/snappy.cc +1 -1
  283. package/src/duckdb/third_party/snappy/snappy_version.hpp +1 -1
  284. package/src/duckdb/third_party/thrift/thrift/thrift-config.h +1 -1
  285. package/src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp +1 -1
  286. package/src/duckdb/third_party/zstd/include/zstd_static.h +1 -1
  287. package/src/duckdb/ub_src_execution_index_art.cpp +2 -0
  288. package/src/duckdb/ub_src_parser_parsed_data.cpp +2 -0
  289. package/src/duckdb/ub_src_planner_operator.cpp +2 -0
@@ -71,12 +71,7 @@ vector<Value> Transformer::TransformTypeModifiers(duckdb_libpgquery::PGTypeName
71
71
  return type_mods;
72
72
  }
73
73
 
74
- LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_name) {
75
- if (type_name.type != duckdb_libpgquery::T_PGTypeName) {
76
- throw ParserException("Expected a type");
77
- }
78
- auto stack_checker = StackCheck();
79
-
74
+ LogicalType Transformer::TransformTypeNameInternal(duckdb_libpgquery::PGTypeName &type_name) {
80
75
  if (type_name.names->length > 1) {
81
76
  // qualified typename
82
77
  vector<string> names;
@@ -85,24 +80,27 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
85
80
  }
86
81
  vector<Value> type_mods = TransformTypeModifiers(type_name);
87
82
  switch (type_name.names->length) {
88
- case 2:
83
+ case 2: {
89
84
  return LogicalType::USER(INVALID_CATALOG, std::move(names[0]), std::move(names[1]), std::move(type_mods));
90
- case 3:
85
+ }
86
+ case 3: {
91
87
  return LogicalType::USER(std::move(names[0]), std::move(names[1]), std::move(names[2]),
92
88
  std::move(type_mods));
89
+ }
93
90
  default:
94
91
  throw ParserException(
95
92
  "Too many qualifications for type name - expected [catalog.schema.name] or [schema.name]");
96
93
  }
97
94
  }
95
+
98
96
  auto name = PGPointerCast<duckdb_libpgquery::PGValue>(type_name.names->tail->data.ptr_value)->val.str;
99
97
  // transform it to the SQL type
100
98
  LogicalTypeId base_type = TransformStringToLogicalTypeId(name);
101
99
 
102
- LogicalType result_type;
103
100
  if (base_type == LogicalTypeId::LIST) {
104
101
  throw ParserException("LIST is not valid as a stand-alone type");
105
- } else if (base_type == LogicalTypeId::ENUM) {
102
+ }
103
+ if (base_type == LogicalTypeId::ENUM) {
106
104
  if (!type_name.typmods || type_name.typmods->length == 0) {
107
105
  throw ParserException("Enum needs a set of entries");
108
106
  }
@@ -118,7 +116,8 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
118
116
  string_data[pos++] = StringVector::AddString(enum_vector, constant_value->val.val.str);
119
117
  }
120
118
  return LogicalType::ENUM(enum_vector, NumericCast<idx_t>(type_name.typmods->length));
121
- } else if (base_type == LogicalTypeId::STRUCT) {
119
+ }
120
+ if (base_type == LogicalTypeId::STRUCT) {
122
121
  if (!type_name.typmods || type_name.typmods->length == 0) {
123
122
  throw ParserException("Struct needs a name and entries");
124
123
  }
@@ -148,9 +147,9 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
148
147
  children.push_back(make_pair(entry_name, entry_type));
149
148
  }
150
149
  D_ASSERT(!children.empty());
151
- result_type = LogicalType::STRUCT(children);
152
-
153
- } else if (base_type == LogicalTypeId::MAP) {
150
+ return LogicalType::STRUCT(children);
151
+ }
152
+ if (base_type == LogicalTypeId::MAP) {
154
153
  if (!type_name.typmods || type_name.typmods->length != 2) {
155
154
  throw ParserException("Map type needs exactly two entries, key and value type");
156
155
  }
@@ -159,8 +158,9 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
159
158
  auto value_type =
160
159
  TransformTypeName(*PGPointerCast<duckdb_libpgquery::PGTypeName>(type_name.typmods->tail->data.ptr_value));
161
160
 
162
- result_type = LogicalType::MAP(std::move(key_type), std::move(value_type));
163
- } else if (base_type == LogicalTypeId::UNION) {
161
+ return LogicalType::MAP(std::move(key_type), std::move(value_type));
162
+ }
163
+ if (base_type == LogicalTypeId::UNION) {
164
164
  if (!type_name.typmods || type_name.typmods->length == 0) {
165
165
  throw ParserException("Union type needs at least one member");
166
166
  }
@@ -195,81 +195,83 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_n
195
195
  children.push_back(make_pair(entry_name, entry_type));
196
196
  }
197
197
  D_ASSERT(!children.empty());
198
- result_type = LogicalType::UNION(std::move(children));
199
- } else if (base_type == LogicalTypeId::USER) {
198
+ return LogicalType::UNION(std::move(children));
199
+ }
200
+ if (base_type == LogicalTypeId::USER) {
200
201
  string user_type_name {name};
201
202
  vector<Value> type_mods = TransformTypeModifiers(type_name);
202
- result_type = LogicalType::USER(user_type_name, type_mods);
203
- } else {
204
- SizeModifiers modifiers = GetSizeModifiers(type_name, base_type);
205
- switch (base_type) {
206
- case LogicalTypeId::VARCHAR:
207
- if (modifiers.count > 1) {
208
- throw ParserException("VARCHAR only supports a single modifier");
209
- }
210
- // FIXME: create CHECK constraint based on varchar width
211
- modifiers.width = 0;
212
- result_type = LogicalType::VARCHAR;
213
- break;
214
- case LogicalTypeId::DECIMAL:
215
- if (modifiers.count > 2) {
216
- throw ParserException("DECIMAL only supports a maximum of two modifiers");
217
- }
218
- if (modifiers.count == 1) {
219
- // only width is provided: set scale to 0
220
- modifiers.scale = 0;
221
- }
222
- if (modifiers.width <= 0 || modifiers.width > Decimal::MAX_WIDTH_DECIMAL) {
223
- throw ParserException("Width must be between 1 and %d!", (int)Decimal::MAX_WIDTH_DECIMAL);
224
- }
225
- if (modifiers.scale > modifiers.width) {
226
- throw ParserException("Scale cannot be bigger than width");
227
- }
228
- result_type =
229
- LogicalType::DECIMAL(NumericCast<uint8_t>(modifiers.width), NumericCast<uint8_t>(modifiers.scale));
230
- break;
231
- case LogicalTypeId::INTERVAL:
232
- if (modifiers.count > 1) {
233
- throw ParserException("INTERVAL only supports a single modifier");
234
- }
235
- modifiers.width = 0;
236
- result_type = LogicalType::INTERVAL;
237
- break;
238
- case LogicalTypeId::BIT:
239
- if (!modifiers.width && type_name.typmods) {
240
- throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString());
241
- }
242
- result_type = LogicalType(base_type);
243
- break;
244
- case LogicalTypeId::TIMESTAMP:
245
- if (modifiers.count == 0) {
246
- result_type = LogicalType::TIMESTAMP;
247
- } else {
248
- if (modifiers.count > 1) {
249
- throw ParserException("TIMESTAMP only supports a single modifier");
250
- }
251
- if (modifiers.width > 10) {
252
- throw ParserException("TIMESTAMP only supports until nano-second precision (9)");
253
- }
254
- if (modifiers.width == 0) {
255
- result_type = LogicalType::TIMESTAMP_S;
256
- } else if (modifiers.width <= 3) {
257
- result_type = LogicalType::TIMESTAMP_MS;
258
- } else if (modifiers.width <= 6) {
259
- result_type = LogicalType::TIMESTAMP;
260
- } else {
261
- result_type = LogicalType::TIMESTAMP_NS;
262
- }
263
- }
264
- break;
265
- default:
266
- if (modifiers.count > 0) {
267
- throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString());
268
- }
269
- result_type = LogicalType(base_type);
270
- break;
203
+ return LogicalType::USER(user_type_name, type_mods);
204
+ }
205
+
206
+ SizeModifiers modifiers = GetSizeModifiers(type_name, base_type);
207
+ switch (base_type) {
208
+ case LogicalTypeId::VARCHAR:
209
+ if (modifiers.count > 1) {
210
+ throw ParserException("VARCHAR only supports a single modifier");
211
+ }
212
+ // FIXME: create CHECK constraint based on varchar width
213
+ modifiers.width = 0;
214
+ return LogicalType::VARCHAR;
215
+ case LogicalTypeId::DECIMAL:
216
+ if (modifiers.count > 2) {
217
+ throw ParserException("DECIMAL only supports a maximum of two modifiers");
218
+ }
219
+ if (modifiers.count == 1) {
220
+ // only width is provided: set scale to 0
221
+ modifiers.scale = 0;
222
+ }
223
+ if (modifiers.width <= 0 || modifiers.width > Decimal::MAX_WIDTH_DECIMAL) {
224
+ throw ParserException("Width must be between 1 and %d!", (int)Decimal::MAX_WIDTH_DECIMAL);
225
+ }
226
+ if (modifiers.scale > modifiers.width) {
227
+ throw ParserException("Scale cannot be bigger than width");
228
+ }
229
+ return LogicalType::DECIMAL(NumericCast<uint8_t>(modifiers.width), NumericCast<uint8_t>(modifiers.scale));
230
+ case LogicalTypeId::INTERVAL:
231
+ if (modifiers.count > 1) {
232
+ throw ParserException("INTERVAL only supports a single modifier");
233
+ }
234
+ modifiers.width = 0;
235
+ return LogicalType::INTERVAL;
236
+ case LogicalTypeId::BIT:
237
+ if (!modifiers.width && type_name.typmods) {
238
+ throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString());
239
+ }
240
+ return LogicalType(base_type);
241
+ case LogicalTypeId::TIMESTAMP:
242
+ if (modifiers.count == 0) {
243
+ return LogicalType::TIMESTAMP;
244
+ }
245
+ if (modifiers.count > 1) {
246
+ throw ParserException("TIMESTAMP only supports a single modifier");
271
247
  }
248
+ if (modifiers.width > 10) {
249
+ throw ParserException("TIMESTAMP only supports until nano-second precision (9)");
250
+ }
251
+ if (modifiers.width == 0) {
252
+ return LogicalType::TIMESTAMP_S;
253
+ }
254
+ if (modifiers.width <= 3) {
255
+ return LogicalType::TIMESTAMP_MS;
256
+ }
257
+ if (modifiers.width <= 6) {
258
+ return LogicalType::TIMESTAMP;
259
+ }
260
+ return LogicalType::TIMESTAMP_NS;
261
+ default:
262
+ if (modifiers.count > 0) {
263
+ throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString());
264
+ }
265
+ return LogicalType(base_type);
266
+ }
267
+ }
268
+
269
+ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_name) {
270
+ if (type_name.type != duckdb_libpgquery::T_PGTypeName) {
271
+ throw ParserException("Expected a type");
272
272
  }
273
+ auto stack_checker = StackCheck();
274
+ auto result_type = TransformTypeNameInternal(type_name);
273
275
  if (type_name.arrayBounds) {
274
276
  // array bounds: turn the type into a list
275
277
  idx_t extra_stack = 0;
@@ -15,6 +15,7 @@
15
15
  #include "duckdb/parser/expression/function_expression.hpp"
16
16
  #include "duckdb/parser/result_modifier.hpp"
17
17
  #include "duckdb/parser/tableref/subqueryref.hpp"
18
+ #include "duckdb/common/types/uuid.hpp"
18
19
 
19
20
  namespace duckdb {
20
21
 
@@ -168,7 +169,6 @@ unique_ptr<QueryNode> Transformer::TransformPivotStatement(duckdb_libpgquery::PG
168
169
  // generate CREATE TYPE statements for each of the columns that do not have an IN list
169
170
  bool is_pivot = !pivot->unpivots;
170
171
  auto columns = TransformPivotList(*pivot->columns, is_pivot);
171
- auto pivot_idx = PivotEntryCount();
172
172
  for (idx_t c = 0; c < columns.size(); c++) {
173
173
  auto &col = columns[c];
174
174
  if (!col.pivot_enum.empty() || !col.entries.empty()) {
@@ -177,7 +177,7 @@ unique_ptr<QueryNode> Transformer::TransformPivotStatement(duckdb_libpgquery::PG
177
177
  if (col.pivot_expressions.size() != 1) {
178
178
  throw InternalException("PIVOT statement with multiple names in pivot entry!?");
179
179
  }
180
- auto enum_name = "__pivot_enum_" + std::to_string(pivot_idx) + "_" + std::to_string(c);
180
+ auto enum_name = "__pivot_enum_" + UUID::ToString(UUID::GenerateRandomUUID());
181
181
 
182
182
  auto new_select = make_uniq<SelectNode>();
183
183
  ExtractCTEsRecursive(new_select->cte_map);
@@ -1,4 +1,5 @@
1
1
  #include "duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp"
2
+ #include "duckdb/common/enums/expression_type.hpp"
2
3
  #include "duckdb/common/reference_map.hpp"
3
4
  #include "duckdb/common/string_util.hpp"
4
5
  #include "duckdb/function/scalar_macro_function.hpp"
@@ -26,12 +27,8 @@ void ExpressionBinder::ReplaceMacroParametersInLambda(FunctionExpression &functi
26
27
 
27
28
  if (!error_message.empty()) {
28
29
  // Possibly a JSON function, replace both LHS and RHS.
29
- ParsedExpressionIterator::EnumerateChildren(*lambda_expr.lhs, [&](unique_ptr<ParsedExpression> &child) {
30
- ReplaceMacroParameters(child, lambda_params);
31
- });
32
- ParsedExpressionIterator::EnumerateChildren(*lambda_expr.expr, [&](unique_ptr<ParsedExpression> &child) {
33
- ReplaceMacroParameters(child, lambda_params);
34
- });
30
+ ReplaceMacroParameters(lambda_expr.lhs, lambda_params);
31
+ ReplaceMacroParameters(lambda_expr.expr, lambda_params);
35
32
  continue;
36
33
  }
37
34
 
@@ -43,9 +40,7 @@ void ExpressionBinder::ReplaceMacroParametersInLambda(FunctionExpression &functi
43
40
  }
44
41
 
45
42
  // Only replace in the RHS of the expression.
46
- ParsedExpressionIterator::EnumerateChildren(*lambda_expr.expr, [&](unique_ptr<ParsedExpression> &child) {
47
- ReplaceMacroParameters(child, lambda_params);
48
- });
43
+ ReplaceMacroParameters(lambda_expr.expr, lambda_params);
49
44
 
50
45
  lambda_params.pop_back();
51
46
  }
@@ -140,6 +140,7 @@ void Binder::PrepareModifiers(OrderBinder &order_binder, QueryNode &statement, B
140
140
  make_uniq<ConstantExpression>(Value::INTEGER(UnsafeNumericCast<int32_t>(1 + i))));
141
141
  }
142
142
  }
143
+ order_binder.SetQueryComponent("DISTINCT ON");
143
144
  for (auto &distinct_on_target : distinct.distinct_on_targets) {
144
145
  auto expr = BindOrderExpression(order_binder, std::move(distinct_on_target));
145
146
  if (!expr) {
@@ -147,10 +148,13 @@ void Binder::PrepareModifiers(OrderBinder &order_binder, QueryNode &statement, B
147
148
  }
148
149
  bound_distinct->target_distincts.push_back(std::move(expr));
149
150
  }
151
+ order_binder.SetQueryComponent();
152
+
150
153
  bound_modifier = std::move(bound_distinct);
151
154
  break;
152
155
  }
153
156
  case ResultModifierType::ORDER_MODIFIER: {
157
+
154
158
  auto &order = mod->Cast<OrderModifier>();
155
159
  auto bound_order = make_uniq<BoundOrderModifier>();
156
160
  auto &config = DBConfig::GetConfig(context);
@@ -52,7 +52,7 @@ unique_ptr<LogicalOperator> Binder::CastLogicalOperatorToTypes(vector<LogicalTyp
52
52
  for (auto &type : new_column_types) {
53
53
  logical_get.returned_types[type.first] = type.second;
54
54
  }
55
- return op;
55
+ return std::move(op->children[0]);
56
56
  }
57
57
  }
58
58
  }
@@ -132,7 +132,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSetOperationNode &node) {
132
132
  node.right_binder->has_unplanned_dependent_joins;
133
133
 
134
134
  // create actual logical ops for setops
135
- LogicalOperatorType logical_type;
135
+ LogicalOperatorType logical_type = LogicalOperatorType::LOGICAL_INVALID;
136
136
  switch (node.setop_type) {
137
137
  case SetOperationType::UNION:
138
138
  case SetOperationType::UNION_BY_NAME:
@@ -228,7 +228,10 @@ void Binder::BindGeneratedColumns(BoundCreateTableInfo &info) {
228
228
 
229
229
  auto bound_expression = expr_binder.Bind(expression);
230
230
  D_ASSERT(bound_expression);
231
- D_ASSERT(!bound_expression->HasSubquery());
231
+ if (bound_expression->HasSubquery()) {
232
+ throw BinderException("Failed to bind generated column '%s' because the expression contains a subquery",
233
+ col.Name());
234
+ }
232
235
  if (col.Type().id() == LogicalTypeId::ANY) {
233
236
  // Do this before changing the type, so we know it's the first time the type is set
234
237
  col.ChangeGeneratedExpressionType(bound_expression->return_type);
@@ -192,7 +192,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
192
192
  // now generate the COPY statements for each of the tables
193
193
  auto &fs = FileSystem::GetFileSystem(context);
194
194
 
195
- BoundExportData exported_tables;
195
+ auto exported_tables = make_uniq<BoundExportData>();
196
196
 
197
197
  unordered_set<string> table_name_index;
198
198
  vector<unique_ptr<LogicalOperator>> export_nodes;
@@ -245,7 +245,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
245
245
  exported_data.file_path = info->file_path;
246
246
 
247
247
  ExportedTableInfo table_info(table, std::move(exported_data), not_null_columns);
248
- exported_tables.data.push_back(table_info);
248
+ exported_tables->data.push_back(table_info);
249
249
  id++;
250
250
 
251
251
  // generate the copy statement and bind it
@@ -270,7 +270,8 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
270
270
 
271
271
  stmt.info->catalog = catalog;
272
272
  // create the export node
273
- auto export_node = make_uniq<LogicalExport>(copy_function.function, std::move(stmt.info), exported_tables);
273
+ auto export_node =
274
+ make_uniq<LogicalExport>(copy_function.function, std::move(stmt.info), std::move(exported_tables));
274
275
 
275
276
  if (child_operator) {
276
277
  export_node->children.push_back(std::move(child_operator));
@@ -61,8 +61,10 @@ optional_idx OrderBinder::TryGetProjectionReference(ParsedExpression &expr) cons
61
61
  // this is disabled by default (matching Postgres) - but we can control this with a setting
62
62
  auto &config = ClientConfig::GetConfig(binders[0].get().context);
63
63
  if (!config.order_by_non_integer_literal) {
64
- throw BinderException(expr, "ORDER BY non-integer literal has no effect.\n* SET "
65
- "order_by_non_integer_literal=true to allow this behavior.");
64
+ throw BinderException(expr,
65
+ "%s non-integer literal has no effect.\n* SET "
66
+ "order_by_non_integer_literal=true to allow this behavior.",
67
+ query_component);
66
68
  }
67
69
  break;
68
70
  }
@@ -94,6 +96,14 @@ optional_idx OrderBinder::TryGetProjectionReference(ParsedExpression &expr) cons
94
96
  return optional_idx();
95
97
  }
96
98
 
99
+ void OrderBinder::SetQueryComponent(string component) {
100
+ if (component.empty()) {
101
+ query_component = "ORDER BY";
102
+ } else {
103
+ query_component = std::move(component);
104
+ }
105
+ }
106
+
97
107
  unique_ptr<Expression> OrderBinder::BindConstant(ParsedExpression &expr) {
98
108
  auto index = TryGetProjectionReference(expr);
99
109
  if (!index.IsValid()) {
@@ -130,7 +140,7 @@ unique_ptr<Expression> OrderBinder::Bind(unique_ptr<ParsedExpression> expr) {
130
140
  break;
131
141
  }
132
142
  case ExpressionClass::PARAMETER: {
133
- throw ParameterNotAllowedException("Parameter not supported in ORDER BY clause");
143
+ throw ParameterNotAllowedException("Parameter not supported in %s clause", query_component);
134
144
  }
135
145
  case ExpressionClass::COLLATE: {
136
146
  auto &collation = expr->Cast<CollateExpression>();
@@ -169,7 +169,7 @@ static bool CombineMissingColumns(ErrorData &current, ErrorData new_error) {
169
169
  // get query location
170
170
  QueryErrorContext context;
171
171
  current_entry = current_info.find("position");
172
- new_entry = current_info.find("position");
172
+ new_entry = new_info.find("position");
173
173
  uint64_t position;
174
174
  if (current_entry != current_info.end() &&
175
175
  TryCast::Operation<string_t, uint64_t>(current_entry->second, position)) {
@@ -0,0 +1,28 @@
1
+ #include "duckdb/planner/operator/logical_export.hpp"
2
+ #include "duckdb/common/serializer/serializer.hpp"
3
+ #include "duckdb/catalog/catalog.hpp"
4
+ #include "duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp"
5
+
6
+ namespace duckdb {
7
+
8
+ LogicalExport::LogicalExport(CopyFunction function, unique_ptr<CopyInfo> copy_info,
9
+ unique_ptr<BoundExportData> exported_tables)
10
+ : LogicalOperator(LogicalOperatorType::LOGICAL_EXPORT), copy_info(std::move(copy_info)),
11
+ function(std::move(function)), exported_tables(std::move(exported_tables)) {
12
+ }
13
+
14
+ LogicalExport::LogicalExport(ClientContext &context, unique_ptr<ParseInfo> copy_info_p,
15
+ unique_ptr<ParseInfo> exported_tables_p)
16
+ : LogicalOperator(LogicalOperatorType::LOGICAL_EXPORT),
17
+ copy_info(unique_ptr_cast<ParseInfo, CopyInfo>(std::move(copy_info_p))),
18
+ function(GetCopyFunction(context, *copy_info)),
19
+ exported_tables(unique_ptr_cast<ParseInfo, BoundExportData>(std::move(exported_tables_p))) {
20
+ }
21
+
22
+ CopyFunction LogicalExport::GetCopyFunction(ClientContext &context, CopyInfo &info) {
23
+ auto &copy_entry =
24
+ Catalog::GetEntry<CopyFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.format);
25
+ return copy_entry.function;
26
+ }
27
+
28
+ } // namespace duckdb
@@ -202,8 +202,7 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
202
202
  // fetch the type of the column
203
203
  LogicalType col_type;
204
204
  if (column_index == COLUMN_IDENTIFIER_ROW_ID) {
205
- // row id: BIGINT type
206
- col_type = LogicalType::BIGINT;
205
+ col_type = LogicalType::ROW_TYPE;
207
206
  } else {
208
207
  // normal column: fetch type from base column
209
208
  col_type = types[column_index];
@@ -26,6 +26,10 @@ void TableFilterSet::PushFilter(idx_t column_index, unique_ptr<TableFilter> filt
26
26
  }
27
27
  }
28
28
 
29
+ string TableFilter::DebugToString() {
30
+ return ToString("c0");
31
+ }
32
+
29
33
  void DynamicTableFilterSet::ClearFilters(const PhysicalOperator &op) {
30
34
  lock_guard<mutex> l(lock);
31
35
  filters.erase(op);
@@ -57,7 +61,7 @@ DynamicTableFilterSet::GetFinalTableFilters(const PhysicalTableScan &scan,
57
61
  auto result = make_uniq<TableFilterSet>();
58
62
  if (existing_filters) {
59
63
  for (auto &entry : existing_filters->filters) {
60
- result->filters[entry.first] = entry.second->Copy();
64
+ result->PushFilter(entry.first, entry.second->Copy());
61
65
  }
62
66
  }
63
67
  for (auto &entry : filters) {
@@ -66,7 +70,7 @@ DynamicTableFilterSet::GetFinalTableFilters(const PhysicalTableScan &scan,
66
70
  // skip row id filters
67
71
  continue;
68
72
  }
69
- result->filters[filter.first] = filter.second->Copy();
73
+ result->PushFilter(filter.first, filter.second->Copy());
70
74
  }
71
75
  }
72
76
  if (result->filters.empty()) {
@@ -342,7 +342,8 @@ idx_t BufferPool::PurgeAgedBlocksInternal(EvictionQueue &queue, uint32_t max_age
342
342
  bool is_fresh = handle->lru_timestamp_msec >= limit && handle->lru_timestamp_msec <= now;
343
343
  purged_bytes += handle->GetMemoryUsage();
344
344
  handle->Unload();
345
- return is_fresh;
345
+ // Return false to stop iterating if the current block is_fresh
346
+ return !is_fresh;
346
347
  });
347
348
  return purged_bytes;
348
349
  }
@@ -445,7 +445,7 @@ void CheckpointReader::ReadIndex(CatalogTransaction transaction, Deserializer &d
445
445
  auto &table = schema.GetEntry(transaction, CatalogType::TABLE_ENTRY, info.table)->Cast<DuckTableEntry>();
446
446
 
447
447
  // we also need to make sure the index type is loaded
448
- // backwards compatability:
448
+ // backwards compatibility:
449
449
  // if the index type is not specified, we default to ART
450
450
  if (info.index_type.empty()) {
451
451
  info.index_type = ART::TYPE_NAME;
@@ -264,10 +264,14 @@ public:
264
264
  delta_required_bitwidth, static_cast<T>(minimum_delta), delta_offset,
265
265
  compression_buffer, compression_buffer_idx, data_ptr);
266
266
 
267
+ // FOR (frame of reference).
268
+ total_size += sizeof(T);
269
+ // Aligned bitpacking width.
270
+ total_size += AlignValue(sizeof(bitpacking_width_t));
271
+ // Delta offset.
272
+ total_size += sizeof(T);
273
+ // Compressed data size.
267
274
  total_size += BitpackingPrimitives::GetRequiredSize(compression_buffer_idx, delta_required_bitwidth);
268
- total_size += sizeof(T); // FOR value
269
- total_size += sizeof(T); // Delta offset value
270
- total_size += AlignValue(sizeof(bitpacking_width_t)); // FOR value
271
275
 
272
276
  return true;
273
277
  }
@@ -127,7 +127,7 @@ struct DictionaryCompressionStorage {
127
127
  // contains the offsets into the dictionary which are also used to determine the string lengths. Each value in the
128
128
  // dictionary gets a single unique index in the index buffer. Secondly, the selection buffer maps the tuples to an index
129
129
  // in the index buffer. The selection buffer is compressed with bitpacking. Finally, the dictionary contains simply all
130
- // the unique strings without lenghts or null termination as we can deduce the lengths from the index buffer. The
130
+ // the unique strings without lengths or null termination as we can deduce the lengths from the index buffer. The
131
131
  // addition of the selection buffer is done for two reasons: firstly, to allow the scan to emit dictionary vectors by
132
132
  // scanning the whole dictionary at once and then scanning the selection buffer for each emitted vector. Secondly, it
133
133
  // allows for efficient bitpacking compression as the selection values should remain relatively small.
@@ -50,7 +50,7 @@ MetadataHandle MetadataManager::AllocateHandle() {
50
50
  return Pin(pointer);
51
51
  }
52
52
 
53
- MetadataHandle MetadataManager::Pin(MetadataPointer pointer) {
53
+ MetadataHandle MetadataManager::Pin(const MetadataPointer &pointer) {
54
54
  D_ASSERT(pointer.index < METADATA_BLOCK_COUNT);
55
55
  auto &block = blocks[UnsafeNumericCast<int64_t>(pointer.block_index)];
56
56
 
@@ -111,7 +111,7 @@ void MetadataManager::AddAndRegisterBlock(MetadataBlock block) {
111
111
  AddBlock(std::move(block), true);
112
112
  }
113
113
 
114
- MetaBlockPointer MetadataManager::GetDiskPointer(MetadataPointer pointer, uint32_t offset) {
114
+ MetaBlockPointer MetadataManager::GetDiskPointer(const MetadataPointer &pointer, uint32_t offset) {
115
115
  idx_t block_pointer = idx_t(pointer.block_index);
116
116
  block_pointer |= idx_t(pointer.index) << 56ULL;
117
117
  return MetaBlockPointer(block_pointer, offset);
@@ -106,6 +106,9 @@ unique_ptr<LogicalOperator> LogicalOperator::Deserialize(Deserializer &deseriali
106
106
  case LogicalOperatorType::LOGICAL_EXPLAIN:
107
107
  result = LogicalExplain::Deserialize(deserializer);
108
108
  break;
109
+ case LogicalOperatorType::LOGICAL_EXPORT:
110
+ result = LogicalExport::Deserialize(deserializer);
111
+ break;
109
112
  case LogicalOperatorType::LOGICAL_EXPRESSION_GET:
110
113
  result = LogicalExpressionGet::Deserialize(deserializer);
111
114
  break;
@@ -442,6 +445,19 @@ unique_ptr<LogicalOperator> LogicalExplain::Deserialize(Deserializer &deserializ
442
445
  return std::move(result);
443
446
  }
444
447
 
448
+ void LogicalExport::Serialize(Serializer &serializer) const {
449
+ LogicalOperator::Serialize(serializer);
450
+ serializer.WritePropertyWithDefault<unique_ptr<CopyInfo>>(200, "copy_info", copy_info);
451
+ serializer.WritePropertyWithDefault<unique_ptr<BoundExportData>>(201, "exported_tables", exported_tables);
452
+ }
453
+
454
+ unique_ptr<LogicalOperator> LogicalExport::Deserialize(Deserializer &deserializer) {
455
+ auto copy_info = deserializer.ReadPropertyWithDefault<unique_ptr<ParseInfo>>(200, "copy_info");
456
+ auto exported_tables = deserializer.ReadPropertyWithDefault<unique_ptr<ParseInfo>>(201, "exported_tables");
457
+ auto result = duckdb::unique_ptr<LogicalExport>(new LogicalExport(deserializer.Get<ClientContext &>(), std::move(copy_info), std::move(exported_tables)));
458
+ return std::move(result);
459
+ }
460
+
445
461
  void LogicalExpressionGet::Serialize(Serializer &serializer) const {
446
462
  LogicalOperator::Serialize(serializer);
447
463
  serializer.WritePropertyWithDefault<idx_t>(200, "table_index", table_index);
@@ -32,6 +32,7 @@
32
32
  #include "duckdb/function/scalar/strftime_format.hpp"
33
33
  #include "duckdb/function/table/read_csv.hpp"
34
34
  #include "duckdb/common/types/interval.hpp"
35
+ #include "duckdb/parser/parsed_data/exported_table_data.hpp"
35
36
 
36
37
  namespace duckdb {
37
38
 
@@ -343,6 +344,34 @@ CommonTableExpressionMap CommonTableExpressionMap::Deserialize(Deserializer &des
343
344
  return result;
344
345
  }
345
346
 
347
+ void ExportedTableData::Serialize(Serializer &serializer) const {
348
+ serializer.WritePropertyWithDefault<string>(1, "table_name", table_name);
349
+ serializer.WritePropertyWithDefault<string>(2, "schema_name", schema_name);
350
+ serializer.WritePropertyWithDefault<string>(3, "database_name", database_name);
351
+ serializer.WritePropertyWithDefault<string>(4, "file_path", file_path);
352
+ serializer.WritePropertyWithDefault<vector<string>>(5, "not_null_columns", not_null_columns);
353
+ }
354
+
355
+ ExportedTableData ExportedTableData::Deserialize(Deserializer &deserializer) {
356
+ ExportedTableData result;
357
+ deserializer.ReadPropertyWithDefault<string>(1, "table_name", result.table_name);
358
+ deserializer.ReadPropertyWithDefault<string>(2, "schema_name", result.schema_name);
359
+ deserializer.ReadPropertyWithDefault<string>(3, "database_name", result.database_name);
360
+ deserializer.ReadPropertyWithDefault<string>(4, "file_path", result.file_path);
361
+ deserializer.ReadPropertyWithDefault<vector<string>>(5, "not_null_columns", result.not_null_columns);
362
+ return result;
363
+ }
364
+
365
+ void ExportedTableInfo::Serialize(Serializer &serializer) const {
366
+ serializer.WriteProperty<ExportedTableData>(1, "table_data", table_data);
367
+ }
368
+
369
+ ExportedTableInfo ExportedTableInfo::Deserialize(Deserializer &deserializer) {
370
+ auto table_data = deserializer.ReadProperty<ExportedTableData>(1, "table_data");
371
+ ExportedTableInfo result(deserializer.Get<ClientContext &>(), table_data);
372
+ return result;
373
+ }
374
+
346
375
  void HivePartitioningIndex::Serialize(Serializer &serializer) const {
347
376
  serializer.WritePropertyWithDefault<string>(100, "value", value);
348
377
  serializer.WritePropertyWithDefault<idx_t>(101, "index", index);