duckdb 1.1.2-dev4.0 → 1.1.3

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 (288) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/icu/third_party/icu/common/putil.cpp +0 -5
  3. package/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp +1 -1
  4. package/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp +1 -1
  5. package/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp +1 -1
  6. package/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp +1 -1
  7. package/src/duckdb/extension/icu/third_party/icu/common/uresimp.h +31 -31
  8. package/src/duckdb/extension/icu/third_party/icu/common/ustring.cpp +1 -1
  9. package/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +1 -1
  10. package/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +12 -12
  11. package/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +1 -1
  12. package/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp +4 -4
  13. package/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h +1 -1
  14. package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp +1 -1
  15. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coleitr.h +28 -28
  16. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/format.h +7 -7
  17. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucol.h +1 -1
  18. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucoleitr.h +41 -41
  19. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/umsg.h +41 -41
  20. package/src/duckdb/extension/icu/third_party/icu/i18n/usrchimp.h +3 -3
  21. package/src/duckdb/extension/json/include/json_common.hpp +1 -1
  22. package/src/duckdb/extension/json/json_functions/json_structure.cpp +13 -7
  23. package/src/duckdb/extension/parquet/column_writer.cpp +2 -1
  24. package/src/duckdb/extension/parquet/geo_parquet.cpp +24 -9
  25. package/src/duckdb/extension/parquet/include/geo_parquet.hpp +3 -1
  26. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +1 -0
  27. package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -1
  28. package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +0 -4
  29. package/src/duckdb/extension/parquet/parquet_extension.cpp +20 -6
  30. package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -2
  31. package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -1
  32. package/src/duckdb/extension/parquet/serialize_parquet.cpp +0 -2
  33. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +8 -1
  34. package/src/duckdb/src/catalog/default/default_functions.cpp +5 -5
  35. package/src/duckdb/src/common/allocator.cpp +3 -2
  36. package/src/duckdb/src/common/arrow/arrow_appender.cpp +1 -0
  37. package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -0
  38. package/src/duckdb/src/common/arrow/schema_metadata.cpp +6 -4
  39. package/src/duckdb/src/common/enum_util.cpp +33 -0
  40. package/src/duckdb/src/common/exception.cpp +3 -0
  41. package/src/duckdb/src/common/extra_type_info.cpp +1 -44
  42. package/src/duckdb/src/common/field_writer.cpp +97 -0
  43. package/src/duckdb/src/common/render_tree.cpp +7 -5
  44. package/src/duckdb/src/common/row_operations/row_match.cpp +359 -0
  45. package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +27 -0
  46. package/src/duckdb/src/common/serializer/buffered_serializer.cpp +36 -0
  47. package/src/duckdb/src/common/serializer/format_serializer.cpp +15 -0
  48. package/src/duckdb/src/common/serializer.cpp +24 -0
  49. package/src/duckdb/src/common/sort/comparators.cpp +2 -2
  50. package/src/duckdb/src/common/types/bit.cpp +57 -34
  51. package/src/duckdb/src/common/types/data_chunk.cpp +32 -29
  52. package/src/duckdb/src/common/types/vector_cache.cpp +12 -6
  53. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +14 -0
  54. package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +20 -1
  55. package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +2 -2
  56. package/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp +32 -7
  57. package/src/duckdb/src/core_functions/function_list.cpp +1 -2
  58. package/src/duckdb/src/core_functions/scalar/bit/bitstring.cpp +23 -5
  59. package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +12 -6
  60. package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +1 -1
  61. package/src/duckdb/src/execution/expression_executor/execute_between.cpp +4 -3
  62. package/src/duckdb/src/execution/expression_executor/execute_case.cpp +4 -3
  63. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -1
  64. package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +3 -2
  65. package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +2 -1
  66. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +2 -1
  67. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +3 -2
  68. package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
  69. package/src/duckdb/src/execution/expression_executor.cpp +9 -3
  70. package/src/duckdb/src/execution/expression_executor_state.cpp +11 -9
  71. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +238 -0
  72. package/src/duckdb/src/execution/index/art/plan_art.cpp +94 -0
  73. package/src/duckdb/src/execution/index/index_type_set.cpp +4 -1
  74. package/src/duckdb/src/execution/join_hashtable.cpp +7 -8
  75. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +6 -4
  76. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +4 -4
  77. package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +1 -1
  78. package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +44 -5
  79. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +28 -24
  80. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +25 -26
  81. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +5 -3
  82. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +4 -4
  83. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +2 -2
  84. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +1 -1
  85. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +1 -1
  86. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +1 -1
  87. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +2 -2
  88. package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +1 -1
  89. package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +1 -1
  90. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +73 -27
  91. package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +1 -1
  92. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +695 -0
  93. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1487 -0
  94. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +72 -0
  95. package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +158 -0
  96. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +280 -0
  97. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +666 -0
  98. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +14 -4
  99. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +207 -0
  100. package/src/duckdb/src/execution/partitionable_hashtable.cpp +207 -0
  101. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +6 -1
  102. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +0 -4
  103. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +14 -87
  104. package/src/duckdb/src/execution/physical_plan/plan_export.cpp +1 -1
  105. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +1 -1
  106. package/src/duckdb/src/execution/reservoir_sample.cpp +1 -1
  107. package/src/duckdb/src/execution/window_executor.cpp +3 -3
  108. package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
  109. package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -2
  110. package/src/duckdb/src/function/scalar/string/concat.cpp +118 -151
  111. package/src/duckdb/src/function/table/arrow.cpp +13 -0
  112. package/src/duckdb/src/function/table/arrow_conversion.cpp +12 -7
  113. package/src/duckdb/src/function/table/copy_csv.cpp +1 -1
  114. package/src/duckdb/src/function/table/read_csv.cpp +2 -30
  115. package/src/duckdb/src/function/table/sniff_csv.cpp +2 -1
  116. package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +15 -7
  117. package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
  118. package/src/duckdb/src/include/duckdb/catalog/catalog_entry_retriever.hpp +1 -1
  119. package/src/duckdb/src/include/duckdb/common/atomic.hpp +13 -1
  120. package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +3 -4
  121. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +8 -0
  122. package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +2 -0
  123. package/src/duckdb/src/include/duckdb/common/exception.hpp +10 -0
  124. package/src/duckdb/src/include/duckdb/common/extra_type_info/enum_type_info.hpp +53 -0
  125. package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +5 -5
  126. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -0
  127. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +36 -33
  128. package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +10 -13
  129. package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +1 -1
  130. package/src/duckdb/src/include/duckdb/common/types/vector_cache.hpp +7 -5
  131. package/src/duckdb/src/include/duckdb/common/windows_undefs.hpp +2 -1
  132. package/src/duckdb/src/include/duckdb/core_functions/aggregate/minmax_n_helpers.hpp +2 -0
  133. package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +1 -1
  134. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +0 -6
  135. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +1 -1
  136. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +3 -2
  137. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +3 -0
  138. package/src/duckdb/src/include/duckdb/execution/index/index_type.hpp +16 -1
  139. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +4 -4
  140. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +4 -2
  141. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +3 -2
  142. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +91 -36
  143. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/sniff_result.hpp +36 -0
  144. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +1 -1
  145. package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +0 -1
  146. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -5
  147. package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
  148. package/src/duckdb/src/include/duckdb/main/database.hpp +5 -0
  149. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
  150. package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +20 -22
  151. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +7 -9
  152. package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +8 -1
  153. package/src/duckdb/src/include/duckdb/main/table_description.hpp +14 -0
  154. package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +5 -5
  155. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +15 -5
  156. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
  157. package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +4 -0
  158. package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +10 -13
  159. package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +1 -0
  160. package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +2 -2
  161. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +1 -1
  162. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +0 -2
  163. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +1 -0
  164. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +5 -1
  165. package/src/duckdb/src/include/duckdb.h +2 -2
  166. package/src/duckdb/src/main/appender.cpp +3 -0
  167. package/src/duckdb/src/main/capi/profiling_info-c.cpp +5 -2
  168. package/src/duckdb/src/main/client_context.cpp +8 -2
  169. package/src/duckdb/src/main/connection.cpp +1 -1
  170. package/src/duckdb/src/main/database.cpp +13 -0
  171. package/src/duckdb/src/main/extension/extension_helper.cpp +1 -1
  172. package/src/duckdb/src/main/extension/extension_install.cpp +9 -1
  173. package/src/duckdb/src/main/extension/extension_load.cpp +3 -2
  174. package/src/duckdb/src/main/extension_install_info.cpp +1 -1
  175. package/src/duckdb/src/main/profiling_info.cpp +78 -58
  176. package/src/duckdb/src/main/query_profiler.cpp +79 -89
  177. package/src/duckdb/src/main/relation/read_csv_relation.cpp +1 -1
  178. package/src/duckdb/src/main/secret/secret.cpp +2 -1
  179. package/src/duckdb/src/main/secret/secret_manager.cpp +14 -0
  180. package/src/duckdb/src/optimizer/cte_filter_pusher.cpp +4 -2
  181. package/src/duckdb/src/optimizer/deliminator.cpp +0 -7
  182. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +7 -0
  183. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +4 -1
  184. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +21 -21
  185. package/src/duckdb/src/parallel/task_scheduler.cpp +9 -0
  186. package/src/duckdb/src/parser/parsed_data/exported_table_data.cpp +22 -0
  187. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +3 -0
  188. package/src/duckdb/src/parser/statement/insert_statement.cpp +7 -1
  189. package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +1 -1
  190. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +89 -87
  191. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -2
  192. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +4 -9
  193. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +4 -0
  194. package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +2 -2
  195. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +4 -1
  196. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +4 -3
  197. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +13 -3
  198. package/src/duckdb/src/planner/expression_binder.cpp +1 -1
  199. package/src/duckdb/src/planner/operator/logical_export.cpp +28 -0
  200. package/src/duckdb/src/planner/table_binding.cpp +1 -2
  201. package/src/duckdb/src/planner/table_filter.cpp +6 -2
  202. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +2 -1
  203. package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
  204. package/src/duckdb/src/storage/compression/bitpacking.cpp +7 -3
  205. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +1 -1
  206. package/src/duckdb/src/storage/metadata/metadata_manager.cpp +2 -2
  207. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +16 -0
  208. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +29 -0
  209. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +15 -0
  210. package/src/duckdb/src/storage/single_file_block_manager.cpp +2 -1
  211. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +3 -5
  212. package/src/duckdb/src/storage/storage_info.cpp +4 -4
  213. package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
  214. package/src/duckdb/src/storage/table/row_version_manager.cpp +5 -1
  215. package/src/duckdb/src/storage/temporary_file_manager.cpp +1 -1
  216. package/src/duckdb/src/transaction/duck_transaction.cpp +15 -14
  217. package/src/duckdb/third_party/brotli/common/brotli_platform.h +1 -1
  218. package/src/duckdb/third_party/brotli/dec/decode.cpp +1 -1
  219. package/src/duckdb/third_party/brotli/enc/memory.cpp +4 -4
  220. package/src/duckdb/third_party/fsst/libfsst.cpp +1 -1
  221. package/src/duckdb/third_party/hyperloglog/sds.cpp +1 -1
  222. package/src/duckdb/third_party/hyperloglog/sds.hpp +1 -1
  223. package/src/duckdb/third_party/libpg_query/include/common/keywords.hpp +1 -1
  224. package/src/duckdb/third_party/libpg_query/include/datatype/timestamp.hpp +1 -1
  225. package/src/duckdb/third_party/libpg_query/include/mb/pg_wchar.hpp +1 -1
  226. package/src/duckdb/third_party/libpg_query/include/nodes/bitmapset.hpp +1 -1
  227. package/src/duckdb/third_party/libpg_query/include/nodes/lockoptions.hpp +1 -1
  228. package/src/duckdb/third_party/libpg_query/include/nodes/makefuncs.hpp +1 -1
  229. package/src/duckdb/third_party/libpg_query/include/nodes/pg_list.hpp +1 -1
  230. package/src/duckdb/third_party/libpg_query/include/nodes/value.hpp +1 -1
  231. package/src/duckdb/third_party/libpg_query/include/parser/gramparse.hpp +1 -1
  232. package/src/duckdb/third_party/libpg_query/include/parser/parser.hpp +1 -1
  233. package/src/duckdb/third_party/libpg_query/include/parser/scanner.hpp +1 -1
  234. package/src/duckdb/third_party/libpg_query/include/parser/scansup.hpp +1 -1
  235. package/src/duckdb/third_party/libpg_query/include/pg_functions.hpp +1 -1
  236. package/src/duckdb/third_party/libpg_query/pg_functions.cpp +1 -1
  237. package/src/duckdb/third_party/libpg_query/src_backend_nodes_list.cpp +1 -1
  238. package/src/duckdb/third_party/libpg_query/src_backend_nodes_makefuncs.cpp +1 -1
  239. package/src/duckdb/third_party/libpg_query/src_backend_nodes_value.cpp +1 -1
  240. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +1964 -1964
  241. package/src/duckdb/third_party/libpg_query/src_backend_parser_parser.cpp +1 -1
  242. package/src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp +1 -1
  243. package/src/duckdb/third_party/libpg_query/src_common_keywords.cpp +1 -1
  244. package/src/duckdb/third_party/lz4/lz4.cpp +1 -1
  245. package/src/duckdb/third_party/mbedtls/include/des_alt.h +1 -1
  246. package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -1
  247. package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -1
  248. package/src/duckdb/third_party/mbedtls/include/mbedtls/asn1write.h +1 -1
  249. package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -1
  250. package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -1
  251. package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -1
  252. package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -1
  253. package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -1
  254. package/src/duckdb/third_party/mbedtls/include/mbedtls/config_psa.h +1 -1
  255. package/src/duckdb/third_party/mbedtls/include/mbedtls/ecdsa.h +1 -1
  256. package/src/duckdb/third_party/mbedtls/include/mbedtls/ecp.h +1 -1
  257. package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -1
  258. package/src/duckdb/third_party/mbedtls/include/mbedtls/md5.h +1 -1
  259. package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -1
  260. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs12.h +1 -1
  261. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs5.h +1 -1
  262. package/src/duckdb/third_party/mbedtls/include/mbedtls/psa_util.h +1 -1
  263. package/src/duckdb/third_party/mbedtls/include/mbedtls/ripemd160.h +1 -1
  264. package/src/duckdb/third_party/mbedtls/include/mbedtls/threading.h +1 -1
  265. package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -1
  266. package/src/duckdb/third_party/mbedtls/include/platform_alt.h +1 -1
  267. package/src/duckdb/third_party/mbedtls/include/psa/crypto.h +1 -1
  268. package/src/duckdb/third_party/mbedtls/include/rsa_alt.h +1 -1
  269. package/src/duckdb/third_party/mbedtls/include/sha1_alt.h +1 -1
  270. package/src/duckdb/third_party/mbedtls/include/sha256_alt.h +1 -1
  271. package/src/duckdb/third_party/mbedtls/include/sha512_alt.h +1 -1
  272. package/src/duckdb/third_party/mbedtls/include/ssl_misc.h +1 -1
  273. package/src/duckdb/third_party/mbedtls/library/aesni.h +1 -1
  274. package/src/duckdb/third_party/mbedtls/library/padlock.h +1 -1
  275. package/src/duckdb/third_party/miniz/miniz.cpp +1 -1
  276. package/src/duckdb/third_party/parquet/parquet_types.cpp +1 -1
  277. package/src/duckdb/third_party/parquet/windows_compatibility.h +1 -1
  278. package/src/duckdb/third_party/pcg/pcg_extras.hpp +1 -1
  279. package/src/duckdb/third_party/pcg/pcg_uint128.hpp +1 -1
  280. package/src/duckdb/third_party/skiplist/Node.h +4 -4
  281. package/src/duckdb/third_party/snappy/snappy.cc +1 -1
  282. package/src/duckdb/third_party/snappy/snappy_version.hpp +1 -1
  283. package/src/duckdb/third_party/thrift/thrift/thrift-config.h +1 -1
  284. package/src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp +1 -1
  285. package/src/duckdb/third_party/zstd/include/zstd_static.h +1 -1
  286. package/src/duckdb/ub_src_execution_index_art.cpp +2 -0
  287. package/src/duckdb/ub_src_parser_parsed_data.cpp +2 -0
  288. package/src/duckdb/ub_src_planner_operator.cpp +2 -0
