duckdb 0.8.2-dev1968.0 → 0.8.2-dev2068.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 (213) hide show
  1. package/configure.py +7 -2
  2. package/package.json +1 -1
  3. package/src/duckdb/src/catalog/catalog.cpp +1 -1
  4. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +17 -41
  5. package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +2 -10
  6. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +4 -14
  7. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +11 -28
  8. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +11 -38
  9. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +11 -27
  10. package/src/duckdb/src/catalog/catalog_entry.cpp +25 -1
  11. package/src/duckdb/src/common/adbc/adbc.cpp +18 -4
  12. package/src/duckdb/src/common/enum_util.cpp +159 -0
  13. package/src/duckdb/src/common/extra_type_info.cpp +1 -2
  14. package/src/duckdb/src/common/serializer/binary_deserializer.cpp +3 -0
  15. package/src/duckdb/src/common/serializer/binary_serializer.cpp +4 -4
  16. package/src/duckdb/src/common/types/column/column_data_collection.cpp +43 -0
  17. package/src/duckdb/src/common/types/vector.cpp +1 -1
  18. package/src/duckdb/src/common/types.cpp +0 -12
  19. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  20. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  21. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -2
  22. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +1 -4
  23. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -5
  24. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -6
  25. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -11
  26. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -5
  27. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -0
  28. package/src/duckdb/src/include/duckdb/common/assert.hpp +1 -1
  29. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  30. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
  31. package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +1 -1
  32. package/src/duckdb/src/include/duckdb/common/index_vector.hpp +12 -0
  33. package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +28 -4
  34. package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +12 -5
  35. package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +110 -0
  36. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +46 -1
  37. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +23 -21
  38. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +12 -4
  39. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
  40. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +3 -3
  41. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -0
  42. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
  43. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
  44. package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +6 -5
  45. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -0
  46. package/src/duckdb/src/include/duckdb/parser/constraint.hpp +5 -0
  47. package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
  48. package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +6 -0
  49. package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
  50. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +6 -0
  51. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
  52. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
  53. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
  54. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
  55. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
  56. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
  57. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  58. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
  59. package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -1
  60. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
  61. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
  62. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
  63. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
  64. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
  65. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
  66. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
  67. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
  68. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +12 -1
  69. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +66 -2
  70. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +8 -1
  71. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +8 -1
  72. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +4 -1
  73. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +9 -2
  74. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +3 -0
  75. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +3 -0
  76. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +3 -0
  77. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -0
  78. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +3 -0
  79. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +3 -0
  80. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +7 -0
  81. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -0
  82. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +7 -0
  83. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +13 -3
  84. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +22 -0
  85. package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +10 -0
  86. package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +7 -0
  87. package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +10 -0
  88. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -0
  89. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -8
  90. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +6 -0
  91. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +5 -0
  92. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +6 -0
  93. package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +6 -0
  94. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +6 -0
  95. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
  96. package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
  97. package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
  98. package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
  99. package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
  100. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -1
  101. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
  102. package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
  103. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +5 -2
  104. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +7 -0
  105. package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
  106. package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
  107. package/src/duckdb/src/include/duckdb/planner/expression/list.hpp +1 -0
  108. package/src/duckdb/src/include/duckdb/planner/expression.hpp +3 -0
  109. package/src/duckdb/src/include/duckdb/planner/joinside.hpp +3 -0
  110. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +3 -0
  111. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  112. package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
  113. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -0
  114. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +9 -2
  115. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +9 -6
  116. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -16
  117. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +10 -6
  118. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
  119. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -0
  120. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +7 -0
  121. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
  122. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +6 -10
  123. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -0
  124. package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -0
  125. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -0
  126. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
  127. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
  128. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +6 -0
  129. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
  130. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
  131. package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
  132. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +7 -35
  133. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +6 -0
  134. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
  135. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
  136. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +5 -3
  137. package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +4 -0
  138. package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +6 -0
  139. package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +4 -0
  140. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +4 -0
  141. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
  142. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
  143. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +4 -0
  144. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -0
  145. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +6 -0
  146. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
  147. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
  148. package/src/duckdb/src/optimizer/deliminator.cpp +5 -3
  149. package/src/duckdb/src/parser/column_definition.cpp +20 -32
  150. package/src/duckdb/src/parser/column_list.cpp +8 -0
  151. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -0
  152. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +3 -0
  153. package/src/duckdb/src/parser/expression/case_expression.cpp +0 -12
  154. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +5 -2
  155. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +38 -0
  156. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +3 -1
  157. package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +2 -0
  158. package/src/duckdb/src/parser/parsed_data/detach_info.cpp +1 -1
  159. package/src/duckdb/src/parser/parsed_data/drop_info.cpp +1 -1
  160. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +0 -18
  161. package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +4 -1
  162. package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -1
  163. package/src/duckdb/src/parser/query_node.cpp +0 -10
  164. package/src/duckdb/src/parser/result_modifier.cpp +0 -13
  165. package/src/duckdb/src/parser/statement/select_statement.cpp +0 -10
  166. package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -16
  167. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -4
  168. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
  169. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -1
  170. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -0
  171. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +13 -6
  172. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +20 -12
  173. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +1 -4
  174. package/src/duckdb/src/planner/logical_operator.cpp +13 -1
  175. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +16 -2
  176. package/src/duckdb/src/planner/operator/logical_create.cpp +14 -0
  177. package/src/duckdb/src/planner/operator/logical_create_index.cpp +20 -0
  178. package/src/duckdb/src/planner/operator/logical_create_table.cpp +16 -0
  179. package/src/duckdb/src/planner/operator/logical_delete.cpp +9 -2
  180. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +2 -4
  181. package/src/duckdb/src/planner/operator/logical_distinct.cpp +13 -0
  182. package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
  183. package/src/duckdb/src/planner/operator/logical_insert.cpp +8 -2
  184. package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +3 -2
  185. package/src/duckdb/src/planner/operator/logical_order.cpp +39 -0
  186. package/src/duckdb/src/planner/operator/logical_pivot.cpp +3 -0
  187. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +5 -5
  188. package/src/duckdb/src/planner/operator/logical_sample.cpp +3 -0
  189. package/src/duckdb/src/planner/operator/logical_update.cpp +8 -2
  190. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -2
  191. package/src/duckdb/src/planner/planner.cpp +11 -0
  192. package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
  193. package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +98 -0
  194. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +188 -0
  195. package/src/duckdb/src/storage/serialization/serialize_expression.cpp +274 -0
  196. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +729 -0
  197. package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +62 -0
  198. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +242 -0
  199. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +419 -0
  200. package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +40 -38
  201. package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +36 -36
  202. package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +25 -14
  203. package/src/duckdb/src/storage/serialization/serialize_statement.cpp +22 -0
  204. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +47 -47
  205. package/src/duckdb/src/storage/serialization/serialize_types.cpp +25 -25
  206. package/src/duckdb/src/storage/storage_info.cpp +3 -2
  207. package/src/duckdb/src/storage/wal_replay.cpp +20 -19
  208. package/src/duckdb/third_party/concurrentqueue/lightweightsemaphore.h +3 -76
  209. package/src/duckdb/third_party/libpg_query/pg_functions.cpp +13 -0
  210. package/src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp +9 -0
  211. package/src/duckdb/ub_src_parser.cpp +0 -2
  212. package/src/duckdb/ub_src_storage_serialization.cpp +16 -0
  213. package/src/duckdb/src/parser/common_table_expression_info.cpp +0 -21
@@ -41,6 +41,42 @@ unique_ptr<QueryNode> QueryNode::FormatDeserialize(FormatDeserializer &deseriali
41
41
  return result;
42
42
  }
43
43
 
44
+ void CTENode::FormatSerialize(FormatSerializer &serializer) const {
45
+ QueryNode::FormatSerialize(serializer);
46
+ serializer.WriteProperty("cte_name", ctename);
47
+ serializer.WriteProperty("query", *query);
48
+ serializer.WriteProperty("child", *child);
49
+ serializer.WriteProperty("aliases", aliases);
50
+ }
51
+
52
+ unique_ptr<QueryNode> CTENode::FormatDeserialize(FormatDeserializer &deserializer) {
53
+ auto result = duckdb::unique_ptr<CTENode>(new CTENode());
54
+ deserializer.ReadProperty("cte_name", result->ctename);
55
+ deserializer.ReadProperty("query", result->query);
56
+ deserializer.ReadProperty("child", result->child);
57
+ deserializer.ReadProperty("aliases", result->aliases);
58
+ return std::move(result);
59
+ }
60
+
61
+ void RecursiveCTENode::FormatSerialize(FormatSerializer &serializer) const {
62
+ QueryNode::FormatSerialize(serializer);
63
+ serializer.WriteProperty("cte_name", ctename);
64
+ serializer.WriteProperty("union_all", union_all);
65
+ serializer.WriteProperty("left", *left);
66
+ serializer.WriteProperty("right", *right);
67
+ serializer.WriteProperty("aliases", aliases);
68
+ }
69
+
70
+ unique_ptr<QueryNode> RecursiveCTENode::FormatDeserialize(FormatDeserializer &deserializer) {
71
+ auto result = duckdb::unique_ptr<RecursiveCTENode>(new RecursiveCTENode());
72
+ deserializer.ReadProperty("cte_name", result->ctename);
73
+ deserializer.ReadProperty("union_all", result->union_all);
74
+ deserializer.ReadProperty("left", result->left);
75
+ deserializer.ReadProperty("right", result->right);
76
+ deserializer.ReadProperty("aliases", result->aliases);
77
+ return std::move(result);
78
+ }
79
+
44
80
  void SelectNode::FormatSerialize(FormatSerializer &serializer) const {
45
81
  QueryNode::FormatSerialize(serializer);
46
82
  serializer.WriteProperty("select_list", select_list);
@@ -83,40 +119,4 @@ unique_ptr<QueryNode> SetOperationNode::FormatDeserialize(FormatDeserializer &de
83
119
  return std::move(result);
84
120
  }
85
121
 
86
- void RecursiveCTENode::FormatSerialize(FormatSerializer &serializer) const {
87
- QueryNode::FormatSerialize(serializer);
88
- serializer.WriteProperty("cte_name", ctename);
89
- serializer.WriteProperty("union_all", union_all);
90
- serializer.WriteProperty("left", *left);
91
- serializer.WriteProperty("right", *right);
92
- serializer.WriteProperty("aliases", aliases);
93
- }
94
-
95
- unique_ptr<QueryNode> RecursiveCTENode::FormatDeserialize(FormatDeserializer &deserializer) {
96
- auto result = duckdb::unique_ptr<RecursiveCTENode>(new RecursiveCTENode());
97
- deserializer.ReadProperty("cte_name", result->ctename);
98
- deserializer.ReadProperty("union_all", result->union_all);
99
- deserializer.ReadProperty("left", result->left);
100
- deserializer.ReadProperty("right", result->right);
101
- deserializer.ReadProperty("aliases", result->aliases);
102
- return std::move(result);
103
- }
104
-
105
- void CTENode::FormatSerialize(FormatSerializer &serializer) const {
106
- QueryNode::FormatSerialize(serializer);
107
- serializer.WriteProperty("cte_name", ctename);
108
- serializer.WriteProperty("query", *query);
109
- serializer.WriteProperty("child", *child);
110
- serializer.WriteProperty("aliases", aliases);
111
- }
112
-
113
- unique_ptr<QueryNode> CTENode::FormatDeserialize(FormatDeserializer &deserializer) {
114
- auto result = duckdb::unique_ptr<CTENode>(new CTENode());
115
- deserializer.ReadProperty("cte_name", result->ctename);
116
- deserializer.ReadProperty("query", result->query);
117
- deserializer.ReadProperty("child", result->child);
118
- deserializer.ReadProperty("aliases", result->aliases);
119
- return std::move(result);
120
- }
121
-
122
122
  } // namespace duckdb