@@ -66,7 +66,7 @@ public:
66
66
  return 0;
67
67
  }
68
68
  uint8_t ret = 1;
69
- while (((idx_t)(1u << ret) - 1) < val) {
69
+ while ((((idx_t)1u << (idx_t)ret) - 1) < val) {
70
70
  ret++;
71
71
  }
72
72
  return ret;
@@ -68,10 +68,6 @@ public:
68
68
 
69
69
  void Offsets(uint32_t *offsets, uint8_t *defines, uint64_t num_values, parquet_filter_t &filter,
70
70
  idx_t result_offset, Vector &result) override {
71
- if (!dict || dict->len == 0) {
72
- throw IOException("Parquet file is likely corrupted, cannot have dictionary offsets without seeing a "
73
- "non-empty dictionary first.");
74
- }
75
71
  if (HasDefines()) {
76
72
  OffsetsInternal<true>(*dict, offsets, defines, num_values, filter, result_offset, result);
77
73
  } else {
@@ -70,8 +70,8 @@ struct ParquetReadBindData : public TableFunctionData {
70
70
  // These come from the initial_reader, but need to be stored in case the initial_reader is removed by a filter
71
71
  idx_t initial_file_cardinality;
72
72
  idx_t initial_file_row_groups;
73
+ idx_t explicit_cardinality = 0; // can be set to inject exterior cardinality knowledge (e.g. from a data lake)
73
74
  ParquetOptions parquet_options;
74
-
75
75
  MultiFileReaderBindData reader_bind;
76
76
 
77
77
  void Initialize(shared_ptr<ParquetReader> reader) {
@@ -395,6 +395,7 @@ public:
395
395
  table_function.named_parameters["file_row_number"] = LogicalType::BOOLEAN;
396
396
  table_function.named_parameters["debug_use_openssl"] = LogicalType::BOOLEAN;
397
397
  table_function.named_parameters["compression"] = LogicalType::VARCHAR;
398
+ table_function.named_parameters["explicit_cardinality"] = LogicalType::UBIGINT;
398
399
  table_function.named_parameters["schema"] =
399
400
  LogicalType::MAP(LogicalType::INTEGER, LogicalType::STRUCT({{{"name", LogicalType::VARCHAR},
400
401
  {"type", LogicalType::VARCHAR},
@@ -545,7 +546,11 @@ public:
545
546
  result->reader_bind = result->multi_file_reader->BindReader<ParquetReader>(
546
547
  context, result->types, result->names, *result->file_list, *result, parquet_options);
547
548
  }
548
-
549
+ if (parquet_options.explicit_cardinality) {
550
+ auto file_count = result->file_list->GetTotalFileCount();
551
+ result->explicit_cardinality = parquet_options.explicit_cardinality;
552
+ result->initial_file_cardinality = result->explicit_cardinality / (file_count ? file_count : 1);
553
+ }
549
554
  if (return_types.empty()) {
550
555
  // no expected types - just copy the types
551
556
  return_types = result->types;
@@ -618,6 +623,8 @@ public:
618
623
 
619
624
  // cannot be combined with hive_partitioning=true, so we disable auto-detection
620
625
  parquet_options.file_options.auto_detect_hive_partitioning = false;
626
+ } else if (loption == "explicit_cardinality") {
627
+ parquet_options.explicit_cardinality = UBigIntValue::Get(kv.second);
621
628
  } else if (loption == "encryption_config") {
622
629
  parquet_options.encryption_config = ParquetEncryptionConfig::Create(context, kv.second);
623
630
  }
@@ -847,13 +854,15 @@ public:
847
854
 
848
855
  static unique_ptr<NodeStatistics> ParquetCardinality(ClientContext &context, const FunctionData *bind_data) {
849
856
  auto &data = bind_data->Cast<ParquetReadBindData>();
850
-
857
+ if (data.explicit_cardinality) {
858
+ return make_uniq<NodeStatistics>(data.explicit_cardinality);
859
+ }
851
860
  auto file_list_cardinality_estimate = data.file_list->GetCardinality(context);
852
861
  if (file_list_cardinality_estimate) {
853
862
  return file_list_cardinality_estimate;
854
863
  }
855
-
856
- return make_uniq<NodeStatistics>(data.initial_file_cardinality * data.file_list->GetTotalFileCount());
864
+ return make_uniq<NodeStatistics>(MaxValue(data.initial_file_cardinality, (idx_t)1) *
865
+ data.file_list->GetTotalFileCount());
857
866
  }
858
867
 
859
868
  static idx_t ParquetScanMaxThreads(ClientContext &context, const FunctionData *bind_data) {
@@ -1573,7 +1582,7 @@ static vector<unique_ptr<Expression>> ParquetWriteSelect(CopyToSelectInput &inpu
1573
1582
  // Spatial types need to be encoded into WKB when writing GeoParquet.
1574
1583
  // But dont perform this conversion if this is a EXPORT DATABASE statement
1575
1584
  if (input.copy_to_type == CopyToType::COPY_TO_FILE && type.id() == LogicalTypeId::BLOB && type.HasAlias() &&
1576
- type.GetAlias() == "GEOMETRY") {
1585
+ type.GetAlias() == "GEOMETRY" && GeoParquetFileMetadata::IsGeoParquetConversionEnabled(context)) {
1577
1586
 
1578
1587
  LogicalType wkb_blob_type(LogicalTypeId::BLOB);
1579
1588
  wkb_blob_type.SetAlias("WKB_BLOB");
@@ -1680,6 +1689,11 @@ void ParquetExtension::Load(DuckDB &db) {
1680
1689
  config.replacement_scans.emplace_back(ParquetScanReplacement);
1681
1690
  config.AddExtensionOption("binary_as_string", "In Parquet files, interpret binary data as a string.",
1682
1691
  LogicalType::BOOLEAN);
1692
+
1693
+ config.AddExtensionOption(
1694
+ "enable_geoparquet_conversion",
1695
+ "Attempt to decode/encode geometry data in/as GeoParquet files if the spatial extension is present.",
1696
+ LogicalType::BOOLEAN, Value::BOOLEAN(true));
1683
1697
  }
1684
1698
 
1685
1699
  std::string ParquetExtension::Name() {
@@ -637,8 +637,7 @@ uint32_t ParquetReader::ReadData(duckdb_apache::thrift::protocol::TProtocol &ipr
637
637
  const ParquetRowGroup &ParquetReader::GetGroup(ParquetReaderScanState &state) {
638
638
  auto file_meta_data = GetFileMetadata();
639
639
  D_ASSERT(state.current_group >= 0 && (idx_t)state.current_group < state.group_idx_list.size());
640
- D_ASSERT(state.group_idx_list[state.current_group] >= 0 &&
641
- state.group_idx_list[state.current_group] < file_meta_data->row_groups.size());
640
+ D_ASSERT(state.group_idx_list[state.current_group] < file_meta_data->row_groups.size());
642
641
  return file_meta_data->row_groups[state.group_idx_list[state.current_group]];
643
642
  }
644
643
 
@@ -466,7 +466,7 @@ void ParquetWriter::PrepareRowGroup(ColumnDataCollection &buffer, PreparedRowGro
466
466
  // Validation code adapted from Impala
467
467
  static void ValidateOffsetInFile(const string &filename, idx_t col_idx, idx_t file_length, idx_t offset,
468
468
  const string &offset_name) {
469
- if (offset < 0 || offset >= file_length) {
469
+ if (offset >= file_length) {
470
470
  throw IOException("File '%s': metadata is corrupt. Column %d has invalid "
471
471
  "%s (offset=%llu file_size=%llu).",
472
472
  filename, col_idx, offset_name, offset, file_length);
@@ -7,8 +7,6 @@
7
7
  #include "duckdb/common/serializer/deserializer.hpp"
8
8
  #include "parquet_reader.hpp"
9
9
  #include "parquet_crypto.hpp"
10
- #include "parquet_reader.hpp"
11
- #include "parquet_writer.hpp"
12
10
  #include "parquet_writer.hpp"
13
11
 
14
12
  namespace duckdb {
@@ -119,6 +119,13 @@ optional_ptr<CatalogEntry> DuckSchemaEntry::AddEntryInternal(CatalogTransaction
119
119
  // first find the set for this entry
120
120
  auto &set = GetCatalogSet(entry_type);
121
121
  dependencies.AddDependency(*this);
122
+ if (on_conflict == OnCreateConflict::IGNORE_ON_CONFLICT) {
123
+ auto old_entry = set.GetEntry(transaction, entry_name);
124
+ if (old_entry) {
125
+ return nullptr;
126
+ }
127
+ }
128
+
122
129
  if (on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT) {
123
130
  // CREATE OR REPLACE: first try to drop the entry
124
131
  auto old_entry = set.GetEntry(transaction, entry_name);
@@ -315,7 +322,7 @@ void DuckSchemaEntry::DropEntry(ClientContext &context, DropInfo &info) {
315
322
  throw InternalException("Failed to drop entry \"%s\" - entry could not be found", info.name);
316
323
  }
317
324
  if (existing_entry->type != info.type) {
318
- throw CatalogException("Existing object %s is of type %s, trying to replace with type %s", info.name,
325
+ throw CatalogException("Existing object %s is of type %s, trying to drop type %s", info.name,
319
326
  CatalogTypeToString(existing_entry->type), CatalogTypeToString(info.type));
320
327
  }
321
328
 
@@ -12,7 +12,7 @@ namespace duckdb {
12
12
  static const DefaultMacro internal_macros[] = {
13
13
  {DEFAULT_SCHEMA, "current_role", {nullptr}, {{nullptr, nullptr}}, "'duckdb'"}, // user name of current execution context
14
14
  {DEFAULT_SCHEMA, "current_user", {nullptr}, {{nullptr, nullptr}}, "'duckdb'"}, // user name of current execution context
15
- {DEFAULT_SCHEMA, "current_catalog", {nullptr}, {{nullptr, nullptr}}, "current_database()"}, // name of current database (called "catalog" in the SQL standard)
15
+ {DEFAULT_SCHEMA, "current_catalog", {nullptr}, {{nullptr, nullptr}}, "main.current_database()"}, // name of current database (called "catalog" in the SQL standard)
16
16
  {DEFAULT_SCHEMA, "user", {nullptr}, {{nullptr, nullptr}}, "current_user"}, // equivalent to current_user
17
17
  {DEFAULT_SCHEMA, "session_user", {nullptr}, {{nullptr, nullptr}}, "'duckdb'"}, // session user name
18
18
  {"pg_catalog", "inet_client_addr", {nullptr}, {{nullptr, nullptr}}, "NULL"}, // address of the remote connection
@@ -27,10 +27,10 @@ static const DefaultMacro internal_macros[] = {
27
27
 
28
28
  {"pg_catalog", "pg_typeof", {"expression", nullptr}, {{nullptr, nullptr}}, "lower(typeof(expression))"}, // get the data type of any value
29
29
 
30
- {"pg_catalog", "current_database", {nullptr}, {{nullptr, nullptr}}, "current_database()"}, // name of current database (called "catalog" in the SQL standard)
31
- {"pg_catalog", "current_query", {nullptr}, {{nullptr, nullptr}}, "current_query()"}, // the currently executing query (NULL if not inside a plpgsql function)
32
- {"pg_catalog", "current_schema", {nullptr}, {{nullptr, nullptr}}, "current_schema()"}, // name of current schema
33
- {"pg_catalog", "current_schemas", {"include_implicit"}, {{nullptr, nullptr}}, "current_schemas(include_implicit)"}, // names of schemas in search path
30
+ {"pg_catalog", "current_database", {nullptr}, {{nullptr, nullptr}}, "main.current_database()"}, // name of current database (called "catalog" in the SQL standard)
31
+ {"pg_catalog", "current_query", {nullptr}, {{nullptr, nullptr}}, "main.current_query()"}, // the currently executing query (NULL if not inside a plpgsql function)
32
+ {"pg_catalog", "current_schema", {nullptr}, {{nullptr, nullptr}}, "main.current_schema()"}, // name of current schema
33
+ {"pg_catalog", "current_schemas", {"include_implicit"}, {{nullptr, nullptr}}, "main.current_schemas(include_implicit)"}, // names of schemas in search path
34
34
 
35
35
  // privilege functions
36
36
  {"pg_catalog", "has_any_column_privilege", {"table", "privilege", nullptr}, {{nullptr, nullptr}}, "true"}, //boolean //does current user have privilege for any column of table
@@ -242,12 +242,13 @@ static void MallocTrim(idx_t pad) {
242
242
  static atomic<int64_t> LAST_TRIM_TIMESTAMP_MS {0};
243
243
 
244
244
  int64_t last_trim_timestamp_ms = LAST_TRIM_TIMESTAMP_MS.load();
245
- const int64_t current_timestamp_ms = Timestamp::GetEpochMs(Timestamp::GetCurrentTimestamp());
245
+ int64_t current_timestamp_ms = Timestamp::GetEpochMs(Timestamp::GetCurrentTimestamp());
246
246
 
247
247
  if (current_timestamp_ms - last_trim_timestamp_ms < TRIM_INTERVAL_MS) {
248
248
  return; // We trimmed less than TRIM_INTERVAL_MS ago
249
249
  }
250
- if (!std::atomic_compare_exchange_weak(&LAST_TRIM_TIMESTAMP_MS, &last_trim_timestamp_ms, current_timestamp_ms)) {
250
+ if (!LAST_TRIM_TIMESTAMP_MS.compare_exchange_strong(last_trim_timestamp_ms, current_timestamp_ms,
251
+ std::memory_order_acquire, std::memory_order_relaxed)) {
251
252
  return; // Another thread has updated LAST_TRIM_TIMESTAMP_MS since we loaded it
252
253
  }
253
254
 
@@ -225,6 +225,7 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
225
225
  break;
226
226
  case LogicalTypeId::BLOB:
227
227
  case LogicalTypeId::BIT:
228
+ case LogicalTypeId::VARINT:
228
229
  if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
229
230
  InitializeAppenderForType<ArrowVarcharData<>>(append_data);
230
231
  } else {
@@ -142,6 +142,17 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
142
142
  child.metadata = root_holder.metadata_info.back().get();
143
143
  break;
144
144
  }
145
+ case LogicalTypeId::VARINT: {
146
+ if (options.arrow_offset_size == ArrowOffsetSize::LARGE) {
147
+ child.format = "Z";
148
+ } else {
149
+ child.format = "z";
150
+ }
151
+ auto schema_metadata = ArrowSchemaMetadata::MetadataFromName("duckdb.varint");
152
+ root_holder.metadata_info.emplace_back(schema_metadata.SerializeMetadata());
153
+ child.metadata = root_holder.metadata_info.back().get();
154
+ break;
155
+ }
145
156
  case LogicalTypeId::DOUBLE:
146
157
  child.format = "g";
147
158
  break;
@@ -36,7 +36,12 @@ void ArrowSchemaMetadata::AddOption(const string &key, const string &value) {
36
36
  metadata_map[key] = value;
37
37
  }
38
38
  string ArrowSchemaMetadata::GetOption(const string &key) const {
39
- return metadata_map.at(key);
39
+ auto it = metadata_map.find(key);
40
+ if (it != metadata_map.end()) {
41
+ return it->second;
42
+ } else {
43
+ return "";
44
+ }
40
45
  }
41
46
 
42
47
  string ArrowSchemaMetadata::GetExtensionName() const {
@@ -51,9 +56,6 @@ ArrowSchemaMetadata ArrowSchemaMetadata::MetadataFromName(const string &extensio
51
56
  }
52
57
 
53
58
  bool ArrowSchemaMetadata::HasExtension() {
54
- if (metadata_map.find(ARROW_EXTENSION_NAME) == metadata_map.end()) {
55
- return false;
56
- }
57
59
  auto arrow_extension = GetOption(ArrowSchemaMetadata::ARROW_EXTENSION_NAME);
58
60
  // FIXME: We are currently ignoring the ogc extensions
59
61
  return !arrow_extension.empty() && !StringUtil::StartsWith(arrow_extension, "ogc");
@@ -4394,6 +4394,10 @@ const char* EnumUtil::ToChars<MetricsType>(MetricsType value) {
4394
4394
  return "OPERATOR_ROWS_SCANNED";
4395
4395
  case MetricsType::OPERATOR_TIMING:
4396
4396
  return "OPERATOR_TIMING";
4397
+ case MetricsType::LATENCY:
4398
+ return "LATENCY";
4399
+ case MetricsType::ROWS_RETURNED:
4400
+ return "ROWS_RETURNED";
4397
4401
  case MetricsType::RESULT_SET_SIZE:
4398
4402
  return "RESULT_SET_SIZE";
4399
4403
  case MetricsType::ALL_OPTIMIZERS:
@@ -4495,6 +4499,12 @@ MetricsType EnumUtil::FromString<MetricsType>(const char *value) {
4495
4499
  if (StringUtil::Equals(value, "OPERATOR_TIMING")) {
4496
4500
  return MetricsType::OPERATOR_TIMING;
4497
4501
  }
4502
+ if (StringUtil::Equals(value, "LATENCY")) {
4503
+ return MetricsType::LATENCY;
4504
+ }
4505
+ if (StringUtil::Equals(value, "ROWS_RETURNED")) {
4506
+ return MetricsType::ROWS_RETURNED;
4507
+ }
4498
4508
  if (StringUtil::Equals(value, "RESULT_SET_SIZE")) {
4499
4509
  return MetricsType::RESULT_SET_SIZE;
4500
4510
  }
@@ -6457,6 +6467,29 @@ SecretPersistType EnumUtil::FromString<SecretPersistType>(const char *value) {
6457
6467
  throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString<SecretPersistType>", value));
6458
6468
  }
6459
6469
 
6470
+ template<>
6471
+ const char* EnumUtil::ToChars<SecretSerializationType>(SecretSerializationType value) {
6472
+ switch(value) {
6473
+ case SecretSerializationType::CUSTOM:
6474
+ return "CUSTOM";
6475
+ case SecretSerializationType::KEY_VALUE_SECRET:
6476
+ return "KEY_VALUE_SECRET";
6477
+ default:
6478
+ throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars<SecretSerializationType>", value));
6479
+ }
6480
+ }
6481
+
6482
+ template<>
6483
+ SecretSerializationType EnumUtil::FromString<SecretSerializationType>(const char *value) {
6484
+ if (StringUtil::Equals(value, "CUSTOM")) {
6485
+ return SecretSerializationType::CUSTOM;
6486
+ }
6487
+ if (StringUtil::Equals(value, "KEY_VALUE_SECRET")) {
6488
+ return SecretSerializationType::KEY_VALUE_SECRET;
6489
+ }
6490
+ throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString<SecretSerializationType>", value));
6491
+ }
6492
+
6460
6493
  template<>
6461
6494
  const char* EnumUtil::ToChars<SequenceInfo>(SequenceInfo value) {
6462
6495
  switch(value) {
@@ -292,6 +292,9 @@ PermissionException::PermissionException(const string &msg) : Exception(Exceptio
292
292
  SyntaxException::SyntaxException(const string &msg) : Exception(ExceptionType::SYNTAX, msg) {
293
293
  }
294
294
 
295
+ ExecutorException::ExecutorException(const string &msg) : Exception(ExceptionType::EXECUTOR, msg) {
296
+ }
297
+
295
298
  ConstraintException::ConstraintException(const string &msg) : Exception(ExceptionType::CONSTRAINT, msg) {
296
299
  }
297
300
 
@@ -1,4 +1,5 @@
1
1
  #include "duckdb/common/extra_type_info.hpp"
2
+ #include "duckdb/common/extra_type_info/enum_type_info.hpp"
2
3
  #include "duckdb/common/serializer/deserializer.hpp"
3
4
  #include "duckdb/common/enum_util.hpp"
4
5
  #include "duckdb/common/numeric_utils.hpp"
@@ -220,50 +221,6 @@ PhysicalType EnumTypeInfo::DictType(idx_t size) {
220
221
  }
221
222
  }
222
223
 
223
- template <class T>
224
- struct EnumTypeInfoTemplated : public EnumTypeInfo {
225
- explicit EnumTypeInfoTemplated(Vector &values_insert_order_p, idx_t size_p)
226
- : EnumTypeInfo(values_insert_order_p, size_p) {
227
- D_ASSERT(values_insert_order_p.GetType().InternalType() == PhysicalType::VARCHAR);
228
-
229
- UnifiedVectorFormat vdata;
230
- values_insert_order.ToUnifiedFormat(size_p, vdata);
231
-
232
- auto data = UnifiedVectorFormat::GetData<string_t>(vdata);
233
- for (idx_t i = 0; i < size_p; i++) {
234
- auto idx = vdata.sel->get_index(i);
235
- if (!vdata.validity.RowIsValid(idx)) {
236
- throw InternalException("Attempted to create ENUM type with NULL value");
237
- }
238
- if (values.count(data[idx]) > 0) {
239
- throw InvalidInputException("Attempted to create ENUM type with duplicate value %s",
240
- data[idx].GetString());
241
- }
242
- values[data[idx]] = UnsafeNumericCast<T>(i);
243
- }
244
- }
245
-
246
- static shared_ptr<EnumTypeInfoTemplated> Deserialize(Deserializer &deserializer, uint32_t size) {
247
- Vector values_insert_order(LogicalType::VARCHAR, size);
248
- auto strings = FlatVector::GetData<string_t>(values_insert_order);
249
-
250
- deserializer.ReadList(201, "values", [&](Deserializer::List &list, idx_t i) {
251
- strings[i] = StringVector::AddStringOrBlob(values_insert_order, list.ReadElement<string>());
252
- });
253
- return make_shared_ptr<EnumTypeInfoTemplated>(values_insert_order, size);
254
- }
255
-
256
- const string_map_t<T> &GetValues() const {
257
- return values;
258
- }
259
-
260
- EnumTypeInfoTemplated(const EnumTypeInfoTemplated &) = delete;
261
- EnumTypeInfoTemplated &operator=(const EnumTypeInfoTemplated &) = delete;
262
-
263
- private:
264
- string_map_t<T> values;
265
- };
266
-
267
224
  EnumTypeInfo::EnumTypeInfo(Vector &values_insert_order_p, idx_t dict_size_p)
268
225
  : ExtraTypeInfo(ExtraTypeInfoType::ENUM_TYPE_INFO), values_insert_order(values_insert_order_p),
269
226
  dict_type(EnumDictType::VECTOR_DICT), dict_size(dict_size_p) {
@@ -0,0 +1,97 @@
1
+ #include "duckdb/common/field_writer.hpp"
2
+
3
+ namespace duckdb {
4
+
5
+ //===--------------------------------------------------------------------===//
6
+ // Field Writer
7
+ //===--------------------------------------------------------------------===//
8
+ FieldWriter::FieldWriter(Serializer &serializer_p)
9
+ : serializer(serializer_p), buffer(make_uniq<BufferedSerializer>()), field_count(0), finalized(false) {
10
+ buffer->SetVersion(serializer.GetVersion());
11
+ }
12
+
13
+ FieldWriter::~FieldWriter() {
14
+ if (Exception::UncaughtException()) {
15
+ return;
16
+ }
17
+ D_ASSERT(finalized);
18
+ // finalize should always have been called, unless this is destroyed as part of stack unwinding
19
+ D_ASSERT(!buffer);
20
+ }
21
+
22
+ void FieldWriter::WriteData(const_data_ptr_t buffer_ptr, idx_t write_size) {
23
+ D_ASSERT(buffer);
24
+ buffer->WriteData(buffer_ptr, write_size);
25
+ }
26
+
27
+ template <>
28
+ void FieldWriter::Write(const string &val) {
29
+ Write<uint32_t>((uint32_t)val.size());
30
+ if (!val.empty()) {
31
+ WriteData(const_data_ptr_cast(val.c_str()), val.size());
32
+ }
33
+ }
34
+
35
+ void FieldWriter::Finalize() {
36
+ D_ASSERT(buffer);
37
+ D_ASSERT(!finalized);
38
+ finalized = true;
39
+ serializer.Write<uint32_t>(field_count);
40
+ serializer.Write<uint64_t>(buffer->blob.size);
41
+ serializer.WriteData(buffer->blob.data.get(), buffer->blob.size);
42
+
43
+ buffer.reset();
44
+ }
45
+
46
+ //===--------------------------------------------------------------------===//
47
+ // Field Deserializer
48
+ //===--------------------------------------------------------------------===//
49
+ FieldDeserializer::FieldDeserializer(Deserializer &root) : root(root), remaining_data(idx_t(-1)) {
50
+ SetVersion(root.GetVersion());
51
+ }
52
+
53
+ void FieldDeserializer::ReadData(data_ptr_t buffer, idx_t read_size) {
54
+ D_ASSERT(remaining_data != idx_t(-1));
55
+ D_ASSERT(read_size <= remaining_data);
56
+ root.ReadData(buffer, read_size);
57
+ remaining_data -= read_size;
58
+ }
59
+
60
+ idx_t FieldDeserializer::RemainingData() {
61
+ return remaining_data;
62
+ }
63
+
64
+ void FieldDeserializer::SetRemainingData(idx_t remaining_data) {
65
+ this->remaining_data = remaining_data;
66
+ }
67
+
68
+ //===--------------------------------------------------------------------===//
69
+ // Field Reader
70
+ //===--------------------------------------------------------------------===//
71
+ FieldReader::FieldReader(Deserializer &source_p) : source(source_p), field_count(0), finalized(false) {
72
+ max_field_count = source_p.Read<uint32_t>();
73
+ total_size = source_p.Read<uint64_t>();
74
+ D_ASSERT(max_field_count > 0);
75
+ D_ASSERT(total_size > 0);
76
+ source.SetRemainingData(total_size);
77
+ }
78
+
79
+ FieldReader::~FieldReader() {
80
+ if (Exception::UncaughtException()) {
81
+ return;
82
+ }
83
+ D_ASSERT(finalized);
84
+ }
85
+
86
+ void FieldReader::Finalize() {
87
+ D_ASSERT(!finalized);
88
+ finalized = true;
89
+ if (field_count < max_field_count) {
90
+ // we can handle this case by calling source.ReadData(buffer, source.RemainingData())
91
+ throw SerializationException("Not all fields were read. This file might have been written with a newer version "
92
+ "of DuckDB and is incompatible with this version of DuckDB.");
93
+ }
94
+ D_ASSERT(source.RemainingData() == 0);
95
+ }
96
+
97
+ } // namespace duckdb
@@ -118,7 +118,7 @@ static unique_ptr<RenderTreeNode> CreateNode(const PipelineRenderNode &op) {
118
118
  static unique_ptr<RenderTreeNode> CreateNode(const ProfilingNode &op) {
119
119
  auto &info = op.GetProfilingInfo();
120
120
  InsertionOrderPreservingMap<string> extra_info;
121
- if (info.Enabled(MetricsType::EXTRA_INFO)) {
121
+ if (info.Enabled(info.settings, MetricsType::EXTRA_INFO)) {
122
122
  extra_info = op.GetProfilingInfo().extra_info;
123
123
  }
124
124
 
@@ -128,11 +128,13 @@ static unique_ptr<RenderTreeNode> CreateNode(const ProfilingNode &op) {
128
128
  }
129
129
 
130
130
  auto result = make_uniq<RenderTreeNode>(node_name, extra_info);
131
- if (info.Enabled(MetricsType::OPERATOR_CARDINALITY)) {
132
- result->extra_text[RenderTreeNode::CARDINALITY] = info.GetMetricAsString(MetricsType::OPERATOR_CARDINALITY);
131
+ if (info.Enabled(info.settings, MetricsType::OPERATOR_CARDINALITY)) {
132
+ auto cardinality = info.GetMetricAsString(MetricsType::OPERATOR_CARDINALITY);
133
+ result->extra_text[RenderTreeNode::CARDINALITY] = cardinality;
133
134
  }
134
- if (info.Enabled(MetricsType::OPERATOR_TIMING)) {
135
- string timing = StringUtil::Format("%.2f", info.metrics.at(MetricsType::OPERATOR_TIMING).GetValue<double>());
135
+ if (info.Enabled(info.settings, MetricsType::OPERATOR_TIMING)) {
136
+ auto value = info.metrics.at(MetricsType::OPERATOR_TIMING).GetValue<double>();
137
+ string timing = StringUtil::Format("%.2f", value);
136
138
  result->extra_text[RenderTreeNode::TIMING] = timing + "s";
137
139
  }
138
140
  return result;