@@ -6,6 +6,7 @@
6
6
  #include "duckdb/common/serializer/format_serializer.hpp"
7
7
  #include "duckdb/common/serializer/format_deserializer.hpp"
8
8
  #include "duckdb/parser/result_modifier.hpp"
9
+ #include "duckdb/planner/bound_result_modifier.hpp"
9
10
 
10
11
  namespace duckdb {
11
12
 
@@ -35,17 +36,14 @@ unique_ptr<ResultModifier> ResultModifier::FormatDeserialize(FormatDeserializer
35
36
  return result;
36
37
  }
37
38
 
38
- void LimitModifier::FormatSerialize(FormatSerializer &serializer) const {
39
- ResultModifier::FormatSerialize(serializer);
40
- serializer.WriteOptionalProperty("limit", limit);
41
- serializer.WriteOptionalProperty("offset", offset);
39
+ void BoundOrderModifier::FormatSerialize(FormatSerializer &serializer) const {
40
+ serializer.WriteProperty("orders", orders);
42
41
  }
43
42
 
44
- unique_ptr<ResultModifier> LimitModifier::FormatDeserialize(FormatDeserializer &deserializer) {
45
- auto result = duckdb::unique_ptr<LimitModifier>(new LimitModifier());
46
- deserializer.ReadOptionalProperty("limit", result->limit);
47
- deserializer.ReadOptionalProperty("offset", result->offset);
48
- return std::move(result);
43
+ unique_ptr<BoundOrderModifier> BoundOrderModifier::FormatDeserialize(FormatDeserializer &deserializer) {
44
+ auto result = duckdb::unique_ptr<BoundOrderModifier>(new BoundOrderModifier());
45
+ deserializer.ReadProperty("orders", result->orders);
46
+ return result;
49
47
  }
50
48
 
51
49
  void DistinctModifier::FormatSerialize(FormatSerializer &serializer) const {
@@ -59,14 +57,16 @@ unique_ptr<ResultModifier> DistinctModifier::FormatDeserialize(FormatDeserialize
59
57
  return std::move(result);
60
58
  }
61
59
 
62
- void OrderModifier::FormatSerialize(FormatSerializer &serializer) const {
60
+ void LimitModifier::FormatSerialize(FormatSerializer &serializer) const {
63
61
  ResultModifier::FormatSerialize(serializer);
64
- serializer.WriteProperty("orders", orders);
62
+ serializer.WriteOptionalProperty("limit", limit);
63
+ serializer.WriteOptionalProperty("offset", offset);
65
64
  }
66
65
 
67
- unique_ptr<ResultModifier> OrderModifier::FormatDeserialize(FormatDeserializer &deserializer) {
68
- auto result = duckdb::unique_ptr<OrderModifier>(new OrderModifier());
69
- deserializer.ReadProperty("orders", result->orders);
66
+ unique_ptr<ResultModifier> LimitModifier::FormatDeserialize(FormatDeserializer &deserializer) {
67
+ auto result = duckdb::unique_ptr<LimitModifier>(new LimitModifier());
68
+ deserializer.ReadOptionalProperty("limit", result->limit);
69
+ deserializer.ReadOptionalProperty("offset", result->offset);
70
70
  return std::move(result);
71
71
  }
72
72
 
@@ -83,4 +83,15 @@ unique_ptr<ResultModifier> LimitPercentModifier::FormatDeserialize(FormatDeseria
83
83
  return std::move(result);
84
84
  }
85
85
 
86
+ void OrderModifier::FormatSerialize(FormatSerializer &serializer) const {
87
+ ResultModifier::FormatSerialize(serializer);
88
+ serializer.WriteProperty("orders", orders);
89
+ }
90
+
91
+ unique_ptr<ResultModifier> OrderModifier::FormatDeserialize(FormatDeserializer &deserializer) {
92
+ auto result = duckdb::unique_ptr<OrderModifier>(new OrderModifier());
93
+ deserializer.ReadProperty("orders", result->orders);
94
+ return std::move(result);
95
+ }
96
+
86
97
  } // namespace duckdb
@@ -0,0 +1,22 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // This file is automatically generated by scripts/generate_serialization.py
3
+ // Do not edit this file manually, your changes will be overwritten
4
+ //===----------------------------------------------------------------------===//
5
+
6
+ #include "duckdb/common/serializer/format_serializer.hpp"
7
+ #include "duckdb/common/serializer/format_deserializer.hpp"
8
+ #include "duckdb/parser/statement/select_statement.hpp"
9
+
10
+ namespace duckdb {
11
+
12
+ void SelectStatement::FormatSerialize(FormatSerializer &serializer) const {
13
+ serializer.WriteProperty("node", *node);
14
+ }
15
+
16
+ unique_ptr<SelectStatement> SelectStatement::FormatDeserialize(FormatDeserializer &deserializer) {
17
+ auto result = duckdb::unique_ptr<SelectStatement>(new SelectStatement());
18
+ deserializer.ReadProperty("node", result->node);
19
+ return result;
20
+ }
21
+
22
+ } // namespace duckdb
@@ -67,6 +67,30 @@ unique_ptr<TableRef> BaseTableRef::FormatDeserialize(FormatDeserializer &deseria
67
67
  return std::move(result);
68
68
  }
69
69
 
70
+ void EmptyTableRef::FormatSerialize(FormatSerializer &serializer) const {
71
+ TableRef::FormatSerialize(serializer);
72
+ }
73
+
74
+ unique_ptr<TableRef> EmptyTableRef::FormatDeserialize(FormatDeserializer &deserializer) {
75
+ auto result = duckdb::unique_ptr<EmptyTableRef>(new EmptyTableRef());
76
+ return std::move(result);
77
+ }
78
+
79
+ void ExpressionListRef::FormatSerialize(FormatSerializer &serializer) const {
80
+ TableRef::FormatSerialize(serializer);
81
+ serializer.WriteProperty("expected_names", expected_names);
82
+ serializer.WriteProperty("expected_types", expected_types);
83
+ serializer.WriteProperty("values", values);
84
+ }
85
+
86
+ unique_ptr<TableRef> ExpressionListRef::FormatDeserialize(FormatDeserializer &deserializer) {
87
+ auto result = duckdb::unique_ptr<ExpressionListRef>(new ExpressionListRef());
88
+ deserializer.ReadProperty("expected_names", result->expected_names);
89
+ deserializer.ReadProperty("expected_types", result->expected_types);
90
+ deserializer.ReadProperty("values", result->values);
91
+ return std::move(result);
92
+ }
93
+
70
94
  void JoinRef::FormatSerialize(FormatSerializer &serializer) const {
71
95
  TableRef::FormatSerialize(serializer);
72
96
  serializer.WriteProperty("left", *left);
@@ -88,6 +112,29 @@ unique_ptr<TableRef> JoinRef::FormatDeserialize(FormatDeserializer &deserializer
88
112
  return std::move(result);
89
113
  }
90
114
 
115
+ void PivotRef::FormatSerialize(FormatSerializer &serializer) const {
116
+ TableRef::FormatSerialize(serializer);
117
+ serializer.WriteProperty("source", *source);
118
+ serializer.WriteProperty("aggregates", aggregates);
119
+ serializer.WriteProperty("unpivot_names", unpivot_names);
120
+ serializer.WriteProperty("pivots", pivots);
121
+ serializer.WriteProperty("groups", groups);
122
+ serializer.WriteProperty("column_name_alias", column_name_alias);
123
+ serializer.WriteProperty("include_nulls", include_nulls);
124
+ }
125
+
126
+ unique_ptr<TableRef> PivotRef::FormatDeserialize(FormatDeserializer &deserializer) {
127
+ auto result = duckdb::unique_ptr<PivotRef>(new PivotRef());
128
+ deserializer.ReadProperty("source", result->source);
129
+ deserializer.ReadProperty("aggregates", result->aggregates);
130
+ deserializer.ReadProperty("unpivot_names", result->unpivot_names);
131
+ deserializer.ReadProperty("pivots", result->pivots);
132
+ deserializer.ReadProperty("groups", result->groups);
133
+ deserializer.ReadProperty("column_name_alias", result->column_name_alias);
134
+ deserializer.ReadProperty("include_nulls", result->include_nulls);
135
+ return std::move(result);
136
+ }
137
+
91
138
  void SubqueryRef::FormatSerialize(FormatSerializer &serializer) const {
92
139
  TableRef::FormatSerialize(serializer);
93
140
  serializer.WriteProperty("subquery", *subquery);
@@ -116,51 +163,4 @@ unique_ptr<TableRef> TableFunctionRef::FormatDeserialize(FormatDeserializer &des
116
163
  return std::move(result);
117
164
  }
118
165
 
119
- void EmptyTableRef::FormatSerialize(FormatSerializer &serializer) const {
120
- TableRef::FormatSerialize(serializer);
121
- }
122
-
123
- unique_ptr<TableRef> EmptyTableRef::FormatDeserialize(FormatDeserializer &deserializer) {
124
- auto result = duckdb::unique_ptr<EmptyTableRef>(new EmptyTableRef());
125
- return std::move(result);
126
- }
127
-
128
- void ExpressionListRef::FormatSerialize(FormatSerializer &serializer) const {
129
- TableRef::FormatSerialize(serializer);
130
- serializer.WriteProperty("expected_names", expected_names);
131
- serializer.WriteProperty("expected_types", expected_types);
132
- serializer.WriteProperty("values", values);
133
- }
134
-
135
- unique_ptr<TableRef> ExpressionListRef::FormatDeserialize(FormatDeserializer &deserializer) {
136
- auto result = duckdb::unique_ptr<ExpressionListRef>(new ExpressionListRef());
137
- deserializer.ReadProperty("expected_names", result->expected_names);
138
- deserializer.ReadProperty("expected_types", result->expected_types);
139
- deserializer.ReadProperty("values", result->values);
140
- return std::move(result);
141
- }
142
-
143
- void PivotRef::FormatSerialize(FormatSerializer &serializer) const {
144
- TableRef::FormatSerialize(serializer);
145
- serializer.WriteProperty("source", *source);
146
- serializer.WriteProperty("aggregates", aggregates);
147
- serializer.WriteProperty("unpivot_names", unpivot_names);
148
- serializer.WriteProperty("pivots", pivots);
149
- serializer.WriteProperty("groups", groups);
150
- serializer.WriteProperty("column_name_alias", column_name_alias);
151
- serializer.WriteProperty("include_nulls", include_nulls);
152
- }
153
-
154
- unique_ptr<TableRef> PivotRef::FormatDeserialize(FormatDeserializer &deserializer) {
155
- auto result = duckdb::unique_ptr<PivotRef>(new PivotRef());
156
- deserializer.ReadProperty("source", result->source);
157
- deserializer.ReadProperty("aggregates", result->aggregates);
158
- deserializer.ReadProperty("unpivot_names", result->unpivot_names);
159
- deserializer.ReadProperty("pivots", result->pivots);
160
- deserializer.ReadProperty("groups", result->groups);
161
- deserializer.ReadProperty("column_name_alias", result->column_name_alias);
162
- deserializer.ReadProperty("include_nulls", result->include_nulls);
163
- return std::move(result);
164
- }
165
-
166
166
  } // namespace duckdb
@@ -52,6 +52,21 @@ shared_ptr<ExtraTypeInfo> ExtraTypeInfo::FormatDeserialize(FormatDeserializer &d
52
52
  return result;
53
53
  }
54
54
 
55
+ void AggregateStateTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
56
+ ExtraTypeInfo::FormatSerialize(serializer);
57
+ serializer.WriteProperty("function_name", state_type.function_name);
58
+ serializer.WriteProperty("return_type", state_type.return_type);
59
+ serializer.WriteProperty("bound_argument_types", state_type.bound_argument_types);
60
+ }
61
+
62
+ shared_ptr<ExtraTypeInfo> AggregateStateTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
63
+ auto result = duckdb::shared_ptr<AggregateStateTypeInfo>(new AggregateStateTypeInfo());
64
+ deserializer.ReadProperty("function_name", result->state_type.function_name);
65
+ deserializer.ReadProperty("return_type", result->state_type.return_type);
66
+ deserializer.ReadProperty("bound_argument_types", result->state_type.bound_argument_types);
67
+ return std::move(result);
68
+ }
69
+
55
70
  void DecimalTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
56
71
  ExtraTypeInfo::FormatSerialize(serializer);
57
72
  serializer.WriteProperty("width", width);
@@ -65,17 +80,6 @@ shared_ptr<ExtraTypeInfo> DecimalTypeInfo::FormatDeserialize(FormatDeserializer
65
80
  return std::move(result);
66
81
  }
67
82
 
68
- void StringTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
69
- ExtraTypeInfo::FormatSerialize(serializer);
70
- serializer.WriteProperty("collation", collation);
71
- }
72
-
73
- shared_ptr<ExtraTypeInfo> StringTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
74
- auto result = duckdb::shared_ptr<StringTypeInfo>(new StringTypeInfo());
75
- deserializer.ReadProperty("collation", result->collation);
76
- return std::move(result);
77
- }
78
-
79
83
  void ListTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
80
84
  ExtraTypeInfo::FormatSerialize(serializer);
81
85
  serializer.WriteProperty("child_type", child_type);
@@ -87,29 +91,25 @@ shared_ptr<ExtraTypeInfo> ListTypeInfo::FormatDeserialize(FormatDeserializer &de
87
91
  return std::move(result);
88
92
  }
89
93
 
90
- void StructTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
94
+ void StringTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
91
95
  ExtraTypeInfo::FormatSerialize(serializer);
92
- serializer.WriteProperty("child_types", child_types);
96
+ serializer.WriteProperty("collation", collation);
93
97
  }
94
98
 
95
- shared_ptr<ExtraTypeInfo> StructTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
96
- auto result = duckdb::shared_ptr<StructTypeInfo>(new StructTypeInfo());
97
- deserializer.ReadProperty("child_types", result->child_types);
99
+ shared_ptr<ExtraTypeInfo> StringTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
100
+ auto result = duckdb::shared_ptr<StringTypeInfo>(new StringTypeInfo());
101
+ deserializer.ReadProperty("collation", result->collation);
98
102
  return std::move(result);
99
103
  }
100
104
 
101
- void AggregateStateTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
105
+ void StructTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
102
106
  ExtraTypeInfo::FormatSerialize(serializer);
103
- serializer.WriteProperty("function_name", state_type.function_name);
104
- serializer.WriteProperty("return_type", state_type.return_type);
105
- serializer.WriteProperty("bound_argument_types", state_type.bound_argument_types);
107
+ serializer.WriteProperty("child_types", child_types);
106
108
  }
107
109
 
108
- shared_ptr<ExtraTypeInfo> AggregateStateTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
109
- auto result = duckdb::shared_ptr<AggregateStateTypeInfo>(new AggregateStateTypeInfo());
110
- deserializer.ReadProperty("function_name", result->state_type.function_name);
111
- deserializer.ReadProperty("return_type", result->state_type.return_type);
112
- deserializer.ReadProperty("bound_argument_types", result->state_type.bound_argument_types);
110
+ shared_ptr<ExtraTypeInfo> StructTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
111
+ auto result = duckdb::shared_ptr<StructTypeInfo>(new StructTypeInfo());
112
+ deserializer.ReadProperty("child_types", result->child_types);
113
113
  return std::move(result);
114
114
  }
115
115
 
@@ -2,14 +2,15 @@
2
2
 
3
3
  namespace duckdb {
4
4
 
5
- const uint64_t VERSION_NUMBER = 52;
5
+ const uint64_t VERSION_NUMBER = 53;
6
6
 
7
7
  struct StorageVersionInfo {
8
8
  const char *version_name;
9
9
  idx_t storage_version;
10
10
  };
11
11
 
12
- static StorageVersionInfo storage_version_info[] = {{"v0.7.0 or v0.7.1", 43},
12
+ static StorageVersionInfo storage_version_info[] = {{"v0.8.0 or v0.8.1", 51},
13
+ {"v0.7.0 or v0.7.1", 43},
13
14
  {"v0.6.0 or v0.6.1", 39},
14
15
  {"v0.5.0 or v0.5.1", 38},
15
16
  {"v0.3.3, v0.3.4 or v0.4.0", 33},
@@ -195,7 +195,7 @@ void ReplayState::ReplayEntry(WALType entry_type) {
195
195
  // Replay Table
196
196
  //===--------------------------------------------------------------------===//
197
197
  void ReplayState::ReplayCreateTable() {
198
- auto info = TableCatalogEntry::Deserialize(source, context);
198
+ auto info = TableCatalogEntry::Deserialize(source);
199
199
  if (deserialize_only) {
200
200
  return;
201
201
  }
@@ -234,12 +234,12 @@ void ReplayState::ReplayAlter() {
234
234
  // Replay View
235
235
  //===--------------------------------------------------------------------===//
236
236
  void ReplayState::ReplayCreateView() {
237
- auto entry = ViewCatalogEntry::Deserialize(source, context);
237
+ auto entry = CatalogEntry::Deserialize(source);
238
238
  if (deserialize_only) {
239
239
  return;
240
240
  }
241
241
 
242
- catalog.CreateView(context, *entry);
242
+ catalog.CreateView(context, entry->Cast<CreateViewInfo>());
243
243
  }
244
244
 
245
245
  void ReplayState::ReplayDropView() {
@@ -309,7 +309,7 @@ void ReplayState::ReplayCreateSequence() {
309
309
  return;
310
310
  }
311
311
 
312
- catalog.CreateSequence(context, *entry);
312
+ catalog.CreateSequence(context, entry->Cast<CreateSequenceInfo>());
313
313
  }
314
314
 
315
315
  void ReplayState::ReplayDropSequence() {
@@ -345,12 +345,12 @@ void ReplayState::ReplaySequenceValue() {
345
345
  // Replay Macro
346
346
  //===--------------------------------------------------------------------===//
347
347
  void ReplayState::ReplayCreateMacro() {
348
- auto entry = ScalarMacroCatalogEntry::Deserialize(source, context);
348
+ auto entry = ScalarMacroCatalogEntry::Deserialize(source);
349
349
  if (deserialize_only) {
350
350
  return;
351
351
  }
352
352
 
353
- catalog.CreateFunction(context, *entry);
353
+ catalog.CreateFunction(context, entry->Cast<CreateMacroInfo>());
354
354
  }
355
355
 
356
356
  void ReplayState::ReplayDropMacro() {
@@ -369,12 +369,12 @@ void ReplayState::ReplayDropMacro() {
369
369
  // Replay Table Macro
370
370
  //===--------------------------------------------------------------------===//
371
371
  void ReplayState::ReplayCreateTableMacro() {
372
- auto entry = TableMacroCatalogEntry::Deserialize(source, context);
372
+ auto entry = TableMacroCatalogEntry::Deserialize(source);
373
373
  if (deserialize_only) {
374
374
  return;
375
375
  }
376
376
 
377
- catalog.CreateFunction(context, *entry);
377
+ catalog.CreateFunction(context, entry->Cast<CreateMacroInfo>());
378
378
  }
379
379
 
380
380
  void ReplayState::ReplayDropTableMacro() {
@@ -393,30 +393,31 @@ void ReplayState::ReplayDropTableMacro() {
393
393
  // Replay Index
394
394
  //===--------------------------------------------------------------------===//
395
395
  void ReplayState::ReplayCreateIndex() {
396
- auto info = IndexCatalogEntry::Deserialize(source, context);
396
+ auto info = IndexCatalogEntry::Deserialize(source);
397
397
  if (deserialize_only) {
398
398
  return;
399
399
  }
400
+ auto &index_info = info->Cast<CreateIndexInfo>();
400
401
 
401
402
  // get the physical table to which we'll add the index
402
- auto &table = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table->table_name);
403
+ auto &table = catalog.GetEntry<TableCatalogEntry>(context, info->schema, index_info.table);
403
404
  auto &data_table = table.GetStorage();
404
405
 
405
406
  // bind the parsed expressions
406
- if (info->expressions.empty()) {
407
- for (auto &parsed_expr : info->parsed_expressions) {
408
- info->expressions.push_back(parsed_expr->Copy());
407
+ if (index_info.expressions.empty()) {
408
+ for (auto &parsed_expr : index_info.parsed_expressions) {
409
+ index_info.expressions.push_back(parsed_expr->Copy());
409
410
  }
410
411
  }
411
412
  auto binder = Binder::CreateBinder(context);
412
- auto expressions = binder->BindCreateIndexExpressions(table, *info);
413
+ auto expressions = binder->BindCreateIndexExpressions(table, index_info);
413
414
 
414
415
  // create the empty index
415
416
  unique_ptr<Index> index;
416
- switch (info->index_type) {
417
+ switch (index_info.index_type) {
417
418
  case IndexType::ART: {
418
- index = make_uniq<ART>(info->column_ids, TableIOManager::Get(data_table), expressions, info->constraint_type,
419
- data_table.db);
419
+ index = make_uniq<ART>(index_info.column_ids, TableIOManager::Get(data_table), expressions,
420
+ index_info.constraint_type, data_table.db);
420
421
  break;
421
422
  }
422
423
  default:
@@ -424,10 +425,10 @@ void ReplayState::ReplayCreateIndex() {
424
425
  }
425
426
 
426
427
  // add the index to the catalog
427
- auto &index_entry = catalog.CreateIndex(context, *info)->Cast<DuckIndexEntry>();
428
+ auto &index_entry = catalog.CreateIndex(context, index_info)->Cast<DuckIndexEntry>();
428
429
  index_entry.index = index.get();
429
430
  index_entry.info = data_table.info;
430
- for (auto &parsed_expr : info->parsed_expressions) {
431
+ for (auto &parsed_expr : index_info.parsed_expressions) {
431
432
  index_entry.parsed_expressions.push_back(parsed_expr->Copy());
432
433
  }
433
434
 
@@ -29,6 +29,7 @@ extern "C" {
29
29
  #include <chrono>
30
30
  #elif defined(__MVS__)
31
31
  #include <zos-semaphore.h>
32
+ #include <chrono>
32
33
  #endif
33
34
 
34
35
  namespace duckdb_moodycamel
@@ -162,9 +163,9 @@ public:
162
163
  }
163
164
  }
164
165
  };
165
- #elif defined(__unix__)
166
+ #elif defined(__unix__) || defined(__MVS__)
166
167
  //---------------------------------------------------------
167
- // Semaphore (POSIX, Linux)
168
+ // Semaphore (POSIX, Linux, zOS aka MVS)
168
169
  //---------------------------------------------------------
169
170
  class Semaphore
170
171
  {
@@ -256,80 +257,6 @@ public:
256
257
  }
257
258
  }
258
259
  };
259
- #elif defined(__MVS__)
260
- //---------------------------------------------------------
261
- // Semaphore (MVS aka z/OS)
262
- //---------------------------------------------------------
263
- class Semaphore
264
- {
265
- private:
266
- sem_t m_sema;
267
-
268
- Semaphore(const Semaphore& other) MOODYCAMEL_DELETE_FUNCTION;
269
- Semaphore& operator=(const Semaphore& other) MOODYCAMEL_DELETE_FUNCTION;
270
-
271
- public:
272
- Semaphore(int initialCount = 0)
273
- {
274
- assert(initialCount >= 0);
275
- int rc = sem_init(&m_sema, 0, initialCount);
276
- assert(rc == 0);
277
- (void)rc;
278
- }
279
-
280
- ~Semaphore()
281
- {
282
- sem_destroy(&m_sema);
283
- }
284
-
285
- bool wait()
286
- {
287
- // http://stackoverflow.com/questions/2013181/gdb-causes-sem-wait-to-fail-with-eintr-error
288
- int rc;
289
- do {
290
- rc = sem_wait(&m_sema);
291
- } while (rc == -1 && errno == EINTR);
292
- return rc == 0;
293
- }
294
-
295
- bool try_wait()
296
- {
297
- int rc;
298
- do {
299
- rc = sem_trywait(&m_sema);
300
- } while (rc == -1 && errno == EINTR);
301
- return rc == 0;
302
- }
303
-
304
- bool timed_wait(std::uint64_t usecs)
305
- {
306
- struct timespec ts;
307
- const int usecs_in_1_sec = 1000000;
308
- const int nsecs_in_1_sec = 1000000000;
309
-
310
- ts.tv_sec = usecs / usecs_in_1_sec;
311
- ts.tv_nsec = (usecs % usecs_in_1_sec) * 1000;
312
-
313
- int rc;
314
- do {
315
- rc = sem_timedwait(&m_sema, &ts);
316
- } while (rc == -1 && errno == EINTR);
317
- return rc == 0;
318
- }
319
-
320
- void signal()
321
- {
322
- while (sem_post(&m_sema) == -1);
323
- }
324
-
325
- void signal(int count)
326
- {
327
- while (count-- > 0)
328
- {
329
- while (sem_post(&m_sema) == -1);
330
- }
331
- }
332
- };
333
260
  #else
334
261
  #error Unsupported platform! (No semaphore wrapper available)
335
262
  #endif
@@ -8,6 +8,9 @@
8
8
  #include <mutex>
9
9
  #include <cstring>
10
10
 
11
+ #ifdef __MVS__
12
+ #include <zos-tls.h>
13
+ #endif
11
14
 
12
15
  // max parse tree size approx 100 MB, should be enough
13
16
  #define PG_MALLOC_SIZE 10240
@@ -26,7 +29,17 @@ struct pg_parser_state_str {
26
29
  size_t malloc_ptr_size;
27
30
  };
28
31
 
32
+ #ifdef __MVS__
33
+ // --------------------------------------------------------
34
+ // Permanent - WIP
35
+ // static __tlssim<parser_state> pg_parser_state_impl();
36
+ // #define pg_parser_state (*pg_parser_state_impl.access())
37
+ // --------------------------------------------------------
38
+ // Temporary
39
+ static parser_state pg_parser_state;
40
+ #else
29
41
  static __thread parser_state pg_parser_state;
42
+ #endif
30
43
 
31
44
  #ifndef __GNUC__
32
45
  __thread PGNode *duckdb_newNodeMacroHolder;
@@ -30,6 +30,10 @@
30
30
  #include "parser/scansup.hpp"
31
31
  #include "mb/pg_wchar.hpp"
32
32
 
33
+ #ifdef __MVS__
34
+ #include <zos-tls.h>
35
+ #endif
36
+
33
37
  namespace duckdb_libpgquery {
34
38
 
35
39
  /* ----------------
@@ -60,7 +64,12 @@ char *downcase_truncate_identifier(const char *ident, int len, bool warn) {
60
64
  return downcase_identifier(ident, len, warn, true);
61
65
  }
62
66
 
67
+ #ifdef __MVS__
68
+ static __tlssim<bool> pg_preserve_identifier_case_impl(false);
69
+ #define pg_preserve_identifier_case (*pg_preserve_identifier_case_impl.access())
70
+ #else
63
71
  static __thread bool pg_preserve_identifier_case = false;
72
+ #endif
64
73
 
65
74
  void set_preserve_identifier_case(bool preserve) {
66
75
  pg_preserve_identifier_case = preserve;
@@ -6,8 +6,6 @@
6
6
 
7
7
  #include "src/parser/constraint.cpp"
8
8
 
9
- #include "src/parser/common_table_expression_info.cpp"
10
-
11
9
  #include "src/parser/expression_util.cpp"
12
10
 
13
11
  #include "src/parser/keyword_helper.cpp"