From d3a62a8c7dbfd8d297dae7ab9a5b6004757395c1 Mon Sep 17 00:00:00 2001 From: Keenan Gugeler Date: Thu, 2 Nov 2023 17:13:06 -0400 Subject: [PATCH] cleanup: fix all clangd warnings The bulk of the warnings issued are because of unused includes, but some are because of dead files leftover from #2246. Also, `subplans_table.h` had a `using` directive, which caused symbol pollution. --- CMakeLists.txt | 14 +- examples/c/main.c | 4 +- src/binder/bind/bind_copy.cpp | 11 +- src/binder/bind/bind_ddl.cpp | 3 + src/binder/bind/bind_file_scan.cpp | 1 - src/binder/bind/bind_graph_pattern.cpp | 5 +- src/binder/bind/bind_query.cpp | 2 - src/binder/bind/bind_reading_clause.cpp | 2 + src/binder/bind/bind_updating_clause.cpp | 2 + .../bind_function_expression.cpp | 2 +- .../bind_property_expression.cpp | 2 + src/binder/binder.cpp | 2 - src/binder/expression_binder.cpp | 1 + .../with_clause_projection_rewriter.cpp | 1 + src/c_api/connection.cpp | 3 - src/c_api/data_type.cpp | 2 - src/c_api/prepared_statement.cpp | 5 +- src/c_api/query_result.cpp | 3 +- src/c_api/query_summary.cpp | 3 +- src/c_api/value.cpp | 2 - src/catalog/catalog_content.cpp | 5 +- src/common/arrow/arrow_converter.cpp | 2 + src/common/arrow/arrow_row_batch.cpp | 3 + src/common/logging_level_utils.cpp | 1 - src/common/profiler.cpp | 2 - src/common/string_utils.cpp | 1 + src/common/task_system/task_scheduler.cpp | 1 - src/common/type_utils.cpp | 1 - src/common/types/date_t.cpp | 1 - src/common/types/dtime_t.cpp | 3 +- src/common/types/int128_t.cpp | 2 - src/common/types/ku_list.cpp | 2 + src/common/types/types.cpp | 2 +- src/common/types/value/value.cpp | 15 +- src/common/vector/value_vector.cpp | 1 + src/expression_evaluator/case_evaluator.cpp | 3 + src/expression_evaluator/path_evaluator.cpp | 1 + src/function/aggregate_function.cpp | 4 +- src/function/base_lower_upper_operation.cpp | 2 +- src/function/cast_string_to_functions.cpp | 2 +- src/function/comparison_functions.cpp | 6 + .../table_functions/call_functions.cpp | 1 + src/function/vector_arithmetic_functions.cpp | 5 + src/function/vector_cast_functions.cpp | 2 + src/function/vector_list_functions.cpp | 2 - src/include/binder/binder.h | 6 +- src/include/binder/bound_comment_on.h | 1 + src/include/binder/bound_standalone_call.h | 1 + src/include/binder/copy/bound_copy_from.h | 1 - src/include/binder/copy/bound_copy_to.h | 4 - .../binder/copy/bound_file_scan_info.h | 2 +- .../binder/ddl/bound_create_table_info.h | 3 +- .../existential_subquery_expression.h | 2 +- .../binder/expression/node_expression.h | 1 - .../binder/expression/path_expression.h | 3 +- .../binder/expression/rel_expression.h | 1 + src/include/binder/expression_binder.h | 1 - .../binder/query/normalized_query_part.h | 1 - .../reading_clause/bound_reading_clause.h | 1 - .../query/updating_clause/bound_delete_info.h | 2 +- .../query/updating_clause/bound_insert_info.h | 2 +- .../updating_clause/bound_updating_clause.h | 3 +- src/include/c_api/kuzu.h | 2 - src/include/catalog/node_table_schema.h | 1 + src/include/catalog/rdf_graph_schema.h | 1 + src/include/catalog/rel_table_group_schema.h | 1 + src/include/catalog/rel_table_schema.h | 1 + src/include/catalog/table_schema.h | 3 - src/include/common/arrow/arrow_converter.h | 1 - src/include/common/constants.h | 3 +- .../common/copier_config/copier_config.h | 3 - .../common/data_chunk/data_chunk_state.h | 3 - src/include/common/exception/exception.h | 2 +- src/include/common/in_mem_overflow_buffer.h | 3 +- src/include/common/logging_level_utils.h | 2 +- src/include/common/metric.h | 2 - src/include/common/null_buffer.h | 1 + src/include/common/null_mask.h | 1 - src/include/common/profiler.h | 2 + src/include/common/serializer/buffered_file.h | 4 - src/include/common/string_format.h | 1 - src/include/common/string_utils.h | 1 - .../common/task_system/task_scheduler.h | 1 - src/include/common/timer.h | 2 - src/include/common/type_utils.h | 3 +- src/include/common/types/blob.h | 1 - src/include/common/types/int128_t.h | 5 +- src/include/common/types/types.h | 3 - src/include/common/types/value/value.h | 3 +- src/include/common/utils.h | 5 - .../expression_evaluator/case_evaluator.h | 1 + .../expression_evaluator.h | 3 - .../expression_evaluator_utils.h | 3 +- .../expression_evaluator/node_rel_evaluator.h | 1 + .../expression_evaluator/path_evaluator.h | 2 + src/include/function/aggregate/collect.h | 1 + src/include/function/aggregate/min_max.h | 1 - src/include/function/aggregate_function.h | 1 - .../arithmetic/arithmetic_functions.h | 2 +- .../arithmetic/vector_arithmetic_functions.h | 5 +- .../function/binary_function_executor.h | 4 - .../function/blob/functions/decode_function.h | 1 + .../function/blob/functions/encode_function.h | 1 + .../boolean/boolean_function_executor.h | 2 +- src/include/function/built_in_function.h | 1 - .../function/cast/functions/cast_functions.h | 6 +- .../cast_string_non_nested_functions.h | 8 +- .../cast/functions/cast_string_to_functions.h | 4 - .../function/cast/functions/numeric_cast.h | 2 +- .../function/cast/vector_cast_functions.h | 2 +- .../comparison/comparison_functions.h | 4 - .../comparison/vector_comparison_functions.h | 5 +- .../function/const_function_executor.h | 2 - src/include/function/date/date_functions.h | 3 +- src/include/function/function.h | 1 - src/include/function/hash/hash_functions.h | 6 +- .../function/interval/interval_functions.h | 3 +- .../list/functions/list_append_function.h | 4 - .../list/functions/list_concat_function.h | 6 +- .../list/functions/list_contains_function.h | 5 +- .../list/functions/list_extract_function.h | 4 +- .../list/functions/list_len_function.h | 2 - .../list/functions/list_position_function.h | 6 +- .../list/functions/list_prepend_function.h | 5 +- .../list/functions/list_range_function.h | 2 +- .../list/functions/list_slice_function.h | 4 - .../function/list/vector_list_functions.h | 5 + .../map/functions/map_extract_function.h | 1 + .../map/functions/map_values_function.h | 1 + .../function/map/vector_map_functions.h | 1 - .../function/null/null_function_executor.h | 2 +- src/include/function/null/null_functions.h | 1 - .../function/path/path_function_executor.h | 2 - src/include/function/scalar_function.h | 1 - src/include/function/schema/label_functions.h | 1 - .../function/schema/offset_functions.h | 2 +- .../function/schema/vector_label_functions.h | 4 +- .../string/functions/array_extract_function.h | 2 - .../functions/base_lower_upper_function.h | 4 - .../string/functions/base_pad_function.h | 3 - .../string/functions/base_str_function.h | 4 +- .../string/functions/concat_function.h | 3 - .../string/functions/contains_function.h | 2 - .../function/string/functions/find_function.h | 3 - .../string/functions/left_operation.h | 3 - .../string/functions/lower_function.h | 3 - .../function/string/functions/lpad_function.h | 3 - .../string/functions/ltrim_function.h | 1 - .../function/string/functions/pad_function.h | 1 - .../functions/regexp_extract_function.h | 1 + .../functions/regexp_full_match_function.h | 1 + .../functions/regexp_matches_function.h | 1 + .../functions/regexp_replace_function.h | 1 + .../string/functions/repeat_function.h | 2 +- .../string/functions/reverse_function.h | 5 +- .../string/functions/right_function.h | 3 - .../function/string/functions/rpad_function.h | 3 - .../string/functions/rtrim_function.h | 3 - .../string/functions/substr_function.h | 1 - .../function/string/functions/trim_function.h | 3 - .../string/functions/upper_function.h | 5 +- .../function/table_functions/bind_data.h | 2 +- .../function/ternary_function_executor.h | 3 - .../function/timestamp/timestamp_function.h | 2 +- src/include/function/udf_function.h | 2 + .../function/unary_function_executor.h | 2 - src/include/main/client_context.h | 1 - src/include/main/database.h | 3 +- src/include/main/kuzu.h | 4 +- src/include/main/plan_printer.h | 1 - src/include/main/storage_driver.h | 2 - .../correlated_subquery_unnest_solver.h | 1 - .../optimizer/filter_push_down_optimizer.h | 2 - .../antlr_parser/parser_error_listener.h | 2 +- .../antlr_parser/parser_error_strategy.h | 4 +- src/include/parser/copy.h | 3 - src/include/parser/create_macro.h | 2 - src/include/parser/ddl/create_table_info.h | 1 + src/include/parser/ddl/drop.h | 2 + src/include/parser/explain_statement.h | 2 + .../expression/parsed_subquery_expression.h | 2 +- src/include/parser/query/query_part.h | 4 +- .../planner/join_order_enumerator_context.h | 26 +- .../operator/ddl/logical_create_table.h | 1 - .../planner/operator/ddl/logical_drop_table.h | 1 + .../operator/factorization/flatten_resolver.h | 2 +- .../planner/operator/logical_cross_product.h | 1 - .../planner/operator/logical_flatten.h | 1 - .../planner/operator/logical_hash_join.h | 1 + .../planner/operator/logical_plan_util.h | 1 - .../planner/operator/logical_projection.h | 1 + .../operator/persistent/logical_copy_from.h | 2 - .../operator/persistent/logical_copy_to.h | 1 - .../operator/scan/logical_dummy_scan.h | 1 - .../operator/scan/logical_expressions_scan.h | 1 + .../operator/scan/logical_index_scan.h | 1 - .../scan/logical_scan_node_property.h | 1 + src/include/planner/operator/schema.h | 1 - .../operator/sip/logical_semi_masker.h | 1 - .../operator/sip/side_way_info_passing.h | 2 +- src/include/planner/planner.h | 34 +- src/include/planner/query_planner.h | 84 +++-- src/include/planner/subplans_table.h | 34 +- src/include/processor/data_pos.h | 1 - src/include/processor/expression_mapper.h | 2 - .../operator/aggregate/aggregate_hash_table.h | 1 - .../operator/aggregate/aggregate_input.h | 2 +- .../processor/operator/base_hash_table.h | 1 - .../processor/operator/call/in_query_call.h | 2 +- .../processor/operator/cross_product.h | 3 +- .../operator/ddl/create_node_table.h | 2 - .../processor/operator/ddl/create_rel_table.h | 1 - .../operator/ddl/create_rel_table_group.h | 1 - .../processor/operator/ddl/drop_table.h | 1 - .../processor/operator/filtering_operator.h | 3 +- .../operator/hash_join/hash_join_build.h | 1 - .../operator/hash_join/join_hash_table.h | 4 +- .../processor/operator/intersect/intersect.h | 2 +- .../processor/operator/macro/create_macro.h | 1 - .../processor/operator/order_by/order_by.h | 2 - .../operator/order_by/order_by_key_encoder.h | 4 +- .../operator/order_by/order_by_merge.h | 3 +- .../operator/order_by/order_by_scan.h | 2 +- .../processor/operator/order_by/radix_sort.h | 2 - .../processor/operator/order_by/top_k.h | 3 - src/include/processor/operator/partitioner.h | 1 - .../processor/operator/persistent/copy_node.h | 1 - .../operator/persistent/copy_rdf_resource.h | 1 - .../operator/persistent/copy_to_csv.h | 2 +- .../operator/persistent/csv_file_writer.h | 3 +- .../operator/persistent/delete_executor.h | 2 + .../operator/persistent/file_writer.h | 4 +- .../operator/persistent/insert_executor.h | 1 + .../operator/persistent/reader/csv/driver.h | 1 - .../operator/persistent/reader/npy_reader.h | 1 - .../persistent/reader/parquet/column_reader.h | 13 +- .../reader/parquet/list_column_reader.h | 1 - .../reader/parquet/parquet_reader.h | 2 +- .../reader/parquet/parquet_rle_bp_decoder.h | 2 - .../reader/parquet/resizable_buffer.h | 2 + .../reader/parquet/struct_column_reader.h | 1 - .../persistent/reader/parquet/thrift_tools.h | 4 +- .../persistent/reader/rdf/rdf_reader.h | 1 - .../operator/persistent/reader_functions.h | 2 +- .../operator/persistent/reader_state.h | 4 +- .../writer/parquet/string_column_writer.h | 1 - .../processor/operator/physical_operator.h | 2 - src/include/processor/operator/projection.h | 2 - .../operator/recursive_extend/bfs_state.h | 3 +- .../recursive_extend/frontier_scanner.h | 1 + .../recursive_extend/recursive_join.h | 2 +- .../operator/scan/scan_multi_rel_tables.h | 3 +- .../table_scan/factorized_table_scan.h | 5 +- .../operator/table_scan/union_all_scan.h | 3 +- src/include/processor/operator/unwind.h | 1 - src/include/processor/plan_mapper.h | 3 - src/include/processor/processor.h | 3 - .../processor/result/factorized_table.h | 5 +- .../processor/result/result_set_descriptor.h | 6 +- .../storage/buffer_manager/bm_file_handle.h | 3 + .../storage/buffer_manager/buffer_manager.h | 1 - .../storage/buffer_manager/memory_manager.h | 1 - src/include/storage/file_handle.h | 4 - .../in_mem_column_chunk.h | 150 -------- .../in_mem_storage_structure/in_mem_lists.h | 223 ------------ src/include/storage/index/hash_index.h | 1 - src/include/storage/index/hash_index_slot.h | 1 - src/include/storage/local_storage.h | 3 +- src/include/storage/local_table.h | 1 + .../storage/stats/node_table_statistics.h | 6 +- .../storage/stats/nodes_store_statistics.h | 3 + .../storage/stats/property_statistics.h | 4 +- .../storage/stats/rel_table_statistics.h | 6 +- .../storage/stats/rels_store_statistics.h | 1 + src/include/storage/stats/table_statistics.h | 5 +- .../stats/table_statistics_collection.h | 4 + src/include/storage/storage_info.h | 4 +- src/include/storage/storage_manager.h | 2 - .../storage/storage_structure/column.h | 254 -------------- .../storage/storage_structure/db_file_utils.h | 2 - .../storage/storage_structure/disk_array.h | 1 + .../storage_structure/disk_overflow_file.h | 2 - .../storage/storage_structure/in_mem_file.h | 2 +- .../storage/storage_structure/in_mem_page.h | 6 +- .../storage_structure/lists/list_headers.h | 114 ------ .../storage/storage_structure/lists/lists.h | 290 ---------------- .../storage_structure/lists/lists_metadata.h | 115 ------ .../lists/lists_update_store.h | 183 ---------- .../storage_structure/storage_structure.h | 124 ------- src/include/storage/storage_utils.h | 4 +- src/include/storage/store/column_chunk.h | 7 +- src/include/storage/store/compression.h | 2 +- src/include/storage/store/node_group.h | 5 +- src/include/storage/store/node_table.h | 2 +- src/include/storage/store/nodes_store.h | 1 - src/include/storage/store/rel_table.h | 1 - src/include/storage/store/rels_store.h | 1 - src/include/storage/store/sign_extend.h | 1 - src/include/storage/store/string_column.h | 1 - .../storage/store/string_column_chunk.h | 2 +- src/include/storage/store/struct_column.h | 1 - src/include/storage/store/var_list_column.h | 1 - .../storage/store/var_list_column_chunk.h | 3 + src/include/storage/wal/wal_record.h | 4 - src/include/storage/wal_replayer_utils.h | 5 +- src/include/transaction/transaction.h | 1 - src/include/transaction/transaction_context.h | 1 - src/include/transaction/transaction_manager.h | 1 - src/main/connection.cpp | 3 - src/main/database.cpp | 2 + src/main/prepared_statement.cpp | 2 +- src/main/query_result.cpp | 4 +- src/main/storage_driver.cpp | 2 + src/optimizer/filter_push_down_optimizer.cpp | 2 - src/parser/transformer.cpp | 2 +- .../join_order/cardinality_estimator.cpp | 3 +- src/planner/join_order_enumerator_context.cpp | 2 + .../operator/extend/logical_extend.cpp | 2 - .../extend/logical_recursive_extend.cpp | 1 - src/planner/operator/logical_dummy_scan.cpp | 1 + src/planner/operator/logical_order_by.cpp | 1 + src/planner/operator/logical_partitioner.cpp | 2 + .../operator/scan/logical_index_scan.cpp | 2 + src/planner/plan/append_accumulate.cpp | 1 + src/planner/plan/append_aggregate.cpp | 2 + src/planner/plan/append_create.cpp | 3 +- src/planner/plan/append_delete.cpp | 8 +- src/planner/plan/append_distinct.cpp | 4 +- src/planner/plan/append_extend.cpp | 4 +- src/planner/plan/append_filter.cpp | 2 + src/planner/plan/append_in_query_call.cpp | 2 + src/planner/plan/append_join.cpp | 9 +- src/planner/plan/append_order_by.cpp | 2 + src/planner/plan/append_projection.cpp | 2 + src/planner/plan/append_scan_node.cpp | 1 + src/planner/plan/append_set.cpp | 2 +- src/planner/plan/append_unwind.cpp | 2 + src/planner/plan/plan_copy.cpp | 4 +- src/planner/plan/plan_ddl.cpp | 2 + src/planner/plan/plan_join_order.cpp | 2 + src/planner/plan/plan_projection.cpp | 2 + src/planner/plan/plan_read.cpp | 2 + src/planner/plan/plan_single_query.cpp | 2 + src/planner/plan/plan_subquery.cpp | 7 +- src/planner/plan/plan_update.cpp | 8 +- src/planner/planner.cpp | 4 +- src/planner/query_planner.cpp | 3 + src/planner/subplans_table.cpp | 2 +- .../map/create_factorized_table_scan.cpp | 1 + src/processor/map/create_result_collector.cpp | 1 + src/processor/map/expression_mapper.cpp | 4 +- src/processor/map/map_copy_from.cpp | 2 +- src/processor/map/map_ddl.cpp | 14 +- src/processor/map/map_explain.cpp | 1 - src/processor/map/map_extend.cpp | 5 +- src/processor/map/map_insert.cpp | 1 - src/processor/map/map_intersect.cpp | 1 + src/processor/map/map_path_property_probe.cpp | 2 + src/processor/map/map_scan_node_property.cpp | 1 + src/processor/map/map_semi_masker.cpp | 1 + src/processor/map/map_set.cpp | 1 + src/processor/map/plan_mapper.cpp | 3 +- .../aggregate/aggregate_hash_table.cpp | 4 +- src/processor/operator/filtering_operator.cpp | 2 + .../operator/hash_join/hash_join_probe.cpp | 2 - .../operator/intersect/intersect.cpp | 2 + .../operator/order_by/key_block_merger.cpp | 2 - .../order_by/order_by_key_encoder.cpp | 6 +- .../operator/order_by/order_by_merge.cpp | 2 + src/processor/operator/order_by/top_k.cpp | 3 + .../operator/persistent/copy_rel_columns.cpp | 218 ------------ .../operator/persistent/copy_to_csv.cpp | 2 + .../operator/persistent/csv_file_writer.cpp | 4 + .../operator/persistent/insert_executor.cpp | 2 + .../persistent/parquet_column_writer.cpp | 225 ------------ .../persistent/reader/csv/base_csv_reader.cpp | 8 +- .../operator/persistent/reader/csv/driver.cpp | 3 - .../reader/csv/parallel_csv_reader.cpp | 6 + .../persistent/reader/npy/npy_reader.cpp | 2 +- .../reader/parquet/column_reader.cpp | 2 + .../reader/parquet/parquet_reader.cpp | 2 +- .../persistent/reader/rdf/rdf_reader.cpp | 5 +- .../operator/persistent/reader_functions.cpp | 3 +- .../operator/persistent/reader_state.cpp | 1 - .../writer/parquet/column_writer.cpp | 2 +- .../writer/parquet/string_column_writer.cpp | 1 + src/processor/operator/profile.cpp | 1 - .../recursive_extend/path_property_probe.cpp | 2 +- .../recursive_extend/recursive_join.cpp | 1 + src/processor/result/flat_tuple.cpp | 2 + src/storage/buffer_manager/bm_file_handle.cpp | 1 + src/storage/buffer_manager/buffer_manager.cpp | 3 + src/storage/buffer_manager/memory_manager.cpp | 1 - src/storage/file_handle.cpp | 3 +- src/storage/index/hash_index_utils.cpp | 1 + src/storage/local_table.cpp | 1 - src/storage/stats/node_table_statistics.cpp | 1 + src/storage/stats/nodes_store_statistics.cpp | 3 - src/storage/stats/table_statistics.cpp | 1 + src/storage/storage_structure/disk_array.cpp | 2 +- .../storage_structure/disk_overflow_file.cpp | 2 - src/storage/storage_structure/in_mem_page.cpp | 4 +- src/storage/storage_utils.cpp | 6 +- src/storage/store/column.cpp | 1 + src/storage/store/column_chunk.cpp | 3 - src/storage/store/compression.cpp | 2 - src/storage/store/node_group.cpp | 3 +- src/storage/store/node_table.cpp | 1 + src/storage/store/rel_table.cpp | 1 - src/storage/store/rel_table_data.cpp | 1 + src/storage/store/string_column.cpp | 1 + src/storage/store/string_column_chunk.cpp | 2 +- src/storage/store/struct_column.cpp | 1 - src/storage/store/struct_column_chunk.cpp | 6 - src/storage/store/var_list_column_chunk.cpp | 1 - src/storage/wal/wal.cpp | 5 +- src/storage/wal/wal_record.cpp | 16 +- src/storage/wal_replayer.cpp | 27 +- src/storage/wal_replayer_utils.cpp | 1 + src/transaction/transaction_context.cpp | 1 + src/transaction/transaction_manager.cpp | 2 + test/CMakeLists.txt | 7 + test/c_api/connection_test.cpp | 3 + test/c_api/data_type_test.cpp | 6 +- test/c_api/database_test.cpp | 7 +- test/c_api/flat_tuple_test.cpp | 2 + test/c_api/prepared_statement_test.cpp | 3 + test/c_api/query_result_test.cpp | 1 + test/c_api/value_test.cpp | 2 + test/common/date_test.cpp | 2 - test/common/time_test.cpp | 5 +- test/common/timestamp_test.cpp | 2 - test/graph_test/base_graph_test.cpp | 5 +- test/graph_test/graph_test.cpp | 4 + test/include/c_api_test/c_api_test.h | 14 +- test/include/graph_test/api_graph_test.h | 4 - test/include/graph_test/base_graph_test.h | 2 - test/include/graph_test/graph_test.h | 10 - .../main_test_helper/main_test_helper.h | 5 +- .../private_main_test_helper.h | 5 +- test/include/test_helper/test_helper.h | 10 +- .../test_runner/csv_to_parquet_converter.h | 4 +- test/include/test_runner/test_group.h | 7 +- test/include/test_runner/test_parser.h | 2 - test/include/test_runner/test_runner.h | 6 +- test/main/config_test.cpp | 1 + test/main/connection_test.cpp | 1 + test/main/storage_driver_test.cpp | 1 + test/runner/e2e_copy_transaction_test.cpp | 2 + test/runner/e2e_ddl_test.cpp | 1 + test/storage/CMakeLists.txt | 1 - test/storage/compression_test.cpp | 1 - test/storage/disk_array_update_test.cpp | 327 ------------------ test/storage/node_insertion_deletion_test.cpp | 3 +- test/test_helper/test_helper.cpp | 1 - test/test_runner/csv_to_parquet_converter.cpp | 122 ------- test/test_runner/test_parser.cpp | 1 + test/test_runner/test_runner.cpp | 2 + test/util_tests/string_format.cpp | 2 - third_party/CMakeLists.txt | 12 +- tools/benchmark/benchmark.cpp | 2 +- tools/java_api/src/jni/kuzu_java.cpp | 1 + tools/shell/embedded_shell.cpp | 1 + 463 files changed, 692 insertions(+), 3047 deletions(-) delete mode 100644 src/include/storage/in_mem_storage_structure/in_mem_column_chunk.h delete mode 100644 src/include/storage/in_mem_storage_structure/in_mem_lists.h delete mode 100644 src/include/storage/storage_structure/column.h delete mode 100644 src/include/storage/storage_structure/lists/list_headers.h delete mode 100644 src/include/storage/storage_structure/lists/lists.h delete mode 100644 src/include/storage/storage_structure/lists/lists_metadata.h delete mode 100644 src/include/storage/storage_structure/lists/lists_update_store.h delete mode 100644 src/include/storage/storage_structure/storage_structure.h delete mode 100644 src/processor/operator/persistent/copy_rel_columns.cpp delete mode 100644 src/processor/operator/persistent/parquet_column_writer.cpp delete mode 100644 test/storage/disk_array_update_test.cpp delete mode 100644 test/test_runner/csv_to_parquet_converter.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ff570be5..2c1e86acf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ option(ENABLE_WERROR "Treat all warnings as errors" FALSE) if(ENABLE_WERROR) set(CMAKE_COMPILE_WARNING_AS_ERROR TRUE) endif() - # Detect OS and architecture, copied from DuckDB set(OS_NAME "unknown") set(OS_ARCH "amd64") @@ -39,7 +38,6 @@ if(UNIX AND NOT APPLE) set(OS_NAME "linux") # sorry BSD endif() - if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() @@ -182,17 +180,17 @@ add_definitions(-DKUZU_STORAGE_VERSION="${CMAKE_PROJECT_VERSION}") include_directories(src/include) include_directories(third_party/antlr4_cypher/include) include_directories(third_party/antlr4_runtime/src) -include_directories(third_party/spdlog) +include_directories(third_party/fast_float/include) +include_directories(third_party/miniparquet/src) +include_directories(third_party/miniz) include_directories(third_party/nlohmann_json) -include_directories(third_party/pyparse) -include_directories(third_party/utf8proc/include) include_directories(third_party/pybind11/include) +include_directories(third_party/pyparse) include_directories(third_party/re2/include) include_directories(third_party/serd/include) -include_directories(third_party/miniparquet/src) -include_directories(third_party/fast_float/include) +include_directories(third_party/spdlog) +include_directories(third_party/utf8proc/include) include_directories(third_party/zstd/include) -include_directories(third_party/miniz) add_subdirectory(third_party) add_subdirectory(src) diff --git a/examples/c/main.c b/examples/c/main.c index 832577153a..5751423a30 100644 --- a/examples/c/main.c +++ b/examples/c/main.c @@ -1,4 +1,6 @@ +#include #include +#include #include "c_api/kuzu.h" @@ -32,7 +34,7 @@ int main() { int64_t age = kuzu_value_get_int64(value); kuzu_value_destroy(value); - printf("name: %s, age: %lld \n", name, age); + printf("name: %s, age: %" PRIi64 " \n", name, age); free(name); kuzu_flat_tuple_destroy(tuple); } diff --git a/src/binder/bind/bind_copy.cpp b/src/binder/bind/bind_copy.cpp index 70e913f67a..853129e969 100644 --- a/src/binder/bind/bind_copy.cpp +++ b/src/binder/bind/bind_copy.cpp @@ -6,6 +6,7 @@ #include "common/enums/table_type.h" #include "common/exception/binder.h" #include "common/exception/message.h" +#include "common/exception/not_implemented.h" #include "common/string_format.h" #include "parser/copy.h" #include "storage/storage_manager.h" @@ -111,7 +112,9 @@ std::unique_ptr Binder::bindCopyFromClause(const Statement& stat } } default: + // LCOV_EXCL_START throw NotImplementedException("bindCopyFromClause"); + // LCOV_EXCL_END } } @@ -240,7 +243,9 @@ expression_vector Binder::bindExpectedNodeFileColumns( } } break; default: { - throw NotImplementedException{"Binder::bindCopyNodeFileColumns"}; + // LCOV_EXCL_START + throw NotImplementedException("Binder::bindCopyNodeFileColumns"); + // LCOV_EXCL_END } } // Detect columns from file. @@ -299,7 +304,9 @@ expression_vector Binder::bindExpectedRelFileColumns( } } break; default: { - throw NotImplementedException{"Binder::bindCopyRelColumns"}; + // LCOV_EXCL_START + throw NotImplementedException("Binder::bindCopyRelColumns"); + // LCOV_EXCL_END } } // Detect columns from file. diff --git a/src/binder/bind/bind_ddl.cpp b/src/binder/bind/bind_ddl.cpp index 815c55b39d..27f03b060b 100644 --- a/src/binder/bind/bind_ddl.cpp +++ b/src/binder/bind/bind_ddl.cpp @@ -6,6 +6,7 @@ #include "catalog/rel_table_group_schema.h" #include "catalog/rel_table_schema.h" #include "common/exception/binder.h" +#include "common/exception/not_implemented.h" #include "common/string_format.h" #include "common/string_utils.h" #include "parser/ddl/alter.h" @@ -277,7 +278,9 @@ std::unique_ptr Binder::bindAlter(const parser::Statement& state return bindRenameProperty(statement); } default: + // LCOV_EXCL_START throw NotImplementedException("Binder::bindAlter"); + // LCOV_EXCL_END } } diff --git a/src/binder/bind/bind_file_scan.cpp b/src/binder/bind/bind_file_scan.cpp index dd62831434..87cfd57b74 100644 --- a/src/binder/bind/bind_file_scan.cpp +++ b/src/binder/bind/bind_file_scan.cpp @@ -1,5 +1,4 @@ #include "binder/binder.h" -#include "binder/copy/bound_file_scan_info.h" #include "binder/expression/literal_expression.h" #include "common/exception/binder.h" #include "common/exception/copy.h" diff --git a/src/binder/bind/bind_graph_pattern.cpp b/src/binder/bind/bind_graph_pattern.cpp index 49a87abae1..694aeb0ec2 100644 --- a/src/binder/bind/bind_graph_pattern.cpp +++ b/src/binder/bind/bind_graph_pattern.cpp @@ -1,8 +1,4 @@ -#include - #include "binder/binder.h" -#include "binder/expression/expression_util.h" -#include "binder/expression/function_expression.h" #include "binder/expression/path_expression.h" #include "binder/expression/property_expression.h" #include "catalog/node_table_schema.h" @@ -10,6 +6,7 @@ #include "catalog/rel_table_group_schema.h" #include "catalog/rel_table_schema.h" #include "common/exception/binder.h" +#include "common/exception/not_implemented.h" #include "common/string_format.h" #include "function/cast/functions/cast_string_to_functions.h" #include "main/client_context.h" diff --git a/src/binder/bind/bind_query.cpp b/src/binder/bind/bind_query.cpp index 6adfcc5916..a8cc775868 100644 --- a/src/binder/bind/bind_query.cpp +++ b/src/binder/bind/bind_query.cpp @@ -1,8 +1,6 @@ #include "binder/binder.h" #include "binder/query/return_with_clause/bound_return_clause.h" #include "binder/query/return_with_clause/bound_with_clause.h" -#include "parser/query/return_with_clause/return_clause.h" -#include "parser/query/return_with_clause/with_clause.h" using namespace kuzu::parser; diff --git a/src/binder/bind/bind_reading_clause.cpp b/src/binder/bind/bind_reading_clause.cpp index 012debac8c..393485a462 100644 --- a/src/binder/bind/bind_reading_clause.cpp +++ b/src/binder/bind/bind_reading_clause.cpp @@ -5,11 +5,13 @@ #include "binder/query/reading_clause/bound_unwind_clause.h" #include "common/exception/binder.h" #include "common/string_format.h" +#include "common/string_utils.h" #include "function/table_functions/bind_input.h" #include "parser/expression/parsed_function_expression.h" #include "parser/expression/parsed_literal_expression.h" #include "parser/query/reading_clause/in_query_call_clause.h" #include "parser/query/reading_clause/load_from.h" +#include "parser/query/reading_clause/match_clause.h" #include "parser/query/reading_clause/unwind_clause.h" #include "processor/operator/persistent/reader/csv/serial_csv_reader.h" #include "processor/operator/persistent/reader/npy_reader.h" diff --git a/src/binder/bind/bind_updating_clause.cpp b/src/binder/bind/bind_updating_clause.cpp index 088bdde861..06410c817b 100644 --- a/src/binder/bind/bind_updating_clause.cpp +++ b/src/binder/bind/bind_updating_clause.cpp @@ -1,11 +1,13 @@ #include "binder/binder.h" #include "binder/expression/expression_util.h" +#include "binder/expression/property_expression.h" #include "binder/query/updating_clause/bound_delete_clause.h" #include "binder/query/updating_clause/bound_insert_clause.h" #include "binder/query/updating_clause/bound_merge_clause.h" #include "binder/query/updating_clause/bound_set_clause.h" #include "catalog/node_table_schema.h" #include "common/exception/binder.h" +#include "common/exception/not_implemented.h" #include "common/string_format.h" #include "parser/query/updating_clause/delete_clause.h" #include "parser/query/updating_clause/insert_clause.h" diff --git a/src/binder/bind_expression/bind_function_expression.cpp b/src/binder/bind_expression/bind_function_expression.cpp index 9362ac1024..88aed511b9 100644 --- a/src/binder/bind_expression/bind_function_expression.cpp +++ b/src/binder/bind_expression/bind_function_expression.cpp @@ -1,7 +1,7 @@ #include "binder/binder.h" #include "binder/expression/expression_util.h" #include "binder/expression/function_expression.h" -#include "binder/expression/literal_expression.h" +#include "binder/expression/property_expression.h" #include "binder/expression_binder.h" #include "common/exception/binder.h" #include "common/exception/not_implemented.h" diff --git a/src/binder/bind_expression/bind_property_expression.cpp b/src/binder/bind_expression/bind_property_expression.cpp index 0628559930..dc490361a4 100644 --- a/src/binder/bind_expression/bind_property_expression.cpp +++ b/src/binder/bind_expression/bind_property_expression.cpp @@ -1,6 +1,8 @@ #include "binder/expression/expression_util.h" +#include "binder/expression/property_expression.h" #include "binder/expression/rel_expression.h" #include "binder/expression_binder.h" +#include "catalog/table_schema.h" #include "common/exception/binder.h" #include "common/string_format.h" #include "parser/expression/parsed_property_expression.h" diff --git a/src/binder/binder.cpp b/src/binder/binder.cpp index 56d6dddd5d..01767c0fd7 100644 --- a/src/binder/binder.cpp +++ b/src/binder/binder.cpp @@ -1,8 +1,6 @@ #include "binder/binder.h" #include "binder/bound_statement_rewriter.h" -#include "binder/expression/variable_expression.h" -#include "catalog/rel_table_schema.h" #include "common/exception/binder.h" #include "common/exception/not_implemented.h" #include "common/string_format.h" diff --git a/src/binder/expression_binder.cpp b/src/binder/expression_binder.cpp index 0fd4869e0b..c614a2b5ab 100644 --- a/src/binder/expression_binder.cpp +++ b/src/binder/expression_binder.cpp @@ -7,6 +7,7 @@ #include "binder/expression_visitor.h" #include "common/exception/binder.h" #include "common/exception/not_implemented.h" +#include "common/string_format.h" #include "expression_evaluator/expression_evaluator_utils.h" #include "function/cast/vector_cast_functions.h" diff --git a/src/binder/rewriter/with_clause_projection_rewriter.cpp b/src/binder/rewriter/with_clause_projection_rewriter.cpp index d90261c939..5ea0f1e0ed 100644 --- a/src/binder/rewriter/with_clause_projection_rewriter.cpp +++ b/src/binder/rewriter/with_clause_projection_rewriter.cpp @@ -1,5 +1,6 @@ #include "binder/rewriter/with_clause_projection_rewriter.h" +#include "binder/expression/property_expression.h" #include "binder/visitor/property_collector.h" using namespace kuzu::common; diff --git a/src/c_api/connection.cpp b/src/c_api/connection.cpp index 1f736041a0..add525690e 100644 --- a/src/c_api/connection.cpp +++ b/src/c_api/connection.cpp @@ -1,9 +1,6 @@ -#include "binder/bound_statement_result.h" -#include "c_api/helpers.h" #include "c_api/kuzu.h" #include "common/exception/exception.h" #include "main/kuzu.h" -#include "planner/operator/logical_plan.h" namespace kuzu { namespace common { diff --git a/src/c_api/data_type.cpp b/src/c_api/data_type.cpp index 49acc7277d..17fb47bb0a 100644 --- a/src/c_api/data_type.cpp +++ b/src/c_api/data_type.cpp @@ -1,8 +1,6 @@ #include "c_api/kuzu.h" #include "common/types/types.h" -#include "main/kuzu.h" -using namespace kuzu::main; using namespace kuzu::common; kuzu_logical_type* kuzu_data_type_create( diff --git a/src/c_api/prepared_statement.cpp b/src/c_api/prepared_statement.cpp index 4880dc570c..8133616331 100644 --- a/src/c_api/prepared_statement.cpp +++ b/src/c_api/prepared_statement.cpp @@ -1,9 +1,8 @@ -#include "binder/bound_statement.h" +#include "main/prepared_statement.h" + #include "c_api/helpers.h" #include "c_api/kuzu.h" #include "common/types/value/value.h" -#include "main/kuzu.h" -#include "planner/operator/logical_plan.h" using namespace kuzu::common; using namespace kuzu::main; diff --git a/src/c_api/query_result.cpp b/src/c_api/query_result.cpp index 36feba1aa2..cc7c25b8ac 100644 --- a/src/c_api/query_result.cpp +++ b/src/c_api/query_result.cpp @@ -1,6 +1,7 @@ +#include "main/query_result.h" + #include "c_api/helpers.h" #include "c_api/kuzu.h" -#include "main/kuzu.h" using namespace kuzu::main; using namespace kuzu::common; diff --git a/src/c_api/query_summary.cpp b/src/c_api/query_summary.cpp index 4af920baaf..72f1ed1965 100644 --- a/src/c_api/query_summary.cpp +++ b/src/c_api/query_summary.cpp @@ -1,7 +1,8 @@ #include "main/query_summary.h" +#include + #include "c_api/kuzu.h" -#include "json.hpp" using namespace kuzu::main; diff --git a/src/c_api/value.cpp b/src/c_api/value.cpp index 21f73c6260..c8a189d5fe 100644 --- a/src/c_api/value.cpp +++ b/src/c_api/value.cpp @@ -9,10 +9,8 @@ #include "common/types/value/recursive_rel.h" #include "common/types/value/rel.h" #include "function/cast/functions/cast_string_to_functions.h" -#include "main/kuzu.h" using namespace kuzu::common; -using namespace kuzu::main; kuzu_value* kuzu_value_create_null() { auto* c_value = (kuzu_value*)calloc(1, sizeof(kuzu_value)); diff --git a/src/catalog/catalog_content.cpp b/src/catalog/catalog_content.cpp index 520cc0e320..0e2d626815 100644 --- a/src/catalog/catalog_content.cpp +++ b/src/catalog/catalog_content.cpp @@ -5,6 +5,7 @@ #include "catalog/rel_table_group_schema.h" #include "catalog/rel_table_schema.h" #include "common/exception/catalog.h" +#include "common/exception/not_implemented.h" #include "common/exception/runtime.h" #include "common/serializer/buffered_file.h" #include "common/serializer/deserializer.h" @@ -216,9 +217,9 @@ ExpressionType CatalogContent::getFunctionType(const std::string& name) const { return FUNCTION; case function::FunctionType::AGGREGATE: return AGGREGATE_FUNCTION; - // LCOV_EXCL_START default: - throw NotImplementedException{"CatalogContent::getFunctionType"}; + // LCOV_EXCL_START + throw NotImplementedException("CatalogContent::getFunctionType"); // LCOV_EXCL_END } } diff --git a/src/common/arrow/arrow_converter.cpp b/src/common/arrow/arrow_converter.cpp index 51e827dbfc..480145db89 100644 --- a/src/common/arrow/arrow_converter.cpp +++ b/src/common/arrow/arrow_converter.cpp @@ -1,5 +1,7 @@ #include "common/arrow/arrow_converter.h" +#include + #include "common/arrow/arrow_row_batch.h" #include "common/exception/internal.h" diff --git a/src/common/arrow/arrow_row_batch.cpp b/src/common/arrow/arrow_row_batch.cpp index 43193b2c86..593a905fb4 100644 --- a/src/common/arrow/arrow_row_batch.cpp +++ b/src/common/arrow/arrow_row_batch.cpp @@ -1,5 +1,8 @@ #include "common/arrow/arrow_row_batch.h" +#include + +#include "common/exception/runtime.h" #include "common/types/value/node.h" #include "common/types/value/rel.h" #include "common/types/value/value.h" diff --git a/src/common/logging_level_utils.cpp b/src/common/logging_level_utils.cpp index 24dd810697..dca26b787b 100644 --- a/src/common/logging_level_utils.cpp +++ b/src/common/logging_level_utils.cpp @@ -3,7 +3,6 @@ #include "common/exception/conversion.h" #include "common/string_format.h" #include "common/string_utils.h" -#include "common/utils.h" namespace kuzu { namespace common { diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index d738025c39..411e318253 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -1,7 +1,5 @@ #include "common/profiler.h" -#include - namespace kuzu { namespace common { diff --git a/src/common/string_utils.cpp b/src/common/string_utils.cpp index f2ecc792e9..ef292c8fa3 100644 --- a/src/common/string_utils.cpp +++ b/src/common/string_utils.cpp @@ -1,5 +1,6 @@ #include "common/string_utils.h" +#include #include namespace kuzu { diff --git a/src/common/task_system/task_scheduler.cpp b/src/common/task_system/task_scheduler.cpp index be52f2f249..ee98eb2cb3 100644 --- a/src/common/task_system/task_scheduler.cpp +++ b/src/common/task_system/task_scheduler.cpp @@ -1,7 +1,6 @@ #include "common/task_system/task_scheduler.h" #include "common/constants.h" -#include "spdlog/spdlog.h" using namespace kuzu::common; diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index a4a4c1ae46..a573a51678 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -1,6 +1,5 @@ #include "common/type_utils.h" -#include "common/exception/conversion.h" #include "common/exception/runtime.h" #include "common/types/blob.h" #include "common/vector/value_vector.h" diff --git a/src/common/types/date_t.cpp b/src/common/types/date_t.cpp index 1022621e89..b601053e1d 100644 --- a/src/common/types/date_t.cpp +++ b/src/common/types/date_t.cpp @@ -6,7 +6,6 @@ #include "common/string_utils.h" #include "common/types/cast_helpers.h" #include "common/types/timestamp_t.h" -#include "common/utils.h" namespace kuzu { namespace common { diff --git a/src/common/types/dtime_t.cpp b/src/common/types/dtime_t.cpp index 4d4f0052ab..586f14dbed 100644 --- a/src/common/types/dtime_t.cpp +++ b/src/common/types/dtime_t.cpp @@ -1,10 +1,11 @@ #include "common/types/dtime_t.h" +#include + #include "common/exception/conversion.h" #include "common/string_format.h" #include "common/types/cast_helpers.h" #include "common/types/date_t.h" -#include "common/utils.h" namespace kuzu { namespace common { diff --git a/src/common/types/int128_t.cpp b/src/common/types/int128_t.cpp index 961c6e53e0..79aeb53358 100644 --- a/src/common/types/int128_t.cpp +++ b/src/common/types/int128_t.cpp @@ -1,10 +1,8 @@ #include "common/types/int128_t.h" #include -#include #include "common/exception/overflow.h" -#include "common/types/ku_string.h" #include "function/cast/functions/numeric_limits.h" namespace kuzu::common { diff --git a/src/common/types/ku_list.cpp b/src/common/types/ku_list.cpp index 696d2c04fa..f0d530d4d2 100644 --- a/src/common/types/ku_list.cpp +++ b/src/common/types/ku_list.cpp @@ -1,5 +1,7 @@ #include "common/types/ku_list.h" +#include + #include "storage/storage_utils.h" namespace kuzu { diff --git a/src/common/types/types.cpp b/src/common/types/types.cpp index 6795e16e84..e55304648f 100644 --- a/src/common/types/types.cpp +++ b/src/common/types/types.cpp @@ -1,6 +1,6 @@ #include "common/types/types.h" -#include +#include #include "common/constants.h" #include "common/exception/binder.h" diff --git a/src/common/types/value/value.cpp b/src/common/types/value/value.cpp index 9b5dc9fa1c..5d4e76ec11 100644 --- a/src/common/types/value/value.cpp +++ b/src/common/types/value/value.cpp @@ -1,8 +1,11 @@ #include "common/types/value/value.h" +#include "common/exception/not_implemented.h" +#include "common/exception/runtime.h" #include "common/null_buffer.h" #include "common/serializer/deserializer.h" #include "common/serializer/serializer.h" +#include "common/type_utils.h" #include "common/types/blob.h" #include "storage/storage_utils.h" @@ -357,9 +360,11 @@ void Value::copyValueFrom(const Value& other) { } } break; default: + // LCOV_EXCL_START throw NotImplementedException("Value::Value(const Value&) for type " + LogicalTypeUtils::dataTypeToString(*dataType) + " is not implemented."); + // LCOV_EXCL_END } } @@ -480,9 +485,11 @@ std::string Value::toString() const { return result; } default: + // LCOV_EXCL_START throw NotImplementedException("Value::toString for type " + LogicalTypeUtils::dataTypeToString(*dataType) + " is not implemented."); + // LCOV_EXCL_END } } @@ -623,7 +630,9 @@ void Value::serialize(Serializer& serializer) const { } } break; default: { - throw NotImplementedException{"Value::serialize"}; + // LCOV_EXCL_START + throw NotImplementedException("Value::serialize"); + // LCOV_EXCL_END } } serializer.serializeValue(childrenSize); @@ -686,7 +695,9 @@ std::unique_ptr Value::deserialize(Deserializer& deserializer) { deserializer.deserializeVectorOfPtrs(val->children); } break; default: { - throw NotImplementedException{"Value::deserializeValue"}; + // LCOV_EXCL_START + throw NotImplementedException("Value::deserializeValue"); + // LCOV_EXCL_END } } deserializer.deserializeValue(val->childrenSize); diff --git a/src/common/vector/value_vector.cpp b/src/common/vector/value_vector.cpp index f2569147e2..2875d4c7e4 100644 --- a/src/common/vector/value_vector.cpp +++ b/src/common/vector/value_vector.cpp @@ -1,5 +1,6 @@ #include "common/vector/value_vector.h" +#include "common/exception/not_implemented.h" #include "common/null_buffer.h" #include "common/types/value/nested.h" #include "common/types/value/value.h" diff --git a/src/expression_evaluator/case_evaluator.cpp b/src/expression_evaluator/case_evaluator.cpp index 1602e786dc..06a70fa5a7 100644 --- a/src/expression_evaluator/case_evaluator.cpp +++ b/src/expression_evaluator/case_evaluator.cpp @@ -1,5 +1,8 @@ #include "expression_evaluator/case_evaluator.h" +#include + +#include "common/exception/not_implemented.h" #include "common/types/date_t.h" #include "common/types/interval_t.h" #include "common/types/ku_string.h" diff --git a/src/expression_evaluator/path_evaluator.cpp b/src/expression_evaluator/path_evaluator.cpp index 46ae189e1b..9049a651ac 100644 --- a/src/expression_evaluator/path_evaluator.cpp +++ b/src/expression_evaluator/path_evaluator.cpp @@ -1,6 +1,7 @@ #include "expression_evaluator/path_evaluator.h" #include "binder/expression/path_expression.h" +#include "binder/expression/rel_expression.h" #include "common/string_utils.h" using namespace kuzu::common; diff --git a/src/function/aggregate_function.cpp b/src/function/aggregate_function.cpp index 66c0a87819..6f0acf962b 100644 --- a/src/function/aggregate_function.cpp +++ b/src/function/aggregate_function.cpp @@ -1,9 +1,11 @@ #include "function/aggregate_function.h" +#include "common/exception/not_implemented.h" +#include "common/types/interval_t.h" #include "function/aggregate/avg.h" -#include "function/aggregate/collect.h" #include "function/aggregate/min_max.h" #include "function/aggregate/sum.h" +#include "function/comparison/comparison_functions.h" using namespace kuzu::common; using namespace kuzu::function; diff --git a/src/function/base_lower_upper_operation.cpp b/src/function/base_lower_upper_operation.cpp index 2d1248c610..862ebf26dd 100644 --- a/src/function/base_lower_upper_operation.cpp +++ b/src/function/base_lower_upper_operation.cpp @@ -1,7 +1,7 @@ -#include "common/assert.h" #include "common/exception/runtime.h" #include "common/string_format.h" #include "function/string/functions/base_lower_upper_function.h" +#include "utf8proc.h" using namespace kuzu::common; using namespace kuzu::utf8proc; diff --git a/src/function/cast_string_to_functions.cpp b/src/function/cast_string_to_functions.cpp index ded1a86e31..80d38e319a 100644 --- a/src/function/cast_string_to_functions.cpp +++ b/src/function/cast_string_to_functions.cpp @@ -1,7 +1,7 @@ #include "function/cast/functions/cast_string_to_functions.h" #include "common/exception/copy.h" -#include "common/exception/message.h" +#include "common/exception/not_implemented.h" #include "common/exception/parser.h" #include "common/string_format.h" #include "common/types/blob.h" diff --git a/src/function/comparison_functions.cpp b/src/function/comparison_functions.cpp index 21ef22adff..aae066562a 100644 --- a/src/function/comparison_functions.cpp +++ b/src/function/comparison_functions.cpp @@ -1,5 +1,11 @@ #include "function/comparison/comparison_functions.h" +#include + +#include "common/exception/not_implemented.h" +#include "common/types/int128_t.h" +#include "common/types/interval_t.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/function/table_functions/call_functions.cpp b/src/function/table_functions/call_functions.cpp index 9f320fd68e..905d830ba2 100644 --- a/src/function/table_functions/call_functions.cpp +++ b/src/function/table_functions/call_functions.cpp @@ -4,6 +4,7 @@ #include "catalog/rel_table_group_schema.h" #include "catalog/rel_table_schema.h" #include "common/exception/binder.h" +#include "common/exception/not_implemented.h" namespace kuzu { namespace function { diff --git a/src/function/vector_arithmetic_functions.cpp b/src/function/vector_arithmetic_functions.cpp index ceae00db8b..62d55fc598 100644 --- a/src/function/vector_arithmetic_functions.cpp +++ b/src/function/vector_arithmetic_functions.cpp @@ -1,5 +1,10 @@ #include "function/arithmetic/vector_arithmetic_functions.h" +#include "common/types/date_t.h" +#include "common/types/interval_t.h" +#include "common/types/timestamp_t.h" +#include "function/arithmetic/arithmetic_functions.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/function/vector_cast_functions.cpp b/src/function/vector_cast_functions.cpp index 7049e106b7..c01592ab0d 100644 --- a/src/function/vector_cast_functions.cpp +++ b/src/function/vector_cast_functions.cpp @@ -1,5 +1,7 @@ #include "function/cast/vector_cast_functions.h" +#include "function/cast/functions/cast_functions.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/function/vector_list_functions.cpp b/src/function/vector_list_functions.cpp index 9f53527e73..c276f1fc28 100644 --- a/src/function/vector_list_functions.cpp +++ b/src/function/vector_list_functions.cpp @@ -1,11 +1,9 @@ #include "function/list/vector_list_functions.h" -#include "binder/expression/literal_expression.h" #include "binder/expression_binder.h" #include "common/exception/binder.h" #include "common/exception/not_implemented.h" #include "common/exception/runtime.h" -#include "common/types/ku_list.h" #include "function/list/functions/list_any_value_function.h" #include "function/list/functions/list_append_function.h" #include "function/list/functions/list_concat_function.h" diff --git a/src/include/binder/binder.h b/src/include/binder/binder.h index ee36aeaff0..90657589b5 100644 --- a/src/include/binder/binder.h +++ b/src/include/binder/binder.h @@ -1,9 +1,13 @@ #pragma once #include "binder/query/bound_regular_query.h" +#include "binder/query/query_graph.h" +#include "catalog/catalog.h" +#include "common/copier_config/copier_config.h" #include "expression_binder.h" -#include "parser/copy.h" +#include "parser/query/graph_pattern/pattern_element.h" #include "parser/query/regular_query.h" +#include "storage/storage_manager.h" namespace kuzu { namespace parser { diff --git a/src/include/binder/bound_comment_on.h b/src/include/binder/bound_comment_on.h index d397d9b8eb..87aad0a0c2 100644 --- a/src/include/binder/bound_comment_on.h +++ b/src/include/binder/bound_comment_on.h @@ -1,5 +1,6 @@ #pragma once +#include "binder/bound_statement.h" #include "bound_statement_result.h" #include "common/enums/statement_type.h" diff --git a/src/include/binder/bound_standalone_call.h b/src/include/binder/bound_standalone_call.h index 27061971fd..8a8bd1105f 100644 --- a/src/include/binder/bound_standalone_call.h +++ b/src/include/binder/bound_standalone_call.h @@ -1,5 +1,6 @@ #pragma once +#include "binder/bound_statement.h" #include "binder/expression/expression.h" #include "main/db_config.h" diff --git a/src/include/binder/copy/bound_copy_from.h b/src/include/binder/copy/bound_copy_from.h index e19e896678..2a54dcdd92 100644 --- a/src/include/binder/copy/bound_copy_from.h +++ b/src/include/binder/copy/bound_copy_from.h @@ -3,7 +3,6 @@ #include "binder/bound_statement.h" #include "bound_file_scan_info.h" #include "catalog/table_schema.h" -#include "common/copier_config/copier_config.h" namespace kuzu { namespace binder { diff --git a/src/include/binder/copy/bound_copy_to.h b/src/include/binder/copy/bound_copy_to.h index 5f45d6500d..a374650609 100644 --- a/src/include/binder/copy/bound_copy_to.h +++ b/src/include/binder/copy/bound_copy_to.h @@ -1,9 +1,5 @@ #pragma once -#include -#include -#include - #include "binder/query/bound_regular_query.h" #include "common/copier_config/copier_config.h" diff --git a/src/include/binder/copy/bound_file_scan_info.h b/src/include/binder/copy/bound_file_scan_info.h index 1e1664cdf0..1114149494 100644 --- a/src/include/binder/copy/bound_file_scan_info.h +++ b/src/include/binder/copy/bound_file_scan_info.h @@ -1,8 +1,8 @@ #pragma once #include "binder/expression/expression.h" -#include "catalog/table_schema.h" #include "common/copier_config/copier_config.h" +#include "common/enums/table_type.h" namespace kuzu { namespace binder { diff --git a/src/include/binder/ddl/bound_create_table_info.h b/src/include/binder/ddl/bound_create_table_info.h index fb73c9c0cd..42e2d2acca 100644 --- a/src/include/binder/ddl/bound_create_table_info.h +++ b/src/include/binder/ddl/bound_create_table_info.h @@ -1,6 +1,7 @@ #pragma once -#include "catalog/table_schema.h" +#include "catalog/property.h" +#include "common/enums/table_type.h" namespace kuzu { namespace catalog { diff --git a/src/include/binder/expression/existential_subquery_expression.h b/src/include/binder/expression/existential_subquery_expression.h index 54cb59ebc6..865f24eec2 100644 --- a/src/include/binder/expression/existential_subquery_expression.h +++ b/src/include/binder/expression/existential_subquery_expression.h @@ -1,6 +1,6 @@ #pragma once -#include "binder/query/reading_clause/bound_match_clause.h" +#include "binder/query/query_graph.h" #include "expression.h" namespace kuzu { diff --git a/src/include/binder/expression/node_expression.h b/src/include/binder/expression/node_expression.h index a7b4b350f8..4dcfc68bfa 100644 --- a/src/include/binder/expression/node_expression.h +++ b/src/include/binder/expression/node_expression.h @@ -1,7 +1,6 @@ #pragma once #include "node_rel_expression.h" -#include "property_expression.h" namespace kuzu { namespace binder { diff --git a/src/include/binder/expression/path_expression.h b/src/include/binder/expression/path_expression.h index f2cb4d8676..95046fd4f8 100644 --- a/src/include/binder/expression/path_expression.h +++ b/src/include/binder/expression/path_expression.h @@ -1,7 +1,6 @@ #pragma once -#include "node_expression.h" -#include "rel_expression.h" +#include "binder/expression/expression.h" namespace kuzu { namespace binder { diff --git a/src/include/binder/expression/rel_expression.h b/src/include/binder/expression/rel_expression.h index 669596aa8f..1aa53a734a 100644 --- a/src/include/binder/expression/rel_expression.h +++ b/src/include/binder/expression/rel_expression.h @@ -1,5 +1,6 @@ #pragma once +#include "common/constants.h" #include "common/enums/query_rel_type.h" #include "node_expression.h" diff --git a/src/include/binder/expression_binder.h b/src/include/binder/expression_binder.h index 4a1956fe6f..59011f7cc1 100644 --- a/src/include/binder/expression_binder.h +++ b/src/include/binder/expression_binder.h @@ -1,7 +1,6 @@ #pragma once #include "binder/expression/expression.h" -#include "catalog/catalog.h" #include "parser/expression/parsed_expression.h" namespace kuzu { diff --git a/src/include/binder/query/normalized_query_part.h b/src/include/binder/query/normalized_query_part.h index 544b8144ab..1abe1eb363 100644 --- a/src/include/binder/query/normalized_query_part.h +++ b/src/include/binder/query/normalized_query_part.h @@ -3,7 +3,6 @@ #include "binder/query/reading_clause/bound_reading_clause.h" #include "binder/query/return_with_clause/bound_projection_body.h" #include "binder/query/updating_clause/bound_updating_clause.h" -#include "query_graph.h" namespace kuzu { namespace binder { diff --git a/src/include/binder/query/reading_clause/bound_reading_clause.h b/src/include/binder/query/reading_clause/bound_reading_clause.h index 976dcc26a6..1b66bf0eeb 100644 --- a/src/include/binder/query/reading_clause/bound_reading_clause.h +++ b/src/include/binder/query/reading_clause/bound_reading_clause.h @@ -2,7 +2,6 @@ #include -#include "binder/expression/expression.h" #include "common/enums/clause_type.h" namespace kuzu { diff --git a/src/include/binder/query/updating_clause/bound_delete_info.h b/src/include/binder/query/updating_clause/bound_delete_info.h index 8f44792ff0..bfc626244f 100644 --- a/src/include/binder/query/updating_clause/bound_delete_info.h +++ b/src/include/binder/query/updating_clause/bound_delete_info.h @@ -1,6 +1,6 @@ #pragma once -#include "binder/expression/rel_expression.h" +#include "binder/expression/expression.h" #include "update_table_type.h" namespace kuzu { diff --git a/src/include/binder/query/updating_clause/bound_insert_info.h b/src/include/binder/query/updating_clause/bound_insert_info.h index 1a3700a760..ef61d74c1e 100644 --- a/src/include/binder/query/updating_clause/bound_insert_info.h +++ b/src/include/binder/query/updating_clause/bound_insert_info.h @@ -1,6 +1,6 @@ #pragma once -#include "binder/expression/rel_expression.h" +#include "binder/expression/expression.h" #include "update_table_type.h" namespace kuzu { diff --git a/src/include/binder/query/updating_clause/bound_updating_clause.h b/src/include/binder/query/updating_clause/bound_updating_clause.h index 18a38915dc..5c161a7f2a 100644 --- a/src/include/binder/query/updating_clause/bound_updating_clause.h +++ b/src/include/binder/query/updating_clause/bound_updating_clause.h @@ -1,6 +1,7 @@ #pragma once -#include "binder/expression/expression.h" +#include + #include "common/enums/clause_type.h" namespace kuzu { diff --git a/src/include/c_api/kuzu.h b/src/include/c_api/kuzu.h index 7ce7e63cd7..61ce2861c5 100644 --- a/src/include/c_api/kuzu.h +++ b/src/include/c_api/kuzu.h @@ -1,8 +1,6 @@ #pragma once #include #include -#include -#include /* Export header from common/api.h */ // Helpers diff --git a/src/include/catalog/node_table_schema.h b/src/include/catalog/node_table_schema.h index 0c21499899..655844a403 100644 --- a/src/include/catalog/node_table_schema.h +++ b/src/include/catalog/node_table_schema.h @@ -1,5 +1,6 @@ #pragma once +#include "common/constants.h" #include "table_schema.h" namespace kuzu { diff --git a/src/include/catalog/rdf_graph_schema.h b/src/include/catalog/rdf_graph_schema.h index b3f0c56d22..1819287e8a 100644 --- a/src/include/catalog/rdf_graph_schema.h +++ b/src/include/catalog/rdf_graph_schema.h @@ -1,5 +1,6 @@ #pragma once +#include "common/constants.h" #include "table_schema.h" namespace kuzu { diff --git a/src/include/catalog/rel_table_group_schema.h b/src/include/catalog/rel_table_group_schema.h index 274f635c17..2262a6854a 100644 --- a/src/include/catalog/rel_table_group_schema.h +++ b/src/include/catalog/rel_table_group_schema.h @@ -1,5 +1,6 @@ #pragma once +#include "common/constants.h" #include "table_schema.h" namespace kuzu { diff --git a/src/include/catalog/rel_table_schema.h b/src/include/catalog/rel_table_schema.h index 87aca20bfd..a44ec47deb 100644 --- a/src/include/catalog/rel_table_schema.h +++ b/src/include/catalog/rel_table_schema.h @@ -1,5 +1,6 @@ #pragma once +#include "common/constants.h" #include "common/enums/rel_direction.h" #include "table_schema.h" diff --git a/src/include/catalog/table_schema.h b/src/include/catalog/table_schema.h index d217ed38a5..db7bff4a6d 100644 --- a/src/include/catalog/table_schema.h +++ b/src/include/catalog/table_schema.h @@ -1,10 +1,7 @@ #pragma once #include -#include -#include -#include "common/constants.h" #include "common/enums/table_type.h" #include "property.h" diff --git a/src/include/common/arrow/arrow_converter.h b/src/include/common/arrow/arrow_converter.h index f946cb46ad..6ec50ee25d 100644 --- a/src/include/common/arrow/arrow_converter.h +++ b/src/include/common/arrow/arrow_converter.h @@ -4,7 +4,6 @@ #include #include "common/arrow/arrow.h" -#include "common/types/types.h" #include "main/query_result.h" struct ArrowSchema; diff --git a/src/include/common/constants.h b/src/include/common/constants.h index 839f5ae507..9da83ab1ed 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -1,8 +1,7 @@ #pragma once #include -#include -#include +#include namespace kuzu { namespace common { diff --git a/src/include/common/copier_config/copier_config.h b/src/include/common/copier_config/copier_config.h index 6bba1e9d29..601f19bd6f 100644 --- a/src/include/common/copier_config/copier_config.h +++ b/src/include/common/copier_config/copier_config.h @@ -1,12 +1,9 @@ #pragma once -#include -#include #include #include #include "common/constants.h" -#include "common/enums/table_type.h" #include "common/types/types.h" #include "rdf_config.h" diff --git a/src/include/common/data_chunk/data_chunk_state.h b/src/include/common/data_chunk/data_chunk_state.h index 15ec574bd2..c4066450dd 100644 --- a/src/include/common/data_chunk/data_chunk_state.h +++ b/src/include/common/data_chunk/data_chunk_state.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/data_chunk/sel_vector.h" namespace kuzu { diff --git a/src/include/common/exception/exception.h b/src/include/common/exception/exception.h index 6a5e962c68..6833ef605d 100644 --- a/src/include/common/exception/exception.h +++ b/src/include/common/exception/exception.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include namespace kuzu { diff --git a/src/include/common/in_mem_overflow_buffer.h b/src/include/common/in_mem_overflow_buffer.h index ffdbf217fb..a2678a53dd 100644 --- a/src/include/common/in_mem_overflow_buffer.h +++ b/src/include/common/in_mem_overflow_buffer.h @@ -1,10 +1,11 @@ #pragma once +#include #include +#include "common/constants.h" #include "common/exception/runtime.h" #include "storage/buffer_manager/memory_manager.h" -#include "storage/file_handle.h" namespace kuzu { namespace common { diff --git a/src/include/common/logging_level_utils.h b/src/include/common/logging_level_utils.h index 34970e47df..bb32ac15ba 100644 --- a/src/include/common/logging_level_utils.h +++ b/src/include/common/logging_level_utils.h @@ -1,6 +1,6 @@ #pragma once -#include "spdlog/spdlog.h" +#include "spdlog/spdlog.h" // IWYU pragma: keep: this is the public header. namespace kuzu { namespace common { diff --git a/src/include/common/metric.h b/src/include/common/metric.h index 0dec4a6c73..afb83b9063 100644 --- a/src/include/common/metric.h +++ b/src/include/common/metric.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/timer.h" namespace kuzu { diff --git a/src/include/common/null_buffer.h b/src/include/common/null_buffer.h index d2c7b5420e..db7fbb45f7 100644 --- a/src/include/common/null_buffer.h +++ b/src/include/common/null_buffer.h @@ -1,6 +1,7 @@ #pragma once #include +#include namespace kuzu { namespace common { diff --git a/src/include/common/null_mask.h b/src/include/common/null_mask.h index 5da46f89ca..283c99a25d 100644 --- a/src/include/common/null_mask.h +++ b/src/include/common/null_mask.h @@ -2,7 +2,6 @@ #include #include -#include #include "common/constants.h" diff --git a/src/include/common/profiler.h b/src/include/common/profiler.h index 0388a0c105..3193cec164 100644 --- a/src/include/common/profiler.h +++ b/src/include/common/profiler.h @@ -1,7 +1,9 @@ #pragma once #include +#include #include +#include #include "common/metric.h" diff --git a/src/include/common/serializer/buffered_file.h b/src/include/common/serializer/buffered_file.h index e507807155..6f6a9b6bd1 100644 --- a/src/include/common/serializer/buffered_file.h +++ b/src/include/common/serializer/buffered_file.h @@ -3,10 +3,6 @@ #include #include #include -#include -#include -#include -#include #include "common/serializer/reader.h" #include "common/serializer/writer.h" diff --git a/src/include/common/string_format.h b/src/include/common/string_format.h index 571bd956f3..9c11134726 100644 --- a/src/include/common/string_format.h +++ b/src/include/common/string_format.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include diff --git a/src/include/common/string_utils.h b/src/include/common/string_utils.h index 761c6e748c..5ebe317e26 100644 --- a/src/include/common/string_utils.h +++ b/src/include/common/string_utils.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/src/include/common/task_system/task_scheduler.h b/src/include/common/task_system/task_scheduler.h index b26683cf38..a977ccea0d 100644 --- a/src/include/common/task_system/task_scheduler.h +++ b/src/include/common/task_system/task_scheduler.h @@ -5,7 +5,6 @@ #include #include "common/task_system/task.h" -#include "common/utils.h" #include "processor/execution_context.h" namespace kuzu { diff --git a/src/include/common/timer.h b/src/include/common/timer.h index 4bb5a1d4e5..17f208fc88 100644 --- a/src/include/common/timer.h +++ b/src/include/common/timer.h @@ -1,9 +1,7 @@ #pragma once #include -#include #include -#include #include "exception/exception.h" diff --git a/src/include/common/type_utils.h b/src/include/common/type_utils.h index 8708e62ba3..b9246bd96f 100644 --- a/src/include/common/type_utils.h +++ b/src/include/common/type_utils.h @@ -1,8 +1,7 @@ #pragma once -#include +#include -#include "common/exception/conversion.h" #include "common/types/date_t.h" #include "common/types/int128_t.h" #include "common/types/interval_t.h" diff --git a/src/include/common/types/blob.h b/src/include/common/types/blob.h index 1f64485a01..801de319dc 100644 --- a/src/include/common/types/blob.h +++ b/src/include/common/types/blob.h @@ -1,6 +1,5 @@ #pragma once -#include "common/api.h" #include "common/types/ku_string.h" namespace kuzu { diff --git a/src/include/common/types/int128_t.h b/src/include/common/types/int128_t.h index 7e02d9cd34..97dad418ba 100644 --- a/src/include/common/types/int128_t.h +++ b/src/include/common/types/int128_t.h @@ -4,10 +4,11 @@ // ========================================================================================= #pragma once -#include +#include +#include +#include #include "common/api.h" -#include "common/string_utils.h" namespace kuzu { namespace common { diff --git a/src/include/common/types/types.h b/src/include/common/types/types.h index c31e63bdf4..34be79ec06 100644 --- a/src/include/common/types/types.h +++ b/src/include/common/types/types.h @@ -1,9 +1,6 @@ #pragma once #include -#include -#include -#include #include #include #include diff --git a/src/include/common/types/value/value.h b/src/include/common/types/value/value.h index 9d07e2d75e..eed6271cca 100644 --- a/src/include/common/types/value/value.h +++ b/src/include/common/types/value/value.h @@ -1,9 +1,8 @@ #pragma once -#include +#include #include "common/api.h" -#include "common/type_utils.h" #include "common/types/date_t.h" #include "common/types/int128_t.h" #include "common/types/internal_id_t.h" diff --git a/src/include/common/utils.h b/src/include/common/utils.h index c16d8c8b07..b59032e50d 100644 --- a/src/include/common/utils.h +++ b/src/include/common/utils.h @@ -1,13 +1,8 @@ #pragma once -#include #include -#include #include -#include #include -#include -#include #include "common/constants.h" diff --git a/src/include/expression_evaluator/case_evaluator.h b/src/include/expression_evaluator/case_evaluator.h index be6bfa9678..a0f5001f81 100644 --- a/src/include/expression_evaluator/case_evaluator.h +++ b/src/include/expression_evaluator/case_evaluator.h @@ -2,6 +2,7 @@ #include +#include "binder/expression/expression.h" #include "expression_evaluator.h" namespace kuzu { diff --git a/src/include/expression_evaluator/expression_evaluator.h b/src/include/expression_evaluator/expression_evaluator.h index 680ca483ea..9240d526b3 100644 --- a/src/include/expression_evaluator/expression_evaluator.h +++ b/src/include/expression_evaluator/expression_evaluator.h @@ -1,8 +1,5 @@ #pragma once -#include - -#include "binder/expression/expression.h" #include "processor/result/result_set.h" namespace kuzu { diff --git a/src/include/expression_evaluator/expression_evaluator_utils.h b/src/include/expression_evaluator/expression_evaluator_utils.h index 66f59fe762..ce8c21c3ed 100644 --- a/src/include/expression_evaluator/expression_evaluator_utils.h +++ b/src/include/expression_evaluator/expression_evaluator_utils.h @@ -1,7 +1,8 @@ #pragma once #include "binder/expression/expression.h" -#include "expression_evaluator.h" +#include "common/types/value/value.h" +#include "storage/buffer_manager/memory_manager.h" namespace kuzu { namespace evaluator { diff --git a/src/include/expression_evaluator/node_rel_evaluator.h b/src/include/expression_evaluator/node_rel_evaluator.h index 4a5ec5e40d..57640c74cd 100644 --- a/src/include/expression_evaluator/node_rel_evaluator.h +++ b/src/include/expression_evaluator/node_rel_evaluator.h @@ -1,6 +1,7 @@ #pragma once #include "binder/expression/expression.h" +#include "common/exception/not_implemented.h" #include "expression_evaluator.h" namespace kuzu { diff --git a/src/include/expression_evaluator/path_evaluator.h b/src/include/expression_evaluator/path_evaluator.h index 17238547cb..d879dd76da 100644 --- a/src/include/expression_evaluator/path_evaluator.h +++ b/src/include/expression_evaluator/path_evaluator.h @@ -1,5 +1,7 @@ #pragma once +#include "binder/expression/expression.h" +#include "common/exception/not_implemented.h" #include "expression_evaluator.h" namespace kuzu { diff --git a/src/include/function/aggregate/collect.h b/src/include/function/aggregate/collect.h index 8e2e5f0f32..770bc8501b 100644 --- a/src/include/function/aggregate/collect.h +++ b/src/include/function/aggregate/collect.h @@ -2,6 +2,7 @@ #include "function/aggregate_function.h" #include "processor/result/factorized_table.h" +#include "storage/storage_utils.h" namespace kuzu { namespace function { diff --git a/src/include/function/aggregate/min_max.h b/src/include/function/aggregate/min_max.h index e2dd16167c..c55da363cf 100644 --- a/src/include/function/aggregate/min_max.h +++ b/src/include/function/aggregate/min_max.h @@ -1,7 +1,6 @@ #pragma once #include "function/aggregate_function.h" -#include "function/comparison/comparison_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/aggregate_function.h b/src/include/function/aggregate_function.h index 4e50898cff..18f31d75dd 100644 --- a/src/include/function/aggregate_function.h +++ b/src/include/function/aggregate_function.h @@ -5,7 +5,6 @@ #include "common/vector/value_vector.h" #include "function/function.h" -#include "function/scalar_function.h" namespace kuzu { namespace function { diff --git a/src/include/function/arithmetic/arithmetic_functions.h b/src/include/function/arithmetic/arithmetic_functions.h index 645e7301c0..b312edde9f 100644 --- a/src/include/function/arithmetic/arithmetic_functions.h +++ b/src/include/function/arithmetic/arithmetic_functions.h @@ -4,7 +4,7 @@ #include #include "common/exception/runtime.h" -#include "common/type_utils.h" +#include "common/types/int128_t.h" namespace kuzu { namespace function { diff --git a/src/include/function/arithmetic/vector_arithmetic_functions.h b/src/include/function/arithmetic/vector_arithmetic_functions.h index 4f8beb5f98..68d73865fc 100644 --- a/src/include/function/arithmetic/vector_arithmetic_functions.h +++ b/src/include/function/arithmetic/vector_arithmetic_functions.h @@ -1,6 +1,9 @@ #pragma once -#include "arithmetic_functions.h" +#include + +#include "common/exception/not_implemented.h" +#include "common/types/int128_t.h" #include "function/scalar_function.h" namespace kuzu { diff --git a/src/include/function/binary_function_executor.h b/src/include/function/binary_function_executor.h index 613fe9552b..d1e32771bf 100644 --- a/src/include/function/binary_function_executor.h +++ b/src/include/function/binary_function_executor.h @@ -1,10 +1,6 @@ #pragma once -#include - -#include "common/type_utils.h" #include "common/vector/value_vector.h" -#include "function/comparison/comparison_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/blob/functions/decode_function.h b/src/include/function/blob/functions/decode_function.h index 57f38169e0..0f07e8956c 100644 --- a/src/include/function/blob/functions/decode_function.h +++ b/src/include/function/blob/functions/decode_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/types/blob.h" +#include "common/vector/value_vector.h" #include "utf8proc_wrapper.h" namespace kuzu { diff --git a/src/include/function/blob/functions/encode_function.h b/src/include/function/blob/functions/encode_function.h index 8cb45476e3..39d0756386 100644 --- a/src/include/function/blob/functions/encode_function.h +++ b/src/include/function/blob/functions/encode_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/types/blob.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/boolean/boolean_function_executor.h b/src/include/function/boolean/boolean_function_executor.h index 2f7717aa34..b7543ecc62 100644 --- a/src/include/function/boolean/boolean_function_executor.h +++ b/src/include/function/boolean/boolean_function_executor.h @@ -1,7 +1,7 @@ #pragma once #include "boolean_functions.h" -#include "function/binary_function_executor.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/built_in_function.h b/src/include/function/built_in_function.h index e4c2a5091d..b99ec06a88 100644 --- a/src/include/function/built_in_function.h +++ b/src/include/function/built_in_function.h @@ -2,7 +2,6 @@ #include "aggregate_function.h" #include "scalar_function.h" -#include "table_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/cast/functions/cast_functions.h b/src/include/function/cast/functions/cast_functions.h index 7e46ada678..fd1c689622 100644 --- a/src/include/function/cast/functions/cast_functions.h +++ b/src/include/function/cast/functions/cast_functions.h @@ -1,14 +1,12 @@ #pragma once -#include +#include -#include "cast_string_non_nested_functions.h" -#include "common/exception/conversion.h" #include "common/exception/overflow.h" #include "common/string_format.h" #include "common/type_utils.h" -#include "common/types/blob.h" #include "common/vector/value_vector.h" +#include "function/cast/functions/numeric_cast.h" namespace kuzu { namespace function { diff --git a/src/include/function/cast/functions/cast_string_non_nested_functions.h b/src/include/function/cast/functions/cast_string_non_nested_functions.h index 677cefb782..3e752f35c2 100644 --- a/src/include/function/cast/functions/cast_string_non_nested_functions.h +++ b/src/include/function/cast/functions/cast_string_non_nested_functions.h @@ -1,15 +1,11 @@ #pragma once -#include - #include "common/exception/conversion.h" #include "common/string_utils.h" -#include "common/type_utils.h" #include "common/types/int128_t.h" -#include "common/types/ku_string.h" -#include "common/vector/value_vector.h" +#include "common/types/types.h" #include "fast_float.h" -#include "numeric_cast.h" +#include "function/cast/functions/numeric_limits.h" namespace kuzu { namespace function { diff --git a/src/include/function/cast/functions/cast_string_to_functions.h b/src/include/function/cast/functions/cast_string_to_functions.h index 3dcac7841d..b7c3bcbb78 100644 --- a/src/include/function/cast/functions/cast_string_to_functions.h +++ b/src/include/function/cast/functions/cast_string_to_functions.h @@ -1,11 +1,7 @@ #pragma once -#include - #include "cast_string_non_nested_functions.h" #include "common/copier_config/copier_config.h" -#include "common/exception/runtime.h" -#include "common/string_format.h" #include "common/type_utils.h" #include "common/types/blob.h" #include "common/vector/value_vector.h" diff --git a/src/include/function/cast/functions/numeric_cast.h b/src/include/function/cast/functions/numeric_cast.h index 4c31f2ec45..f33a8cb876 100644 --- a/src/include/function/cast/functions/numeric_cast.h +++ b/src/include/function/cast/functions/numeric_cast.h @@ -1,7 +1,7 @@ #pragma once +#include #include -#include #include "numeric_limits.h" diff --git a/src/include/function/cast/vector_cast_functions.h b/src/include/function/cast/vector_cast_functions.h index 394a5911ff..e3d4e163cf 100644 --- a/src/include/function/cast/vector_cast_functions.h +++ b/src/include/function/cast/vector_cast_functions.h @@ -1,6 +1,6 @@ #pragma once -#include "function/cast/functions/cast_functions.h" +#include "common/exception/not_implemented.h" #include "function/cast/functions/cast_string_to_functions.h" #include "function/scalar_function.h" diff --git a/src/include/function/comparison/comparison_functions.h b/src/include/function/comparison/comparison_functions.h index 59e4f97797..0746e2c58f 100644 --- a/src/include/function/comparison/comparison_functions.h +++ b/src/include/function/comparison/comparison_functions.h @@ -1,9 +1,5 @@ #pragma once -#include -#include - -#include "common/type_utils.h" #include "common/vector/value_vector.h" namespace kuzu { diff --git a/src/include/function/comparison/vector_comparison_functions.h b/src/include/function/comparison/vector_comparison_functions.h index 0c67b23751..72f1283f37 100644 --- a/src/include/function/comparison/vector_comparison_functions.h +++ b/src/include/function/comparison/vector_comparison_functions.h @@ -1,6 +1,9 @@ #pragma once -#include "binder/expression/expression.h" +#include + +#include "common/types/int128_t.h" +#include "common/types/interval_t.h" #include "comparison_functions.h" #include "function/scalar_function.h" diff --git a/src/include/function/const_function_executor.h b/src/include/function/const_function_executor.h index 5aff1ab692..79baa82f50 100644 --- a/src/include/function/const_function_executor.h +++ b/src/include/function/const_function_executor.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/vector/value_vector.h" namespace kuzu { diff --git a/src/include/function/date/date_functions.h b/src/include/function/date/date_functions.h index 5237316359..8509a54e00 100644 --- a/src/include/function/date/date_functions.h +++ b/src/include/function/date/date_functions.h @@ -1,8 +1,9 @@ #pragma once #include "common/exception/not_implemented.h" -#include "common/type_utils.h" #include "common/types/date_t.h" +#include "common/types/ku_string.h" +#include "common/types/timestamp_t.h" namespace kuzu { namespace function { diff --git a/src/include/function/function.h b/src/include/function/function.h index 62e0ba5cb4..be9b69ce6c 100644 --- a/src/include/function/function.h +++ b/src/include/function/function.h @@ -1,7 +1,6 @@ #pragma once #include "binder/expression/expression.h" -#include "common/enums/expression_type.h" namespace kuzu { namespace function { diff --git a/src/include/function/hash/hash_functions.h b/src/include/function/hash/hash_functions.h index 8697463e48..736a3d245a 100644 --- a/src/include/function/hash/hash_functions.h +++ b/src/include/function/hash/hash_functions.h @@ -1,12 +1,14 @@ #pragma once +#include #include #include #include "common/exception/runtime.h" -#include "common/type_utils.h" +#include "common/types/int128_t.h" +#include "common/types/interval_t.h" #include "common/types/ku_list.h" -#include "common/utils.h" +#include "common/types/ku_string.h" namespace kuzu { namespace function { diff --git a/src/include/function/interval/interval_functions.h b/src/include/function/interval/interval_functions.h index fb44b6aa47..ca2341a391 100644 --- a/src/include/function/interval/interval_functions.h +++ b/src/include/function/interval/interval_functions.h @@ -1,7 +1,6 @@ #pragma once -#include "common/type_utils.h" -#include "common/types/date_t.h" +#include "common/types/interval_t.h" namespace kuzu { namespace function { diff --git a/src/include/function/list/functions/list_append_function.h b/src/include/function/list/functions/list_append_function.h index 4e2d31bd6c..408ac77c79 100644 --- a/src/include/function/list/functions/list_append_function.h +++ b/src/include/function/list/functions/list_append_function.h @@ -1,9 +1,5 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" #include "common/vector/value_vector.h" namespace kuzu { diff --git a/src/include/function/list/functions/list_concat_function.h b/src/include/function/list/functions/list_concat_function.h index d429c55487..1f14f0836c 100644 --- a/src/include/function/list/functions/list_concat_function.h +++ b/src/include/function/list/functions/list_concat_function.h @@ -1,9 +1,7 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" +#include "common/types/types.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/list/functions/list_contains_function.h b/src/include/function/list/functions/list_contains_function.h index e55f1bc983..b43522872d 100644 --- a/src/include/function/list/functions/list_contains_function.h +++ b/src/include/function/list/functions/list_contains_function.h @@ -1,9 +1,6 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" +#include "common/vector/value_vector.h" #include "list_position_function.h" namespace kuzu { diff --git a/src/include/function/list/functions/list_extract_function.h b/src/include/function/list/functions/list_extract_function.h index df03e11688..4619993067 100644 --- a/src/include/function/list/functions/list_extract_function.h +++ b/src/include/function/list/functions/list_extract_function.h @@ -1,8 +1,6 @@ #pragma once -#include -#include - +#include "common/type_utils.h" #include "common/types/ku_string.h" #include "common/vector/value_vector.h" #include "function/string/functions/array_extract_function.h" diff --git a/src/include/function/list/functions/list_len_function.h b/src/include/function/list/functions/list_len_function.h index b11c45404f..6588bd7ecd 100644 --- a/src/include/function/list/functions/list_len_function.h +++ b/src/include/function/list/functions/list_len_function.h @@ -1,9 +1,7 @@ #pragma once -#include #include -#include "common/types/ku_list.h" #include "common/types/ku_string.h" #include "utf8proc.h" diff --git a/src/include/function/list/functions/list_position_function.h b/src/include/function/list/functions/list_position_function.h index 5ba339251a..50567a52b3 100644 --- a/src/include/function/list/functions/list_position_function.h +++ b/src/include/function/list/functions/list_position_function.h @@ -1,9 +1,7 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" +#include "common/vector/value_vector.h" +#include "function/comparison/comparison_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/list/functions/list_prepend_function.h b/src/include/function/list/functions/list_prepend_function.h index 02f820e0c9..fb961afae7 100644 --- a/src/include/function/list/functions/list_prepend_function.h +++ b/src/include/function/list/functions/list_prepend_function.h @@ -1,9 +1,6 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/list/functions/list_range_function.h b/src/include/function/list/functions/list_range_function.h index 6462a7a35b..b7bf9b118a 100644 --- a/src/include/function/list/functions/list_range_function.h +++ b/src/include/function/list/functions/list_range_function.h @@ -1,6 +1,6 @@ #pragma once -#include "common/types/ku_list.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/list/functions/list_slice_function.h b/src/include/function/list/functions/list_slice_function.h index 0cca87982b..d9bce9f223 100644 --- a/src/include/function/list/functions/list_slice_function.h +++ b/src/include/function/list/functions/list_slice_function.h @@ -1,9 +1,5 @@ #pragma once -#include -#include - -#include "common/types/ku_list.h" #include "function/string/functions/substr_function.h" namespace kuzu { diff --git a/src/include/function/list/vector_list_functions.h b/src/include/function/list/vector_list_functions.h index da8b06a630..6728d2131e 100644 --- a/src/include/function/list/vector_list_functions.h +++ b/src/include/function/list/vector_list_functions.h @@ -1,5 +1,10 @@ #pragma once +#include + +#include "common/exception/not_implemented.h" +#include "common/types/int128_t.h" +#include "common/types/interval_t.h" #include "function/scalar_function.h" namespace kuzu { diff --git a/src/include/function/map/functions/map_extract_function.h b/src/include/function/map/functions/map_extract_function.h index 1d163ba509..4f39aadbae 100644 --- a/src/include/function/map/functions/map_extract_function.h +++ b/src/include/function/map/functions/map_extract_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/vector/value_vector.h" +#include "function/comparison/comparison_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/map/functions/map_values_function.h b/src/include/function/map/functions/map_values_function.h index 4f177ef445..81efb07b6a 100644 --- a/src/include/function/map/functions/map_values_function.h +++ b/src/include/function/map/functions/map_values_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/vector/value_vector.h" +#include "function/map/functions/base_map_extract_function.h" namespace kuzu { namespace function { diff --git a/src/include/function/map/vector_map_functions.h b/src/include/function/map/vector_map_functions.h index 3af0401841..8448b4e6c3 100644 --- a/src/include/function/map/vector_map_functions.h +++ b/src/include/function/map/vector_map_functions.h @@ -1,6 +1,5 @@ #pragma once -#include "common/vector/value_vector.h" #include "function/scalar_function.h" namespace kuzu { diff --git a/src/include/function/null/null_function_executor.h b/src/include/function/null/null_function_executor.h index d3e8daaf9b..00d9209aa7 100644 --- a/src/include/function/null/null_function_executor.h +++ b/src/include/function/null/null_function_executor.h @@ -1,6 +1,6 @@ #pragma once -#include "function/unary_function_executor.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/null/null_functions.h b/src/include/function/null/null_functions.h index dad95807e6..e68f5b08d8 100644 --- a/src/include/function/null/null_functions.h +++ b/src/include/function/null/null_functions.h @@ -1,7 +1,6 @@ #pragma once #include -#include namespace kuzu { namespace function { diff --git a/src/include/function/path/path_function_executor.h b/src/include/function/path/path_function_executor.h index dfdd8bf796..2f40819494 100644 --- a/src/include/function/path/path_function_executor.h +++ b/src/include/function/path/path_function_executor.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/vector/value_vector.h" #include "function/hash/hash_functions.h" diff --git a/src/include/function/scalar_function.h b/src/include/function/scalar_function.h index afb98d8615..7a08037655 100644 --- a/src/include/function/scalar_function.h +++ b/src/include/function/scalar_function.h @@ -1,7 +1,6 @@ #pragma once #include "binary_function_executor.h" -#include "binder/expression/expression.h" #include "const_function_executor.h" #include "function.h" #include "ternary_function_executor.h" diff --git a/src/include/function/schema/label_functions.h b/src/include/function/schema/label_functions.h index 43be0a67d5..c0e9563728 100644 --- a/src/include/function/schema/label_functions.h +++ b/src/include/function/schema/label_functions.h @@ -1,6 +1,5 @@ #pragma once -#include "common/type_utils.h" #include "function/list/functions/list_extract_function.h" namespace kuzu { diff --git a/src/include/function/schema/offset_functions.h b/src/include/function/schema/offset_functions.h index db53cf02ba..140cb12e21 100644 --- a/src/include/function/schema/offset_functions.h +++ b/src/include/function/schema/offset_functions.h @@ -1,6 +1,6 @@ #pragma once -#include "common/type_utils.h" +#include "common/types/internal_id_t.h" namespace kuzu { namespace function { diff --git a/src/include/function/schema/vector_label_functions.h b/src/include/function/schema/vector_label_functions.h index a4a5da99d3..ae2ae81d39 100644 --- a/src/include/function/schema/vector_label_functions.h +++ b/src/include/function/schema/vector_label_functions.h @@ -1,7 +1,7 @@ #pragma once -#include "function/scalar_function.h" -#include "label_functions.h" +#include "function/binary_function_executor.h" +#include "function/schema/label_functions.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/array_extract_function.h b/src/include/function/string/functions/array_extract_function.h index 14365f27cf..1e03e984db 100644 --- a/src/include/function/string/functions/array_extract_function.h +++ b/src/include/function/string/functions/array_extract_function.h @@ -1,11 +1,9 @@ #pragma once -#include #include #include "common/types/ku_string.h" #include "function/list/functions/list_len_function.h" -#include "substr_function.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/base_lower_upper_function.h b/src/include/function/string/functions/base_lower_upper_function.h index 3d627eff13..a26df11aad 100644 --- a/src/include/function/string/functions/base_lower_upper_function.h +++ b/src/include/function/string/functions/base_lower_upper_function.h @@ -1,12 +1,8 @@ #pragma once -#include -#include - #include "common/api.h" #include "common/types/ku_string.h" #include "common/vector/value_vector.h" -#include "utf8proc.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/base_pad_function.h b/src/include/function/string/functions/base_pad_function.h index 03572a04a6..f893cf9a6a 100644 --- a/src/include/function/string/functions/base_pad_function.h +++ b/src/include/function/string/functions/base_pad_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" #include "common/vector/value_vector.h" #include "utf8proc.h" diff --git a/src/include/function/string/functions/base_str_function.h b/src/include/function/string/functions/base_str_function.h index 6ac04b7d08..1c0aa19e48 100644 --- a/src/include/function/string/functions/base_str_function.h +++ b/src/include/function/string/functions/base_str_function.h @@ -1,10 +1,8 @@ #pragma once -#include -#include - #include "common/api.h" #include "common/types/ku_string.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/concat_function.h b/src/include/function/string/functions/concat_function.h index 752a7562d2..726a3edfa3 100644 --- a/src/include/function/string/functions/concat_function.h +++ b/src/include/function/string/functions/concat_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/api.h" #include "common/exception/not_implemented.h" #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/contains_function.h b/src/include/function/string/functions/contains_function.h index 64d5627ff8..985cc08d91 100644 --- a/src/include/function/string/functions/contains_function.h +++ b/src/include/function/string/functions/contains_function.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/types/ku_string.h" #include "function/string/functions/find_function.h" diff --git a/src/include/function/string/functions/find_function.h b/src/include/function/string/functions/find_function.h index 46aaeeac80..b0b3cac492 100644 --- a/src/include/function/string/functions/find_function.h +++ b/src/include/function/string/functions/find_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" namespace kuzu { diff --git a/src/include/function/string/functions/left_operation.h b/src/include/function/string/functions/left_operation.h index 8faa4cf367..07d9e84ab8 100644 --- a/src/include/function/string/functions/left_operation.h +++ b/src/include/function/string/functions/left_operation.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" #include "function/list/functions/list_len_function.h" #include "substr_function.h" diff --git a/src/include/function/string/functions/lower_function.h b/src/include/function/string/functions/lower_function.h index c58535bc88..28d9b612d1 100644 --- a/src/include/function/string/functions/lower_function.h +++ b/src/include/function/string/functions/lower_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "base_lower_upper_function.h" #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/lpad_function.h b/src/include/function/string/functions/lpad_function.h index cb3152e992..193c9ec8a2 100644 --- a/src/include/function/string/functions/lpad_function.h +++ b/src/include/function/string/functions/lpad_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "base_pad_function.h" #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/ltrim_function.h b/src/include/function/string/functions/ltrim_function.h index ca84db9702..173b0dea9f 100644 --- a/src/include/function/string/functions/ltrim_function.h +++ b/src/include/function/string/functions/ltrim_function.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include "base_str_function.h" diff --git a/src/include/function/string/functions/pad_function.h b/src/include/function/string/functions/pad_function.h index c4c6e89974..e2881f923d 100644 --- a/src/include/function/string/functions/pad_function.h +++ b/src/include/function/string/functions/pad_function.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include "common/types/ku_string.h" #include "common/vector/value_vector.h" diff --git a/src/include/function/string/functions/regexp_extract_function.h b/src/include/function/string/functions/regexp_extract_function.h index 0feb385641..17d50c374f 100644 --- a/src/include/function/string/functions/regexp_extract_function.h +++ b/src/include/function/string/functions/regexp_extract_function.h @@ -2,6 +2,7 @@ #include "common/types/ku_string.h" #include "common/vector/value_vector.h" +#include "function/string/functions/base_regexp_function.h" #include "re2.h" namespace kuzu { diff --git a/src/include/function/string/functions/regexp_full_match_function.h b/src/include/function/string/functions/regexp_full_match_function.h index 1d8689e23f..70a881c34b 100644 --- a/src/include/function/string/functions/regexp_full_match_function.h +++ b/src/include/function/string/functions/regexp_full_match_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/types/ku_string.h" +#include "function/string/functions/base_regexp_function.h" #include "re2.h" namespace kuzu { diff --git a/src/include/function/string/functions/regexp_matches_function.h b/src/include/function/string/functions/regexp_matches_function.h index fa595e0377..0489b0a9eb 100644 --- a/src/include/function/string/functions/regexp_matches_function.h +++ b/src/include/function/string/functions/regexp_matches_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/types/ku_string.h" +#include "function/string/functions/base_regexp_function.h" #include "re2.h" namespace kuzu { diff --git a/src/include/function/string/functions/regexp_replace_function.h b/src/include/function/string/functions/regexp_replace_function.h index 12f6208e52..956b86fda1 100644 --- a/src/include/function/string/functions/regexp_replace_function.h +++ b/src/include/function/string/functions/regexp_replace_function.h @@ -1,6 +1,7 @@ #pragma once #include "common/types/ku_string.h" +#include "function/string/functions/base_regexp_function.h" #include "re2.h" namespace kuzu { diff --git a/src/include/function/string/functions/repeat_function.h b/src/include/function/string/functions/repeat_function.h index 43782de2f8..7951ab3349 100644 --- a/src/include/function/string/functions/repeat_function.h +++ b/src/include/function/string/functions/repeat_function.h @@ -1,10 +1,10 @@ #pragma once -#include #include #include "common/api.h" #include "common/types/ku_string.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/reverse_function.h b/src/include/function/string/functions/reverse_function.h index 0c8ddd8908..3fbe2b60f0 100644 --- a/src/include/function/string/functions/reverse_function.h +++ b/src/include/function/string/functions/reverse_function.h @@ -1,11 +1,8 @@ #pragma once -#include -#include - -#include "base_str_function.h" #include "common/api.h" #include "common/types/ku_string.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace function { diff --git a/src/include/function/string/functions/right_function.h b/src/include/function/string/functions/right_function.h index 7c2b65198a..609b4a0e40 100644 --- a/src/include/function/string/functions/right_function.h +++ b/src/include/function/string/functions/right_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" #include "function/list/functions/list_len_function.h" #include "substr_function.h" diff --git a/src/include/function/string/functions/rpad_function.h b/src/include/function/string/functions/rpad_function.h index 605b53e4d2..16a79c227c 100644 --- a/src/include/function/string/functions/rpad_function.h +++ b/src/include/function/string/functions/rpad_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "base_pad_function.h" #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/rtrim_function.h b/src/include/function/string/functions/rtrim_function.h index f0380e45eb..3ea17405b7 100644 --- a/src/include/function/string/functions/rtrim_function.h +++ b/src/include/function/string/functions/rtrim_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "base_str_function.h" #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/substr_function.h b/src/include/function/string/functions/substr_function.h index 7330a84950..c99fd300ca 100644 --- a/src/include/function/string/functions/substr_function.h +++ b/src/include/function/string/functions/substr_function.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include "common/types/ku_string.h" diff --git a/src/include/function/string/functions/trim_function.h b/src/include/function/string/functions/trim_function.h index c4ef4d4d1a..1a13414743 100644 --- a/src/include/function/string/functions/trim_function.h +++ b/src/include/function/string/functions/trim_function.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" #include "ltrim_function.h" #include "rtrim_function.h" diff --git a/src/include/function/string/functions/upper_function.h b/src/include/function/string/functions/upper_function.h index 465117d566..b1ce108e4f 100644 --- a/src/include/function/string/functions/upper_function.h +++ b/src/include/function/string/functions/upper_function.h @@ -1,9 +1,8 @@ #pragma once -#include -#include - #include "common/types/ku_string.h" +#include "common/vector/value_vector.h" +#include "function/string/functions/base_lower_upper_function.h" namespace kuzu { namespace function { diff --git a/src/include/function/table_functions/bind_data.h b/src/include/function/table_functions/bind_data.h index 0cb79fb635..424b3a1f2a 100644 --- a/src/include/function/table_functions/bind_data.h +++ b/src/include/function/table_functions/bind_data.h @@ -1,6 +1,6 @@ #pragma once -#include "common/types/value/value.h" +#include "common/types/types.h" namespace kuzu { namespace function { diff --git a/src/include/function/ternary_function_executor.h b/src/include/function/ternary_function_executor.h index cec4063bdb..0a8cf182e2 100644 --- a/src/include/function/ternary_function_executor.h +++ b/src/include/function/ternary_function_executor.h @@ -1,8 +1,5 @@ #pragma once -#include - -#include "common/type_utils.h" #include "common/vector/value_vector.h" namespace kuzu { diff --git a/src/include/function/timestamp/timestamp_function.h b/src/include/function/timestamp/timestamp_function.h index 6340043d6a..675b2c215b 100644 --- a/src/include/function/timestamp/timestamp_function.h +++ b/src/include/function/timestamp/timestamp_function.h @@ -1,7 +1,7 @@ #pragma once -#include "common/type_utils.h" #include "common/types/date_t.h" +#include "common/types/timestamp_t.h" namespace kuzu { namespace function { diff --git a/src/include/function/udf_function.h b/src/include/function/udf_function.h index d6d5ad49a4..22b49a45c5 100644 --- a/src/include/function/udf_function.h +++ b/src/include/function/udf_function.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "common/exception/binder.h" #include "common/exception/catalog.h" #include "common/exception/not_implemented.h" diff --git a/src/include/function/unary_function_executor.h b/src/include/function/unary_function_executor.h index ab62a4fd6f..5e73a0d906 100644 --- a/src/include/function/unary_function_executor.h +++ b/src/include/function/unary_function_executor.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/vector/value_vector.h" namespace kuzu { diff --git a/src/include/main/client_context.h b/src/include/main/client_context.h index 9e4c9537e0..f42b2ddf14 100644 --- a/src/include/main/client_context.h +++ b/src/include/main/client_context.h @@ -4,7 +4,6 @@ #include #include -#include "common/api.h" #include "common/timer.h" #include "main/kuzu_fwd.h" diff --git a/src/include/main/database.h b/src/include/main/database.h index 16f130fb8a..37206074f9 100644 --- a/src/include/main/database.h +++ b/src/include/main/database.h @@ -1,10 +1,9 @@ #pragma once #include -#include +#include #include "common/api.h" -#include "common/constants.h" #include "common/enums/access_mode.h" #include "kuzu_fwd.h" diff --git a/src/include/main/kuzu.h b/src/include/main/kuzu.h index 3c42923af7..c1479973b7 100644 --- a/src/include/main/kuzu.h +++ b/src/include/main/kuzu.h @@ -1,4 +1,4 @@ #pragma once -#include "connection.h" -#include "database.h" +#include "connection.h" // IWYU pragma: export +#include "database.h" // IWYU pragma: export diff --git a/src/include/main/plan_printer.h b/src/include/main/plan_printer.h index b5d0a40d61..a52fd02234 100644 --- a/src/include/main/plan_printer.h +++ b/src/include/main/plan_printer.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/src/include/main/storage_driver.h b/src/include/main/storage_driver.h index b3f49aa81a..c8f138eca8 100644 --- a/src/include/main/storage_driver.h +++ b/src/include/main/storage_driver.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/types/internal_id_t.h" #include "database.h" diff --git a/src/include/optimizer/correlated_subquery_unnest_solver.h b/src/include/optimizer/correlated_subquery_unnest_solver.h index fa7b89a5b7..7a9b24587a 100644 --- a/src/include/optimizer/correlated_subquery_unnest_solver.h +++ b/src/include/optimizer/correlated_subquery_unnest_solver.h @@ -1,7 +1,6 @@ #pragma once #include "logical_operator_visitor.h" -#include "planner/operator/logical_plan.h" namespace kuzu { namespace optimizer { diff --git a/src/include/optimizer/filter_push_down_optimizer.h b/src/include/optimizer/filter_push_down_optimizer.h index dda6ebba38..ff41d732cd 100644 --- a/src/include/optimizer/filter_push_down_optimizer.h +++ b/src/include/optimizer/filter_push_down_optimizer.h @@ -1,7 +1,5 @@ #pragma once -#include "binder/expression/node_expression.h" -#include "logical_operator_visitor.h" #include "planner/operator/logical_plan.h" namespace kuzu { diff --git a/src/include/parser/antlr_parser/parser_error_listener.h b/src/include/parser/antlr_parser/parser_error_listener.h index 6896704d52..5276a77e2d 100644 --- a/src/include/parser/antlr_parser/parser_error_listener.h +++ b/src/include/parser/antlr_parser/parser_error_listener.h @@ -2,7 +2,7 @@ #include -#include "antlr4-runtime.h" +#include "antlr4-runtime.h" // IWYU pragma: keep. This is the public header. namespace kuzu { namespace parser { diff --git a/src/include/parser/antlr_parser/parser_error_strategy.h b/src/include/parser/antlr_parser/parser_error_strategy.h index a6d20270b9..7b6dc630ea 100644 --- a/src/include/parser/antlr_parser/parser_error_strategy.h +++ b/src/include/parser/antlr_parser/parser_error_strategy.h @@ -1,8 +1,6 @@ #pragma once -#include - -#include "antlr4-runtime.h" +#include "antlr4-runtime.h" // IWYU pragma: keep; this is the public header. namespace kuzu { namespace parser { diff --git a/src/include/parser/copy.h b/src/include/parser/copy.h index 3de95e90b2..31a400ac57 100644 --- a/src/include/parser/copy.h +++ b/src/include/parser/copy.h @@ -1,8 +1,5 @@ #pragma once -#include - -#include "common/copier_config/copier_config.h" #include "parser/expression/parsed_expression.h" #include "parser/query/regular_query.h" #include "parser/statement.h" diff --git a/src/include/parser/create_macro.h b/src/include/parser/create_macro.h index 3fce277245..aeb7d8ce49 100644 --- a/src/include/parser/create_macro.h +++ b/src/include/parser/create_macro.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "parser/expression/parsed_expression.h" #include "parser/statement.h" diff --git a/src/include/parser/ddl/create_table_info.h b/src/include/parser/ddl/create_table_info.h index 78ada03bc5..cc5665f695 100644 --- a/src/include/parser/ddl/create_table_info.h +++ b/src/include/parser/ddl/create_table_info.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include diff --git a/src/include/parser/ddl/drop.h b/src/include/parser/ddl/drop.h index 50fab974d2..d559f38cc5 100644 --- a/src/include/parser/ddl/drop.h +++ b/src/include/parser/ddl/drop.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "parser/statement.h" namespace kuzu { diff --git a/src/include/parser/explain_statement.h b/src/include/parser/explain_statement.h index 1f33616da0..3e9fded268 100644 --- a/src/include/parser/explain_statement.h +++ b/src/include/parser/explain_statement.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "common/enums/explain_type.h" #include "parser/statement.h" diff --git a/src/include/parser/expression/parsed_subquery_expression.h b/src/include/parser/expression/parsed_subquery_expression.h index d099800a81..fd41b40205 100644 --- a/src/include/parser/expression/parsed_subquery_expression.h +++ b/src/include/parser/expression/parsed_subquery_expression.h @@ -2,7 +2,7 @@ #include "common/exception/not_implemented.h" #include "parsed_expression.h" -#include "parser/query/reading_clause/match_clause.h" +#include "parser/query/graph_pattern/pattern_element.h" namespace kuzu { namespace parser { diff --git a/src/include/parser/query/query_part.h b/src/include/parser/query/query_part.h index 5e0badddb4..f50f985c75 100644 --- a/src/include/parser/query/query_part.h +++ b/src/include/parser/query/query_part.h @@ -1,8 +1,6 @@ #pragma once -#include - -#include "parser/query/reading_clause/match_clause.h" +#include "parser/query/reading_clause/reading_clause.h" #include "parser/query/return_with_clause/with_clause.h" #include "parser/query/updating_clause/updating_clause.h" diff --git a/src/include/planner/join_order_enumerator_context.h b/src/include/planner/join_order_enumerator_context.h index 10b2ff0f07..6e8602fb92 100644 --- a/src/include/planner/join_order_enumerator_context.h +++ b/src/include/planner/join_order_enumerator_context.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/query/normalized_single_query.h" #include "planner/operator/logical_plan.h" #include "planner/subplans_table.h" @@ -22,25 +21,28 @@ class JoinOrderEnumeratorContext { queryGraph{nullptr}, subqueryType{SubqueryType::NONE}, correlatedExpressionsCardinality{ 1} {} - void init(QueryGraph* queryGraph, const expression_vector& predicates); + void init(binder::QueryGraph* queryGraph, const binder::expression_vector& predicates); - inline expression_vector getWhereExpressions() { return whereExpressionsSplitOnAND; } + inline binder::expression_vector getWhereExpressions() { return whereExpressionsSplitOnAND; } - inline bool containPlans(const SubqueryGraph& subqueryGraph) const { + inline bool containPlans(const binder::SubqueryGraph& subqueryGraph) const { return subPlansTable->containSubgraphPlans(subqueryGraph); } inline std::vector>& getPlans( - const SubqueryGraph& subqueryGraph) const { + const binder::SubqueryGraph& subqueryGraph) const { return subPlansTable->getSubgraphPlans(subqueryGraph); } - inline void addPlan(const SubqueryGraph& subqueryGraph, std::unique_ptr plan) { + inline void addPlan( + const binder::SubqueryGraph& subqueryGraph, std::unique_ptr plan) { subPlansTable->addPlan(subqueryGraph, std::move(plan)); } - inline SubqueryGraph getEmptySubqueryGraph() const { return SubqueryGraph(*queryGraph); } - SubqueryGraph getFullyMatchedSubqueryGraph() const; + inline binder::SubqueryGraph getEmptySubqueryGraph() const { + return binder::SubqueryGraph(*queryGraph); + } + binder::SubqueryGraph getFullyMatchedSubqueryGraph() const; - inline QueryGraph* getQueryGraph() { return queryGraph; } + inline binder::QueryGraph* getQueryGraph() { return queryGraph; } inline binder::expression_vector getCorrelatedExpressions() const { return correlatedExpressions; @@ -51,16 +53,16 @@ class JoinOrderEnumeratorContext { void resetState(); private: - expression_vector whereExpressionsSplitOnAND; + binder::expression_vector whereExpressionsSplitOnAND; uint32_t currentLevel; uint32_t maxLevel; std::unique_ptr subPlansTable; - QueryGraph* queryGraph; + binder::QueryGraph* queryGraph; SubqueryType subqueryType; - expression_vector correlatedExpressions; + binder::expression_vector correlatedExpressions; uint64_t correlatedExpressionsCardinality; }; diff --git a/src/include/planner/operator/ddl/logical_create_table.h b/src/include/planner/operator/ddl/logical_create_table.h index cc8d27a884..37f80e9b49 100644 --- a/src/include/planner/operator/ddl/logical_create_table.h +++ b/src/include/planner/operator/ddl/logical_create_table.h @@ -1,7 +1,6 @@ #pragma once #include "binder/ddl/bound_create_table_info.h" -#include "catalog/table_schema.h" #include "planner/operator/ddl/logical_ddl.h" namespace kuzu { diff --git a/src/include/planner/operator/ddl/logical_drop_table.h b/src/include/planner/operator/ddl/logical_drop_table.h index c38e39a0da..6672f0cfd4 100644 --- a/src/include/planner/operator/ddl/logical_drop_table.h +++ b/src/include/planner/operator/ddl/logical_drop_table.h @@ -1,5 +1,6 @@ #pragma once +#include "planner/operator/ddl/logical_ddl.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/factorization/flatten_resolver.h b/src/include/planner/operator/factorization/flatten_resolver.h index 364e9eed4b..0b548cf436 100644 --- a/src/include/planner/operator/factorization/flatten_resolver.h +++ b/src/include/planner/operator/factorization/flatten_resolver.h @@ -1,6 +1,6 @@ #pragma once -#include "planner/operator/logical_operator.h" +#include "planner/operator/schema.h" namespace kuzu { namespace planner { diff --git a/src/include/planner/operator/logical_cross_product.h b/src/include/planner/operator/logical_cross_product.h index a19bc150e8..9825b272ff 100644 --- a/src/include/planner/operator/logical_cross_product.h +++ b/src/include/planner/operator/logical_cross_product.h @@ -1,7 +1,6 @@ #pragma once #include "common/enums/join_type.h" -#include "planner/operator/factorization/sink_util.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/logical_flatten.h b/src/include/planner/operator/logical_flatten.h index 036ef1eea1..2d58c4d755 100644 --- a/src/include/planner/operator/logical_flatten.h +++ b/src/include/planner/operator/logical_flatten.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/expression.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/logical_hash_join.h b/src/include/planner/operator/logical_hash_join.h index 096792fe5a..b1cce0a760 100644 --- a/src/include/planner/operator/logical_hash_join.h +++ b/src/include/planner/operator/logical_hash_join.h @@ -1,5 +1,6 @@ #pragma once +#include "binder/expression/expression_util.h" #include "common/enums/join_type.h" #include "logical_operator.h" #include "planner/operator/sip/side_way_info_passing.h" diff --git a/src/include/planner/operator/logical_plan_util.h b/src/include/planner/operator/logical_plan_util.h index a6891f54a2..44bfd44169 100644 --- a/src/include/planner/operator/logical_plan_util.h +++ b/src/include/planner/operator/logical_plan_util.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/node_expression.h" #include "planner/operator/logical_plan.h" namespace kuzu { diff --git a/src/include/planner/operator/logical_projection.h b/src/include/planner/operator/logical_projection.h index 2340fc20fe..ac0b742869 100644 --- a/src/include/planner/operator/logical_projection.h +++ b/src/include/planner/operator/logical_projection.h @@ -1,6 +1,7 @@ #pragma once #include "binder/expression/expression.h" +#include "binder/expression/expression_util.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/persistent/logical_copy_from.h b/src/include/planner/operator/persistent/logical_copy_from.h index 762be31923..2bf725eb77 100644 --- a/src/include/planner/operator/persistent/logical_copy_from.h +++ b/src/include/planner/operator/persistent/logical_copy_from.h @@ -2,8 +2,6 @@ #include "binder/copy/bound_copy_from.h" #include "catalog/table_schema.h" -#include "common/copier_config/copier_config.h" -#include "common/enums/table_type.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/persistent/logical_copy_to.h b/src/include/planner/operator/persistent/logical_copy_to.h index 40e99b3a1b..9b80a4695d 100644 --- a/src/include/planner/operator/persistent/logical_copy_to.h +++ b/src/include/planner/operator/persistent/logical_copy_to.h @@ -2,7 +2,6 @@ #include "common/copier_config/copier_config.h" #include "planner/operator/logical_operator.h" -#include "planner/operator/logical_plan.h" namespace kuzu { namespace planner { diff --git a/src/include/planner/operator/scan/logical_dummy_scan.h b/src/include/planner/operator/scan/logical_dummy_scan.h index 64a22c7f2d..5d6011fecf 100644 --- a/src/include/planner/operator/scan/logical_dummy_scan.h +++ b/src/include/planner/operator/scan/logical_dummy_scan.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/literal_expression.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/scan/logical_expressions_scan.h b/src/include/planner/operator/scan/logical_expressions_scan.h index 0c64125ac2..78f88c29ca 100644 --- a/src/include/planner/operator/scan/logical_expressions_scan.h +++ b/src/include/planner/operator/scan/logical_expressions_scan.h @@ -1,5 +1,6 @@ #pragma once +#include "binder/expression/expression_util.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/scan/logical_index_scan.h b/src/include/planner/operator/scan/logical_index_scan.h index 8afaf76088..a02df5423a 100644 --- a/src/include/planner/operator/scan/logical_index_scan.h +++ b/src/include/planner/operator/scan/logical_index_scan.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/node_expression.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/scan/logical_scan_node_property.h b/src/include/planner/operator/scan/logical_scan_node_property.h index 64a2afea93..958a1d1471 100644 --- a/src/include/planner/operator/scan/logical_scan_node_property.h +++ b/src/include/planner/operator/scan/logical_scan_node_property.h @@ -1,5 +1,6 @@ #pragma once +#include "binder/expression/expression_util.h" #include "planner/operator/logical_operator.h" namespace kuzu { diff --git a/src/include/planner/operator/schema.h b/src/include/planner/operator/schema.h index ab7bb4ddb1..cb5fba3961 100644 --- a/src/include/planner/operator/schema.h +++ b/src/include/planner/operator/schema.h @@ -3,7 +3,6 @@ #include #include "binder/expression/expression.h" -#include "binder/expression/expression_util.h" namespace kuzu { namespace planner { diff --git a/src/include/planner/operator/sip/logical_semi_masker.h b/src/include/planner/operator/sip/logical_semi_masker.h index 163191061c..50be896478 100644 --- a/src/include/planner/operator/sip/logical_semi_masker.h +++ b/src/include/planner/operator/sip/logical_semi_masker.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/node_expression.h" #include "common/exception/runtime.h" #include "planner/operator/logical_operator.h" diff --git a/src/include/planner/operator/sip/side_way_info_passing.h b/src/include/planner/operator/sip/side_way_info_passing.h index 38fef87bb4..04d7ed213c 100644 --- a/src/include/planner/operator/sip/side_way_info_passing.h +++ b/src/include/planner/operator/sip/side_way_info_passing.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace kuzu { namespace planner { diff --git a/src/include/planner/planner.h b/src/include/planner/planner.h index 5a7ad8d5e7..ab46dd70b3 100644 --- a/src/include/planner/planner.h +++ b/src/include/planner/planner.h @@ -1,6 +1,10 @@ #pragma once -#include "planner/query_planner.h" +#include "binder/bound_statement.h" +#include "catalog/catalog.h" +#include "planner/operator/logical_plan.h" +#include "storage/stats/nodes_store_statistics.h" +#include "storage/stats/rels_store_statistics.h" namespace kuzu { namespace planner { @@ -9,46 +13,46 @@ class Planner { public: static std::unique_ptr getBestPlan(const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); static std::vector> getAllPlans(const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); private: - static std::unique_ptr planCreateTable(const BoundStatement& statement); + static std::unique_ptr planCreateTable(const binder::BoundStatement& statement); - static std::unique_ptr planDropTable(const BoundStatement& statement); + static std::unique_ptr planDropTable(const binder::BoundStatement& statement); - static std::unique_ptr planAlter(const BoundStatement& statement); + static std::unique_ptr planAlter(const binder::BoundStatement& statement); - static std::unique_ptr planStandaloneCall(const BoundStatement& statement); + static std::unique_ptr planStandaloneCall(const binder::BoundStatement& statement); - static std::unique_ptr planCommentOn(const BoundStatement& statement); + static std::unique_ptr planCommentOn(const binder::BoundStatement& statement); static std::unique_ptr planExplain(const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); - static std::unique_ptr planCreateMacro(const BoundStatement& statement); + static std::unique_ptr planCreateMacro(const binder::BoundStatement& statement); - static std::unique_ptr planTransaction(const BoundStatement& statement); + static std::unique_ptr planTransaction(const binder::BoundStatement& statement); static std::vector> getAllQueryPlans( const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); static std::vector> getAllExplainPlans( const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); static std::unique_ptr planCopyTo(const catalog::Catalog& catalog, const storage::NodesStoreStatsAndDeletedIDs& nodesStatistics, - const storage::RelsStoreStats& relsStatistics, const BoundStatement& statement); + const storage::RelsStoreStats& relsStatistics, const binder::BoundStatement& statement); - static std::unique_ptr planCopyFrom(const BoundStatement& statement); + static std::unique_ptr planCopyFrom(const binder::BoundStatement& statement); static std::unique_ptr getSimplePlan(std::shared_ptr op); }; diff --git a/src/include/planner/query_planner.h b/src/include/planner/query_planner.h index 5001c3a1ec..46c7c6e534 100644 --- a/src/include/planner/query_planner.h +++ b/src/include/planner/query_planner.h @@ -1,11 +1,14 @@ #pragma once #include "binder/bound_statement.h" +#include "binder/expression/node_expression.h" #include "binder/query/normalized_single_query.h" +#include "catalog/catalog.h" #include "common/enums/join_type.h" #include "join_order_enumerator_context.h" #include "planner/join_order/cardinality_estimator.h" #include "planner/operator/extend/extend_direction.h" +#include "storage/stats/nodes_store_statistics.h" namespace kuzu { namespace binder { @@ -103,12 +106,12 @@ class QueryPlanner { const binder::QueryGraphCollection& queryGraphCollection, const binder::expression_vector& predicates); std::vector> enumerateQueryGraph(SubqueryType subqueryType, - const expression_vector& correlatedExpressions, binder::QueryGraph* queryGraph, + const binder::expression_vector& correlatedExpressions, binder::QueryGraph* queryGraph, binder::expression_vector& predicates); // Plan node/rel table scan void planBaseTableScans( - SubqueryType subqueryType, const expression_vector& correlatedExpressions); + SubqueryType subqueryType, const binder::expression_vector& correlatedExpressions); void planCorrelatedExpressionsScan(const binder::expression_vector& correlatedExpressions); void planNodeScan(uint32_t nodePos); void planNodeIDScan(uint32_t nodePos); @@ -124,15 +127,17 @@ class QueryPlanner { // Plan worst case optimal join void planWCOJoin(uint32_t leftLevel, uint32_t rightLevel); - void planWCOJoin(const SubqueryGraph& subgraph, + void planWCOJoin(const binder::SubqueryGraph& subgraph, std::vector> rels, const std::shared_ptr& intersectNode); // Plan index-nested-loop join / hash join void planInnerJoin(uint32_t leftLevel, uint32_t rightLevel); - bool tryPlanINLJoin(const SubqueryGraph& subgraph, const SubqueryGraph& otherSubgraph, - const std::vector>& joinNodes); - void planInnerHashJoin(const SubqueryGraph& subgraph, const SubqueryGraph& otherSubgraph, + bool tryPlanINLJoin(const binder::SubqueryGraph& subgraph, + const binder::SubqueryGraph& otherSubgraph, + const std::vector>& joinNodes); + void planInnerHashJoin(const binder::SubqueryGraph& subgraph, + const binder::SubqueryGraph& otherSubgraph, std::vector> joinNodes, bool flipPlan); std::vector> planCrossProduct( @@ -153,11 +158,11 @@ class QueryPlanner { void appendDeleteRel( const std::vector& boundInfos, LogicalPlan& plan); std::unique_ptr createLogicalInsertNodeInfo( - BoundInsertInfo* boundInsertInfo); + binder::BoundInsertInfo* boundInsertInfo); std::unique_ptr createLogicalInsertRelInfo( - BoundInsertInfo* boundInsertInfo); + binder::BoundInsertInfo* boundInsertInfo); std::unique_ptr createLogicalSetPropertyInfo( - BoundSetPropertyInfo* boundSetPropertyInfo); + binder::BoundSetPropertyInfo* boundSetPropertyInfo); // Append projection operators void appendProjection(const binder::expression_vector& expressionsToProject, LogicalPlan& plan); @@ -169,39 +174,42 @@ class QueryPlanner { void appendLimit(uint64_t skipNum, uint64_t limitNum, LogicalPlan& plan); // Append scan operators - void appendExpressionsScan(const expression_vector& expressions, LogicalPlan& plan); - void appendScanInternalID(std::shared_ptr internalID, + void appendExpressionsScan(const binder::expression_vector& expressions, LogicalPlan& plan); + void appendScanInternalID(std::shared_ptr internalID, std::vector tableIDs, LogicalPlan& plan); - void appendFillTableID( - std::shared_ptr internalID, common::table_id_t tableID, LogicalPlan& plan); - void appendScanNodeProperties(std::shared_ptr nodeID, - std::vector tableIDs, const expression_vector& properties, + void appendFillTableID(std::shared_ptr internalID, + common::table_id_t tableID, LogicalPlan& plan); + void appendScanNodeProperties(std::shared_ptr nodeID, + std::vector tableIDs, const binder::expression_vector& properties, LogicalPlan& plan); // Append extend operators - void appendNonRecursiveExtend(std::shared_ptr boundNode, - std::shared_ptr nbrNode, std::shared_ptr rel, + void appendNonRecursiveExtend(std::shared_ptr boundNode, + std::shared_ptr nbrNode, std::shared_ptr rel, ExtendDirection direction, const binder::expression_vector& properties, LogicalPlan& plan); - void appendRecursiveExtend(std::shared_ptr boundNode, - std::shared_ptr nbrNode, std::shared_ptr rel, + void appendRecursiveExtend(std::shared_ptr boundNode, + std::shared_ptr nbrNode, std::shared_ptr rel, ExtendDirection direction, LogicalPlan& plan); - void createRecursivePlan(std::shared_ptr boundNode, - std::shared_ptr recursiveNode, std::shared_ptr recursiveRel, - ExtendDirection direction, const expression_vector& predicates, LogicalPlan& plan); - void createPathNodePropertyScanPlan(std::shared_ptr node, - const expression_vector& properties, LogicalPlan& plan); - void createPathRelPropertyScanPlan(std::shared_ptr boundNode, - std::shared_ptr nbrNode, std::shared_ptr recursiveRel, - ExtendDirection direction, const expression_vector& properties, LogicalPlan& plan); - void appendNodeLabelFilter(std::shared_ptr nodeID, + void createRecursivePlan(std::shared_ptr boundNode, + std::shared_ptr recursiveNode, + std::shared_ptr recursiveRel, ExtendDirection direction, + const binder::expression_vector& predicates, LogicalPlan& plan); + void createPathNodePropertyScanPlan(std::shared_ptr node, + const binder::expression_vector& properties, LogicalPlan& plan); + void createPathRelPropertyScanPlan(std::shared_ptr boundNode, + std::shared_ptr nbrNode, + std::shared_ptr recursiveRel, ExtendDirection direction, + const binder::expression_vector& properties, LogicalPlan& plan); + void appendNodeLabelFilter(std::shared_ptr nodeID, std::unordered_set tableIDSet, LogicalPlan& plan); // Append Join operators void appendHashJoin(const binder::expression_vector& joinNodeIDs, common::JoinType joinType, LogicalPlan& probePlan, LogicalPlan& buildPlan); void appendMarkJoin(const binder::expression_vector& joinNodeIDs, - const std::shared_ptr& mark, LogicalPlan& probePlan, LogicalPlan& buildPlan); - void appendIntersect(const std::shared_ptr& intersectNodeID, + const std::shared_ptr& mark, LogicalPlan& probePlan, + LogicalPlan& buildPlan); + void appendIntersect(const std::shared_ptr& intersectNodeID, binder::expression_vector& boundNodeIDs, LogicalPlan& probePlan, std::vector>& buildPlans); @@ -209,24 +217,24 @@ class QueryPlanner { common::AccumulateType accumulateType, LogicalPlan& probePlan, LogicalPlan& buildPlan); inline void appendAccumulate(common::AccumulateType accumulateType, LogicalPlan& plan) { - appendAccumulate(accumulateType, expression_vector{}, plan); + appendAccumulate(accumulateType, binder::expression_vector{}, plan); } void appendAccumulate(common::AccumulateType accumulateType, const binder::expression_vector& expressionsToFlatten, LogicalPlan& plan); void appendDummyScan(LogicalPlan& plan); - void appendDistinct(const expression_vector& expressionsToDistinct, LogicalPlan& plan); + void appendDistinct(const binder::expression_vector& expressionsToDistinct, LogicalPlan& plan); - void appendUnwind(const BoundReadingClause& boundReadingClause, LogicalPlan& plan); + void appendUnwind(const binder::BoundReadingClause& boundReadingClause, LogicalPlan& plan); - void appendInQueryCall(const BoundReadingClause& boundReadingClause, LogicalPlan& plan); + void appendInQueryCall(const binder::BoundReadingClause& boundReadingClause, LogicalPlan& plan); void appendFlattens(const f_group_pos_set& groupsPos, LogicalPlan& plan); void appendFlattenIfNecessary(f_group_pos groupPos, LogicalPlan& plan); void appendFilters(const binder::expression_vector& predicates, LogicalPlan& plan); - void appendFilter(const std::shared_ptr& predicate, LogicalPlan& plan); + void appendFilter(const std::shared_ptr& predicate, LogicalPlan& plan); static void appendScanFile(binder::BoundFileScanInfo* fileScanInfo, LogicalPlan& plan); @@ -235,15 +243,15 @@ class QueryPlanner { static std::vector> getInitialEmptyPlans(); - expression_vector getProperties(const binder::Expression& nodeOrRel); + binder::expression_vector getProperties(const binder::Expression& nodeOrRel); std::unique_ptr enterContext(SubqueryType subqueryType, - const expression_vector& correlatedExpressions, uint64_t cardinality); + const binder::expression_vector& correlatedExpressions, uint64_t cardinality); void exitContext(std::unique_ptr prevContext); private: const catalog::Catalog& catalog; - expression_vector propertiesToScan; + binder::expression_vector propertiesToScan; std::unique_ptr cardinalityEstimator; std::unique_ptr context; }; diff --git a/src/include/planner/subplans_table.h b/src/include/planner/subplans_table.h index 188f987809..04cb5a39bd 100644 --- a/src/include/planner/subplans_table.h +++ b/src/include/planner/subplans_table.h @@ -1,15 +1,10 @@ #pragma once -#include -#include #include -#include #include "binder/query/query_graph.h" #include "planner/operator/logical_plan.h" -using namespace kuzu::binder; - namespace kuzu { namespace planner { @@ -28,7 +23,7 @@ const uint64_t MAX_LEVEL_TO_PLAN_EXACTLY = 7; // Therefore, we try to be factorization aware when keeping optimal plans. class SubgraphPlans { public: - SubgraphPlans(const SubqueryGraph& subqueryGraph); + SubgraphPlans(const binder::SubqueryGraph& subqueryGraph); inline uint64_t getMaxCost() const { return maxCost; } @@ -39,7 +34,7 @@ class SubgraphPlans { private: // To balance computation time, we encode plan by only considering the flat information of the // nodes that are involved in current subgraph. - std::bitset encodePlan(const LogicalPlan& plan); + std::bitset encodePlan(const LogicalPlan& plan); private: constexpr static uint32_t MAX_NUM_PLANS = 10; @@ -48,7 +43,7 @@ class SubgraphPlans { uint64_t maxCost = UINT64_MAX; binder::expression_vector nodeIDsToEncode; std::vector> plans; - std::unordered_map, common::vector_idx_t> + std::unordered_map, common::vector_idx_t> encodedPlan2PlanIdx; }; @@ -56,17 +51,17 @@ class SubgraphPlans { // variables. class DPLevel { public: - inline bool contains(const SubqueryGraph& subqueryGraph) { + inline bool contains(const binder::SubqueryGraph& subqueryGraph) { return subgraph2Plans.contains(subqueryGraph); } - inline SubgraphPlans* getSubgraphPlans(const SubqueryGraph& subqueryGraph) { + inline SubgraphPlans* getSubgraphPlans(const binder::SubqueryGraph& subqueryGraph) { return subgraph2Plans.at(subqueryGraph).get(); } - std::vector getSubqueryGraphs(); + std::vector getSubqueryGraphs(); - void addPlan(const SubqueryGraph& subqueryGraph, std::unique_ptr plan); + void addPlan(const binder::SubqueryGraph& subqueryGraph, std::unique_ptr plan); inline void clear() { subgraph2Plans.clear(); } @@ -74,27 +69,28 @@ class DPLevel { constexpr static uint32_t MAX_NUM_SUBGRAPH = 50; private: - subquery_graph_V_map_t> subgraph2Plans; + binder::subquery_graph_V_map_t> subgraph2Plans; }; class SubPlansTable { public: void resize(uint32_t newSize); - uint64_t getMaxCost(const SubqueryGraph& subqueryGraph) const; + uint64_t getMaxCost(const binder::SubqueryGraph& subqueryGraph) const; - bool containSubgraphPlans(const SubqueryGraph& subqueryGraph) const; + bool containSubgraphPlans(const binder::SubqueryGraph& subqueryGraph) const; - std::vector>& getSubgraphPlans(const SubqueryGraph& subqueryGraph); + std::vector>& getSubgraphPlans( + const binder::SubqueryGraph& subqueryGraph); - std::vector getSubqueryGraphs(uint32_t level); + std::vector getSubqueryGraphs(uint32_t level); - void addPlan(const SubqueryGraph& subqueryGraph, std::unique_ptr plan); + void addPlan(const binder::SubqueryGraph& subqueryGraph, std::unique_ptr plan); void clear(); private: - DPLevel* getDPLevel(const SubqueryGraph& subqueryGraph) const { + DPLevel* getDPLevel(const binder::SubqueryGraph& subqueryGraph) const { return dpLevels[subqueryGraph.getTotalNumVariables()].get(); } diff --git a/src/include/processor/data_pos.h b/src/include/processor/data_pos.h index 90bd776086..89b3c31b67 100644 --- a/src/include/processor/data_pos.h +++ b/src/include/processor/data_pos.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include "common/types/types.h" diff --git a/src/include/processor/expression_mapper.h b/src/include/processor/expression_mapper.h index 8258b4a504..d4f34ba16c 100644 --- a/src/include/processor/expression_mapper.h +++ b/src/include/processor/expression_mapper.h @@ -2,8 +2,6 @@ #include "binder/expression/expression.h" #include "expression_evaluator/expression_evaluator.h" -#include "processor/execution_context.h" -#include "processor/result/result_set.h" #include "processor/result/result_set_descriptor.h" namespace kuzu { diff --git a/src/include/processor/operator/aggregate/aggregate_hash_table.h b/src/include/processor/operator/aggregate/aggregate_hash_table.h index bd130c3847..7b4b08fd88 100644 --- a/src/include/processor/operator/aggregate/aggregate_hash_table.h +++ b/src/include/processor/operator/aggregate/aggregate_hash_table.h @@ -2,7 +2,6 @@ #include "aggregate_input.h" #include "function/aggregate_function.h" -#include "function/comparison/comparison_functions.h" #include "processor/operator/base_hash_table.h" #include "storage/buffer_manager/memory_manager.h" diff --git a/src/include/processor/operator/aggregate/aggregate_input.h b/src/include/processor/operator/aggregate/aggregate_input.h index dd78442a1f..b391ee7d34 100644 --- a/src/include/processor/operator/aggregate/aggregate_input.h +++ b/src/include/processor/operator/aggregate/aggregate_input.h @@ -1,7 +1,7 @@ #pragma once #include "common/data_chunk/data_chunk.h" -#include "processor/result/result_set_descriptor.h" +#include "processor/data_pos.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/base_hash_table.h b/src/include/processor/operator/base_hash_table.h index 8a4fc1ebdb..7ba95802ee 100644 --- a/src/include/processor/operator/base_hash_table.h +++ b/src/include/processor/operator/base_hash_table.h @@ -1,7 +1,6 @@ #pragma once #include "common/utils.h" -#include "function/hash/hash_functions.h" #include "processor/result/factorized_table.h" #include "storage/buffer_manager/memory_manager.h" diff --git a/src/include/processor/operator/call/in_query_call.h b/src/include/processor/operator/call/in_query_call.h index f3d517eea2..ffb6dcf78d 100644 --- a/src/include/processor/operator/call/in_query_call.h +++ b/src/include/processor/operator/call/in_query_call.h @@ -1,6 +1,6 @@ #pragma once -#include "catalog/catalog.h" +#include "function/table_functions.h" #include "function/table_functions/bind_data.h" #include "processor/operator/physical_operator.h" diff --git a/src/include/processor/operator/cross_product.h b/src/include/processor/operator/cross_product.h index 9d94c318c0..535b35f2c5 100644 --- a/src/include/processor/operator/cross_product.h +++ b/src/include/processor/operator/cross_product.h @@ -1,6 +1,7 @@ #pragma once -#include "result_collector.h" +#include "processor/operator/physical_operator.h" +#include "processor/result/factorized_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/ddl/create_node_table.h b/src/include/processor/operator/ddl/create_node_table.h index b6d8c0b005..83a506bfda 100644 --- a/src/include/processor/operator/ddl/create_node_table.h +++ b/src/include/processor/operator/ddl/create_node_table.h @@ -1,8 +1,6 @@ #pragma once #include "processor/operator/ddl/ddl.h" -#include "storage/stats/nodes_store_statistics.h" -#include "storage/store/nodes_store.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/ddl/create_rel_table.h b/src/include/processor/operator/ddl/create_rel_table.h index 14ac815c5b..b54344ed32 100644 --- a/src/include/processor/operator/ddl/create_rel_table.h +++ b/src/include/processor/operator/ddl/create_rel_table.h @@ -1,7 +1,6 @@ #pragma once #include "processor/operator/ddl/ddl.h" -#include "storage/stats/rels_store_statistics.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/ddl/create_rel_table_group.h b/src/include/processor/operator/ddl/create_rel_table_group.h index 348ed824b8..760c407622 100644 --- a/src/include/processor/operator/ddl/create_rel_table_group.h +++ b/src/include/processor/operator/ddl/create_rel_table_group.h @@ -1,7 +1,6 @@ #pragma once #include "processor/operator/ddl/ddl.h" -#include "storage/stats/rels_store_statistics.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/ddl/drop_table.h b/src/include/processor/operator/ddl/drop_table.h index 1dab65612e..96e3615ec1 100644 --- a/src/include/processor/operator/ddl/drop_table.h +++ b/src/include/processor/operator/ddl/drop_table.h @@ -1,7 +1,6 @@ #pragma once #include "ddl.h" -#include "storage/storage_manager.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/filtering_operator.h b/src/include/processor/operator/filtering_operator.h index 541dec69a6..c3bb397564 100644 --- a/src/include/processor/operator/filtering_operator.h +++ b/src/include/processor/operator/filtering_operator.h @@ -1,7 +1,6 @@ #pragma once -#include "common/data_chunk/data_chunk.h" -#include "common/data_chunk/data_chunk_state.h" +#include "common/data_chunk/sel_vector.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/hash_join/hash_join_build.h b/src/include/processor/operator/hash_join/hash_join_build.h index 6e1a903d68..74e711ad5b 100644 --- a/src/include/processor/operator/hash_join/hash_join_build.h +++ b/src/include/processor/operator/hash_join/hash_join_build.h @@ -1,6 +1,5 @@ #pragma once -#include "function/hash/hash_functions.h" #include "join_hash_table.h" #include "processor/operator/physical_operator.h" #include "processor/operator/sink.h" diff --git a/src/include/processor/operator/hash_join/join_hash_table.h b/src/include/processor/operator/hash_join/join_hash_table.h index 0f01a0ad82..e31510a908 100644 --- a/src/include/processor/operator/hash_join/join_hash_table.h +++ b/src/include/processor/operator/hash_join/join_hash_table.h @@ -1,7 +1,7 @@ #pragma once -#include "common/utils.h" -#include "function/hash/hash_functions.h" +#include + #include "processor/operator/base_hash_table.h" #include "storage/buffer_manager/memory_manager.h" diff --git a/src/include/processor/operator/intersect/intersect.h b/src/include/processor/operator/intersect/intersect.h index f21a9d7169..14d2661727 100644 --- a/src/include/processor/operator/intersect/intersect.h +++ b/src/include/processor/operator/intersect/intersect.h @@ -1,6 +1,6 @@ #pragma once -#include "processor/operator/intersect/intersect_build.h" +#include "processor/operator/hash_join/hash_join_build.h" #include "processor/operator/physical_operator.h" namespace kuzu { diff --git a/src/include/processor/operator/macro/create_macro.h b/src/include/processor/operator/macro/create_macro.h index 40cbd51404..8d8b9f26ba 100644 --- a/src/include/processor/operator/macro/create_macro.h +++ b/src/include/processor/operator/macro/create_macro.h @@ -1,7 +1,6 @@ #pragma once #include "catalog/catalog.h" -#include "common/string_utils.h" #include "function/scalar_macro_function.h" #include "processor/operator/physical_operator.h" diff --git a/src/include/processor/operator/order_by/order_by.h b/src/include/processor/operator/order_by/order_by.h index 2dc44c8acd..05e0963444 100644 --- a/src/include/processor/operator/order_by/order_by.h +++ b/src/include/processor/operator/order_by/order_by.h @@ -1,7 +1,5 @@ #pragma once -#include "common/data_chunk/data_chunk_state.h" -#include "common/in_mem_overflow_buffer.h" #include "processor/operator/sink.h" #include "processor/result/result_set.h" #include "sort_state.h" diff --git a/src/include/processor/operator/order_by/order_by_key_encoder.h b/src/include/processor/operator/order_by/order_by_key_encoder.h index abc5e1115a..796adfa58e 100644 --- a/src/include/processor/operator/order_by/order_by_key_encoder.h +++ b/src/include/processor/operator/order_by/order_by_key_encoder.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include -#include "common/constants.h" -#include "common/utils.h" +#include "common/exception/not_implemented.h" #include "common/vector/value_vector.h" #include "order_by_data_info.h" #include "processor/result/factorized_table.h" diff --git a/src/include/processor/operator/order_by/order_by_merge.h b/src/include/processor/operator/order_by/order_by_merge.h index 4d61148268..fc63d5eb4e 100644 --- a/src/include/processor/operator/order_by/order_by_merge.h +++ b/src/include/processor/operator/order_by/order_by_merge.h @@ -1,9 +1,8 @@ #pragma once -#include "processor/operator/order_by/order_by.h" +#include "processor/operator/order_by/sort_state.h" #include "processor/operator/physical_operator.h" #include "processor/operator/sink.h" -#include "processor/result/factorized_table.h" #include "processor/result/result_set.h" namespace kuzu { diff --git a/src/include/processor/operator/order_by/order_by_scan.h b/src/include/processor/operator/order_by/order_by_scan.h index 8df9b164ec..6ae9da0fd3 100644 --- a/src/include/processor/operator/order_by/order_by_scan.h +++ b/src/include/processor/operator/order_by/order_by_scan.h @@ -1,6 +1,6 @@ #pragma once -#include "processor/operator/order_by/order_by.h" +#include "processor/operator/order_by/sort_state.h" #include "processor/operator/physical_operator.h" namespace kuzu { diff --git a/src/include/processor/operator/order_by/radix_sort.h b/src/include/processor/operator/order_by/radix_sort.h index 482c53b6df..8b75d5f77b 100644 --- a/src/include/processor/operator/order_by/radix_sort.h +++ b/src/include/processor/operator/order_by/radix_sort.h @@ -2,8 +2,6 @@ #include -#include "common/constants.h" -#include "common/vector/value_vector.h" #include "processor/operator/order_by/key_block_merger.h" #include "processor/operator/order_by/order_by_key_encoder.h" #include "processor/result/factorized_table.h" diff --git a/src/include/processor/operator/order_by/top_k.h b/src/include/processor/operator/order_by/top_k.h index 08d1cde391..743806451c 100644 --- a/src/include/processor/operator/order_by/top_k.h +++ b/src/include/processor/operator/order_by/top_k.h @@ -1,8 +1,5 @@ #pragma once -#include - -#include "function/binary_function_executor.h" #include "processor/operator/sink.h" #include "sort_state.h" diff --git a/src/include/processor/operator/partitioner.h b/src/include/processor/operator/partitioner.h index 5b4fc2e3ce..65a5ba48e8 100644 --- a/src/include/processor/operator/partitioner.h +++ b/src/include/processor/operator/partitioner.h @@ -1,6 +1,5 @@ #pragma once -#include "common/column_data_format.h" #include "processor/operator/sink.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/copy_node.h b/src/include/processor/operator/persistent/copy_node.h index 84d3c0df13..cd000d04d3 100644 --- a/src/include/processor/operator/persistent/copy_node.h +++ b/src/include/processor/operator/persistent/copy_node.h @@ -1,6 +1,5 @@ #pragma once -#include "common/copier_config/copier_config.h" #include "processor/operator/sink.h" #include "storage/store/node_group.h" #include "storage/store/node_table.h" diff --git a/src/include/processor/operator/persistent/copy_rdf_resource.h b/src/include/processor/operator/persistent/copy_rdf_resource.h index cd1ec4eb51..c58818ae36 100644 --- a/src/include/processor/operator/persistent/copy_rdf_resource.h +++ b/src/include/processor/operator/persistent/copy_rdf_resource.h @@ -2,7 +2,6 @@ #include "copy_node.h" #include "processor/operator/sink.h" -#include "storage/store/node_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/copy_to_csv.h b/src/include/processor/operator/persistent/copy_to_csv.h index 520ac93e16..148e6be31d 100644 --- a/src/include/processor/operator/persistent/copy_to_csv.h +++ b/src/include/processor/operator/persistent/copy_to_csv.h @@ -3,7 +3,7 @@ #include "common/file_utils.h" #include "common/serializer/buffered_serializer.h" #include "copy_to.h" -#include "function/cast/vector_cast_functions.h" +#include "function/scalar_function.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/csv_file_writer.h b/src/include/processor/operator/persistent/csv_file_writer.h index c20066ae19..fe56684c5c 100644 --- a/src/include/processor/operator/persistent/csv_file_writer.h +++ b/src/include/processor/operator/persistent/csv_file_writer.h @@ -1,7 +1,8 @@ #pragma once +#include + #include "processor/operator/persistent/file_writer.h" -#include "processor/result/result_set.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/delete_executor.h b/src/include/processor/operator/persistent/delete_executor.h index 3f8364bc6e..3d6ad25a31 100644 --- a/src/include/processor/operator/persistent/delete_executor.h +++ b/src/include/processor/operator/persistent/delete_executor.h @@ -2,7 +2,9 @@ #include "processor/execution_context.h" #include "processor/result/result_set.h" +#include "storage/stats/rels_store_statistics.h" #include "storage/store/node_table.h" +#include "storage/store/rel_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/file_writer.h b/src/include/processor/operator/persistent/file_writer.h index b67017bb7b..0fe52e373f 100644 --- a/src/include/processor/operator/persistent/file_writer.h +++ b/src/include/processor/operator/persistent/file_writer.h @@ -1,7 +1,7 @@ #pragma once -#include "common/copier_config/copier_config.h" -#include "processor/result/result_set.h" +#include "common/types/types.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/insert_executor.h b/src/include/processor/operator/persistent/insert_executor.h index bd9b11948a..046c3e6481 100644 --- a/src/include/processor/operator/persistent/insert_executor.h +++ b/src/include/processor/operator/persistent/insert_executor.h @@ -3,6 +3,7 @@ #include "expression_evaluator/expression_evaluator.h" #include "processor/execution_context.h" #include "storage/store/node_table.h" +#include "storage/store/rel_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader/csv/driver.h b/src/include/processor/operator/persistent/reader/csv/driver.h index 4d1843b0ab..c3f6105aa2 100644 --- a/src/include/processor/operator/persistent/reader/csv/driver.h +++ b/src/include/processor/operator/persistent/reader/csv/driver.h @@ -2,7 +2,6 @@ #include -#include "common/copier_config/copier_config.h" #include "common/data_chunk/data_chunk.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/reader/npy_reader.h b/src/include/processor/operator/persistent/reader/npy_reader.h index b49dc87b2d..0d89140e87 100644 --- a/src/include/processor/operator/persistent/reader/npy_reader.h +++ b/src/include/processor/operator/persistent/reader/npy_reader.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include "common/data_chunk/data_chunk.h" diff --git a/src/include/processor/operator/persistent/reader/parquet/column_reader.h b/src/include/processor/operator/persistent/reader/parquet/column_reader.h index 364ee3349f..f69f215d32 100644 --- a/src/include/processor/operator/persistent/reader/parquet/column_reader.h +++ b/src/include/processor/operator/persistent/reader/parquet/column_reader.h @@ -3,6 +3,7 @@ #include #include "common/constants.h" +#include "common/exception/not_implemented.h" #include "common/types/types.h" #include "common/vector/value_vector.h" #include "parquet/parquet_types.h" @@ -29,16 +30,22 @@ class ColumnReader { virtual inline void skip(uint64_t numValues) { pendingSkips += numValues; } virtual inline void dictionary( std::shared_ptr /*data*/, uint64_t /*num_entries*/) { - throw common::NotImplementedException{"Dictionary"}; + // LCOV_EXCL_START + throw common::NotImplementedException("Dictionary"); + // LCOV_EXCL_END } virtual inline void offsets(uint32_t* /*offsets*/, uint8_t* /*defines*/, uint64_t /*numValues*/, parquet_filter_t& /*filter*/, uint64_t /*resultOffset*/, common::ValueVector* /*result*/) { - throw common::NotImplementedException{"ColumnReader::offsets"}; + // LCOV_EXCL_START + throw common::NotImplementedException("ColumnReader::offsets"); + // LCOV_EXCL_END } virtual inline void plain(std::shared_ptr /*plainData*/, uint8_t* /*defines*/, uint64_t /*numValues*/, parquet_filter_t& /*filter*/, uint64_t /*resultOffset*/, common::ValueVector* /*result*/) { - throw common::NotImplementedException{"ColumnReader::plain"}; + // LCOV_EXCL_START + throw common::NotImplementedException("ColumnReader::plain"); + // LCOV_EXCL_END } virtual inline void resetPage() {} virtual inline uint64_t getGroupRowsAvailable() { return groupRowsAvailable; } diff --git a/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h b/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h index fa7eedba07..956fef7571 100644 --- a/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h +++ b/src/include/processor/operator/persistent/reader/parquet/list_column_reader.h @@ -1,7 +1,6 @@ #pragma once #include "column_reader.h" -#include "templated_column_reader.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader/parquet/parquet_reader.h b/src/include/processor/operator/persistent/reader/parquet/parquet_reader.h index eca5bd4aa0..408731df56 100644 --- a/src/include/processor/operator/persistent/reader/parquet/parquet_reader.h +++ b/src/include/processor/operator/persistent/reader/parquet/parquet_reader.h @@ -5,7 +5,7 @@ #include "common/types/types.h" #include "parquet/parquet_types.h" #include "resizable_buffer.h" -#include "struct_column_reader.h" +#include "thrift/protocol/TCompactProtocol.h" #include "thrift_tools.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h b/src/include/processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h index 818e20c006..61ea9f6c44 100644 --- a/src/include/processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h +++ b/src/include/processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h @@ -1,9 +1,7 @@ #pragma once #include "decode_utils.h" -#include "parquet/parquet_types.h" #include "resizable_buffer.h" -#include "thrift_tools.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader/parquet/resizable_buffer.h b/src/include/processor/operator/persistent/reader/parquet/resizable_buffer.h index 80373b9489..9fb7f0dd0a 100644 --- a/src/include/processor/operator/persistent/reader/parquet/resizable_buffer.h +++ b/src/include/processor/operator/persistent/reader/parquet/resizable_buffer.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "common/utils.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/reader/parquet/struct_column_reader.h b/src/include/processor/operator/persistent/reader/parquet/struct_column_reader.h index aa899cd44f..5cce7a191b 100644 --- a/src/include/processor/operator/persistent/reader/parquet/struct_column_reader.h +++ b/src/include/processor/operator/persistent/reader/parquet/struct_column_reader.h @@ -1,7 +1,6 @@ #pragma once #include "column_reader.h" -#include "templated_column_reader.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader/parquet/thrift_tools.h b/src/include/processor/operator/persistent/reader/parquet/thrift_tools.h index df35438d12..208a7232f8 100644 --- a/src/include/processor/operator/persistent/reader/parquet/thrift_tools.h +++ b/src/include/processor/operator/persistent/reader/parquet/thrift_tools.h @@ -1,9 +1,9 @@ #pragma once +#include #include #include "common/file_utils.h" -#include "thrift/protocol/TCompactProtocol.h" -#include "thrift/transport/TBufferTransports.h" +#include "thrift/transport/TVirtualTransport.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h b/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h index faec2739a2..9cdbc1f729 100644 --- a/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h +++ b/src/include/processor/operator/persistent/reader/rdf/rdf_reader.h @@ -2,7 +2,6 @@ #include "common/copier_config/rdf_config.h" #include "common/data_chunk/data_chunk.h" -#include "common/string_utils.h" #include "serd.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/reader_functions.h b/src/include/processor/operator/persistent/reader_functions.h index 6b30b2690f..003ac2931d 100644 --- a/src/include/processor/operator/persistent/reader_functions.h +++ b/src/include/processor/operator/persistent/reader_functions.h @@ -2,12 +2,12 @@ #include +#include "common/enums/table_type.h" #include "processor/operator/persistent/reader/csv/parallel_csv_reader.h" #include "processor/operator/persistent/reader/csv/serial_csv_reader.h" #include "processor/operator/persistent/reader/npy_reader.h" #include "processor/operator/persistent/reader/parquet/parquet_reader.h" #include "processor/operator/persistent/reader/rdf/rdf_reader.h" -#include "storage/store/table_copy_utils.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/persistent/reader_state.h b/src/include/processor/operator/persistent/reader_state.h index 63705ee001..c8e96b2472 100644 --- a/src/include/processor/operator/persistent/reader_state.h +++ b/src/include/processor/operator/persistent/reader_state.h @@ -1,6 +1,8 @@ #pragma once -#include "common/data_chunk/data_chunk.h" +#include + +#include "common/enums/table_type.h" #include "processor/operator/persistent/reader_functions.h" namespace kuzu { diff --git a/src/include/processor/operator/persistent/writer/parquet/string_column_writer.h b/src/include/processor/operator/persistent/writer/parquet/string_column_writer.h index 7b373daf6c..c5f520d01e 100644 --- a/src/include/processor/operator/persistent/writer/parquet/string_column_writer.h +++ b/src/include/processor/operator/persistent/writer/parquet/string_column_writer.h @@ -2,7 +2,6 @@ #include "parquet/parquet_types.h" #include "parquet_rle_bp_encoder.h" -#include "processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h" #include "processor/operator/persistent/writer/parquet/basic_column_writer.h" namespace kuzu { diff --git a/src/include/processor/operator/physical_operator.h b/src/include/processor/operator/physical_operator.h index 12dedd7a78..c1cf06324e 100644 --- a/src/include/processor/operator/physical_operator.h +++ b/src/include/processor/operator/physical_operator.h @@ -1,10 +1,8 @@ #pragma once #include "common/exception/interrupt.h" -#include "processor/data_pos.h" #include "processor/execution_context.h" #include "processor/result/result_set.h" -#include "storage/buffer_manager/buffer_manager.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/projection.h b/src/include/processor/operator/projection.h index ba7907d908..869f5434a4 100644 --- a/src/include/processor/operator/projection.h +++ b/src/include/processor/operator/projection.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "expression_evaluator/expression_evaluator.h" #include "processor/operator/physical_operator.h" diff --git a/src/include/processor/operator/recursive_extend/bfs_state.h b/src/include/processor/operator/recursive_extend/bfs_state.h index 079f3a324a..8e4decaf5d 100644 --- a/src/include/processor/operator/recursive_extend/bfs_state.h +++ b/src/include/processor/operator/recursive_extend/bfs_state.h @@ -1,7 +1,8 @@ #pragma once +#include + #include "frontier.h" -#include "processor/operator/mask.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/recursive_extend/frontier_scanner.h b/src/include/processor/operator/recursive_extend/frontier_scanner.h index e8a2be92cc..0e03afc86a 100644 --- a/src/include/processor/operator/recursive_extend/frontier_scanner.h +++ b/src/include/processor/operator/recursive_extend/frontier_scanner.h @@ -3,6 +3,7 @@ #include #include "bfs_state.h" +#include "common/vector/value_vector.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/recursive_extend/recursive_join.h b/src/include/processor/operator/recursive_extend/recursive_join.h index 0dca8641c6..f807a63a7c 100644 --- a/src/include/processor/operator/recursive_extend/recursive_join.h +++ b/src/include/processor/operator/recursive_extend/recursive_join.h @@ -4,8 +4,8 @@ #include "common/enums/query_rel_type.h" #include "frontier_scanner.h" #include "planner/operator/extend/recursive_join_type.h" +#include "processor/operator/mask.h" #include "processor/operator/physical_operator.h" -#include "processor/operator/result_collector.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/scan/scan_multi_rel_tables.h b/src/include/processor/operator/scan/scan_multi_rel_tables.h index fc0a0acb0a..1e6f98c3b6 100644 --- a/src/include/processor/operator/scan/scan_multi_rel_tables.h +++ b/src/include/processor/operator/scan/scan_multi_rel_tables.h @@ -1,7 +1,6 @@ #pragma once -#include "processor/operator/scan/scan_rel_csr_columns.h" -#include "processor/operator/scan/scan_rel_regular_columns.h" +#include "processor/operator/scan/scan_rel_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/table_scan/factorized_table_scan.h b/src/include/processor/operator/table_scan/factorized_table_scan.h index 065c423af2..81bf003967 100644 --- a/src/include/processor/operator/table_scan/factorized_table_scan.h +++ b/src/include/processor/operator/table_scan/factorized_table_scan.h @@ -1,7 +1,8 @@ #pragma once -#include "common/enums/join_type.h" -#include "processor/operator/result_collector.h" +#include "processor/data_pos.h" +#include "processor/operator/physical_operator.h" +#include "processor/result/factorized_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/table_scan/union_all_scan.h b/src/include/processor/operator/table_scan/union_all_scan.h index e83639fd63..4ba751c4e6 100644 --- a/src/include/processor/operator/table_scan/union_all_scan.h +++ b/src/include/processor/operator/table_scan/union_all_scan.h @@ -1,6 +1,7 @@ #pragma once -#include "processor/operator/result_collector.h" +#include "processor/operator/physical_operator.h" +#include "processor/result/factorized_table.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/operator/unwind.h b/src/include/processor/operator/unwind.h index 948ab6ba3b..091a1d0172 100644 --- a/src/include/processor/operator/unwind.h +++ b/src/include/processor/operator/unwind.h @@ -1,6 +1,5 @@ #pragma once -#include "binder/expression/expression.h" #include "expression_evaluator/expression_evaluator.h" #include "processor/operator/physical_operator.h" #include "processor/result/result_set.h" diff --git a/src/include/processor/plan_mapper.h b/src/include/processor/plan_mapper.h index 521feac971..25699495f3 100644 --- a/src/include/processor/plan_mapper.h +++ b/src/include/processor/plan_mapper.h @@ -1,12 +1,9 @@ #pragma once -#include "binder/expression/node_expression.h" -#include "common/enums/statement_type.h" #include "expression_mapper.h" #include "planner/operator/logical_plan.h" #include "processor/operator/result_collector.h" #include "processor/physical_plan.h" -#include "storage/stats/node_table_statistics.h" #include "storage/storage_manager.h" namespace kuzu { diff --git a/src/include/processor/processor.h b/src/include/processor/processor.h index 1ea65d84e5..8bb8060e02 100644 --- a/src/include/processor/processor.h +++ b/src/include/processor/processor.h @@ -1,11 +1,8 @@ #pragma once -#include - #include "common/task_system/task_scheduler.h" #include "processor/physical_plan.h" #include "processor/result/factorized_table.h" -#include "storage/buffer_manager/memory_manager.h" namespace kuzu { namespace processor { diff --git a/src/include/processor/result/factorized_table.h b/src/include/processor/result/factorized_table.h index ec8abb1c0c..9d507ec0a2 100644 --- a/src/include/processor/result/factorized_table.h +++ b/src/include/processor/result/factorized_table.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -7,9 +8,7 @@ #include "common/types/value/value.h" #include "common/vector/value_vector.h" #include "processor/data_pos.h" -#include "processor/result/flat_tuple.h" #include "storage/buffer_manager/memory_manager.h" -#include "storage/storage_structure/disk_overflow_file.h" namespace kuzu { namespace processor { @@ -221,7 +220,7 @@ class FactorizedTable { bool hasUnflatCol() const; inline bool hasUnflatCol(std::vector& colIdxes) const { - return any_of(colIdxes.begin(), colIdxes.end(), + return std::any_of(colIdxes.begin(), colIdxes.end(), [this](ft_col_idx_t colIdx) { return !tableSchema->getColumn(colIdx)->isFlat(); }); } diff --git a/src/include/processor/result/result_set_descriptor.h b/src/include/processor/result/result_set_descriptor.h index 6440ef5a21..6e2737f521 100644 --- a/src/include/processor/result/result_set_descriptor.h +++ b/src/include/processor/result/result_set_descriptor.h @@ -1,10 +1,6 @@ #pragma once -#include -#include - -#include "common/assert.h" -#include "processor/data_pos.h" +#include "common/types/types.h" namespace kuzu { namespace planner { diff --git a/src/include/storage/buffer_manager/bm_file_handle.h b/src/include/storage/buffer_manager/bm_file_handle.h index 9126979747..548dd63431 100644 --- a/src/include/storage/buffer_manager/bm_file_handle.h +++ b/src/include/storage/buffer_manager/bm_file_handle.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "storage/buffer_manager/vm_region.h" #include "storage/file_handle.h" diff --git a/src/include/storage/buffer_manager/buffer_manager.h b/src/include/storage/buffer_manager/buffer_manager.h index c9d857ba74..4b59856676 100644 --- a/src/include/storage/buffer_manager/buffer_manager.h +++ b/src/include/storage/buffer_manager/buffer_manager.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include "storage/buffer_manager/bm_file_handle.h" diff --git a/src/include/storage/buffer_manager/memory_manager.h b/src/include/storage/buffer_manager/memory_manager.h index 171577d460..c055b5b545 100644 --- a/src/include/storage/buffer_manager/memory_manager.h +++ b/src/include/storage/buffer_manager/memory_manager.h @@ -5,7 +5,6 @@ #include #include -#include "common/constants.h" #include "common/types/types.h" namespace kuzu { diff --git a/src/include/storage/file_handle.h b/src/include/storage/file_handle.h index c0e2467d18..d6548fc818 100644 --- a/src/include/storage/file_handle.h +++ b/src/include/storage/file_handle.h @@ -1,15 +1,11 @@ #pragma once -#include #include -#include #include -#include #include "common/constants.h" #include "common/file_utils.h" #include "common/types/types.h" -#include "storage/storage_utils.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/in_mem_storage_structure/in_mem_column_chunk.h b/src/include/storage/in_mem_storage_structure/in_mem_column_chunk.h deleted file mode 100644 index 0700a2135a..0000000000 --- a/src/include/storage/in_mem_storage_structure/in_mem_column_chunk.h +++ /dev/null @@ -1,150 +0,0 @@ -#pragma once - -#include "common/types/types.h" -#include "function/cast/functions/cast_string_to_functions.h" -#include "storage/storage_structure/in_mem_file.h" -#include "storage/store/table_copy_utils.h" -#include -#include -#include -#include -#include - -namespace kuzu { -namespace storage { - -struct PropertyCopyState { - PageByteCursor overflowCursor; -}; - -class InMemColumnChunk { -public: - InMemColumnChunk(common::LogicalType dataType, common::offset_t startNodeOffset, - common::offset_t endNodeOffset, std::unique_ptr csvReaderConfig, - bool requireNullBits = true); - - virtual ~InMemColumnChunk() = default; - - inline common::LogicalType getDataType() const { return dataType; } - - template - inline T getValue(common::offset_t pos) const { - return ((T*)buffer.get())[pos]; - } - - void setValueAtPos(const uint8_t* val, common::offset_t pos); - - inline bool isNull(common::offset_t pos) const { - assert(nullChunk); - return nullChunk->getValue(pos); - } - inline uint8_t* getData() const { return buffer.get(); } - inline uint64_t getNumBytesPerValue() const { return numBytesPerValue; } - inline uint64_t getNumBytes() const { return numBytes; } - inline InMemColumnChunk* getNullChunk() { return nullChunk.get(); } - void copyArrowBatch(std::shared_ptr batch); - virtual void copyArrowArray(arrow::Array& arrowArray, PropertyCopyState* copyState, - arrow::Array* nodeOffsets = nullptr); - virtual void flush(common::FileInfo* walFileInfo); - - template - void templateCopyValuesToPage(arrow::Array& array, arrow::Array* nodeOffsets); - - template - void setValueFromString(const char* value, uint64_t length, common::offset_t pos) { - T val; - function::CastStringToTypes::operation(value, length, val); - setValue(val, pos); - } - - template - inline void setValue(T val, common::offset_t pos) { - ((T*)buffer.get())[pos] = val; - } - -private: - template - void templateCopyArrowStringArray(arrow::Array& array, arrow::Array* nodeOffsets); - - template - void templateCopyValuesAsStringToPage(arrow::Array& array, arrow::Array* nodeOffsets); - - inline virtual common::offset_t getOffsetInBuffer(common::offset_t pos) { - return pos * numBytesPerValue; - } - - static uint32_t getDataTypeSizeInColumn(common::LogicalType& dataType); - -protected: - common::LogicalType dataType; - common::offset_t startNodeOffset; - std::uint64_t numBytesPerValue; - std::uint64_t numBytes; - std::unique_ptr buffer; - std::unique_ptr nullChunk; - std::unique_ptr csvReaderConfig; -}; - -class InMemColumnChunkWithOverflow : public InMemColumnChunk { -public: - InMemColumnChunkWithOverflow(common::LogicalType dataType, common::offset_t startNodeOffset, - common::offset_t endNodeOffset, std::unique_ptr csvReaderConfig, - InMemOverflowFile* inMemOverflowFile) - : InMemColumnChunk{std::move(dataType), startNodeOffset, endNodeOffset, - std::move(csvReaderConfig)}, - inMemOverflowFile{inMemOverflowFile}, blobBuffer{std::make_unique( - common::BufferPoolConstants::PAGE_4KB_SIZE)} {} - - void copyArrowArray(arrow::Array& array, PropertyCopyState* copyState, - arrow::Array* nodeOffsets = nullptr) final; - - void copyValuesToPageWithOverflow( - arrow::Array& array, PropertyCopyState* copyState, arrow::Array* nodeOffsets); - - template - void setValWithOverflow(PageByteCursor& /*overflowCursor*/, const char* /*value*/, - uint64_t /*length*/, uint64_t /*pos*/) { - assert(false); - } - -private: - template - void templateCopyArrowStringArray( - arrow::Array& array, PropertyCopyState* copyState, arrow::Array* nodeOffsets); - - template - void templateCopyValuesAsStringToPageWithOverflow( - arrow::Array& array, PropertyCopyState* copyState, arrow::Array* nodeOffsets); - -private: - storage::InMemOverflowFile* inMemOverflowFile; - std::unique_ptr blobBuffer; -}; - -class InMemFixedListColumnChunk : public InMemColumnChunk { -public: - InMemFixedListColumnChunk(common::LogicalType dataType, common::offset_t startNodeOffset, - common::offset_t endNodeOffset, std::unique_ptr csvReaderConfig); - - void flush(common::FileInfo* walFileInfo) override; - -private: - common::offset_t getOffsetInBuffer(common::offset_t pos) override; - -private: - uint64_t numElementsInAPage; -}; - -template<> -void InMemColumnChunk::templateCopyValuesToPage(arrow::Array& array, arrow::Array* offsets); -template<> -void InMemColumnChunk::templateCopyValuesToPage( - arrow::Array& array, arrow::Array* offsets); - -// FIXED_LIST -template<> -void InMemColumnChunk::setValueFromString( - const char* value, uint64_t length, uint64_t pos); - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/in_mem_storage_structure/in_mem_lists.h b/src/include/storage/in_mem_storage_structure/in_mem_lists.h deleted file mode 100644 index c21f3b7062..0000000000 --- a/src/include/storage/in_mem_storage_structure/in_mem_lists.h +++ /dev/null @@ -1,223 +0,0 @@ -#pragma once - -#include "common/copier_config/copier_config.h" -#include "function/cast/functions/cast_string_to_functions.h" -#include "storage/storage_structure/in_mem_file.h" -#include "storage/storage_structure/lists/list_headers.h" -#include "storage/storage_structure/lists/lists_metadata.h" -#include - -namespace kuzu { -namespace storage { - -typedef std::vector> atomic_uint64_vec_t; - -class InMemLists; -class AdjLists; -struct PropertyCopyState; - -using fill_in_mem_lists_function_t = - std::function; - -class InMemListsUtils { -public: - static inline void incrementListSize( - atomic_uint64_vec_t& listSizes, uint32_t offset, uint32_t val) { - assert(offset < listSizes.size()); - listSizes[offset].fetch_add(val, std::memory_order_relaxed); - } - static inline uint64_t decrementListSize( - atomic_uint64_vec_t& listSizes, uint32_t offset, uint32_t val) { - assert(offset < listSizes.size()); - return listSizes[offset].fetch_sub(val, std::memory_order_relaxed); - } -}; - -class InMemLists { -public: - InMemLists(std::string fName, common::LogicalType dataType, uint64_t numBytesForElement, - uint64_t numNodes, std::shared_ptr listHeadersBuilder, - std::unique_ptr csvReaderConfig, bool hasNullBytes) - : InMemLists{std::move(fName), numBytesForElement, std::move(dataType), numNodes, - std::move(csvReaderConfig), hasNullBytes} { - this->listHeadersBuilder = std::move(listHeadersBuilder); - } - virtual ~InMemLists() = default; - - virtual void saveToFile(); - void setValue(common::offset_t nodeOffset, uint64_t pos, uint8_t* val); - template - void setValueFromString( - common::offset_t nodeOffset, uint64_t pos, const char* val, uint64_t length) { - T result; - function::CastStringToTypes::operation(val, length, result); - setValue(nodeOffset, pos, (uint8_t*)&result); - } - - virtual inline InMemOverflowFile* getInMemOverflowFile() { return nullptr; } - inline ListsMetadataBuilder* getListsMetadataBuilder() { return listsMetadataBuilder.get(); } - inline uint8_t* getMemPtrToLoc(uint64_t pageIdx, uint16_t posInPage) const { - return inMemFile->getPage(pageIdx)->data + (posInPage * numBytesForElement); - } - inline common::LogicalType getDataType() { return dataType; } - inline uint64_t getNumElementsInAPage() const { return numElementsInAPage; } - - virtual void copyArrowArray(arrow::Array* boundNodeOffsets, arrow::Array* posInRelLists, - arrow::Array* array, PropertyCopyState* copyState); - template - void templateCopyArrayToRelLists( - arrow::Array* boundNodeOffsets, arrow::Array* posInRelList, arrow::Array* array); - - void fillWithDefaultVal(uint8_t* defaultVal, uint64_t numNodes, ListHeaders* listHeaders); - void initListsMetadataAndAllocatePages( - uint64_t numNodes, ListHeaders* listHeaders, ListsMetadata* listsMetadata); - - // Calculates the page id and offset in page where the data of a particular list has to be put - // in the in-mem pages. - PageElementCursor calcPageElementCursor( - uint64_t reversePos, uint8_t numBytesPerElement, common::offset_t nodeOffset); - -protected: - InMemLists(std::string fName, uint64_t numBytesForElement, common::LogicalType dataType, - uint64_t numNodes, std::unique_ptr csvReaderConfig, - bool hasNullBytes); - -private: - static void calculatePagesForList(uint64_t& numPages, uint64_t& offsetInPage, - uint64_t numElementsInList, uint64_t numElementsPerPage); - - static inline void fillInMemListsWithNonOverflowValFunc(InMemLists* inMemLists, - uint8_t* defaultVal, PageByteCursor& /*pageByteCursor*/, common::offset_t nodeOffset, - uint64_t posInList, const common::LogicalType& /*dataType*/) { - inMemLists->setValue(nodeOffset, posInList, defaultVal); - } - static void fillInMemListsWithStrValFunc(InMemLists* inMemLists, uint8_t* defaultVal, - PageByteCursor& pageByteCursor, common::offset_t nodeOffset, uint64_t posInList, - const common::LogicalType& dataType); - static void fillInMemListsWithListValFunc(InMemLists* inMemLists, uint8_t* defaultVal, - PageByteCursor& pageByteCursor, common::offset_t nodeOffset, uint64_t posInList, - const common::LogicalType& dataType); - static fill_in_mem_lists_function_t getFillInMemListsFunc(const common::LogicalType& dataType); - template - void templateCopyArrowStringArray( - arrow::Array* boundNodeOffsets, arrow::Array* posInRelList, arrow::Array* array); - template - void templateCopyArrayAsStringToRelLists( - arrow::Array* boundNodeOffsets, arrow::Array* posInRelList, arrow::Array* array); - -public: - std::unique_ptr inMemFile; - -protected: - std::string fName; - common::LogicalType dataType; - uint64_t numBytesForElement; - uint64_t numElementsInAPage; - std::unique_ptr listsMetadataBuilder; - std::shared_ptr listHeadersBuilder; - std::unique_ptr csvReaderConfig; -}; - -class InMemRelIDLists : public InMemLists { -public: - InMemRelIDLists(std::string fName, uint64_t numNodes, - std::shared_ptr listHeadersBuilder) - : InMemLists{std::move(fName), common::LogicalType{common::LogicalTypeID::INTERNAL_ID}, - sizeof(common::offset_t), numNodes, std::move(listHeadersBuilder), - nullptr /* copyDescriptor */, true /* hasNullBytes */} {} -}; - -class InMemListsWithOverflow : public InMemLists { -protected: - InMemListsWithOverflow(std::string fName, common::LogicalType dataType, uint64_t numNodes, - std::shared_ptr listHeadersBuilder, - std::unique_ptr csvReaderConfig); - - void copyArrowArray(arrow::Array* boundNodeOffsets, arrow::Array* posInRelLists, - arrow::Array* array, PropertyCopyState* copyState) final; - template - void templateCopyFromArrowString(arrow::Array* boundNodeOffsets, arrow::Array* posInRelList, - arrow::Array* array, PageByteCursor& overflowCursor); - template - void templateCopyArrayAsStringToRelListsWithOverflow(arrow::Array* boundNodeOffsets, - arrow::Array* posInRelList, arrow::Array* array, PageByteCursor& overflowCursor); - template - void setValueFromStringWithOverflow(PageByteCursor& /*overflowCursor*/, - common::offset_t /*nodeOffset*/, uint64_t /*pos*/, const char* /*val*/, - uint64_t /*length*/) { - assert(false); - } - - inline InMemOverflowFile* getInMemOverflowFile() override { return overflowInMemFile.get(); } - void saveToFile() override; - -protected: - std::unique_ptr overflowInMemFile; - std::unique_ptr blobBuffer; -}; - -class InMemAdjLists : public InMemLists { -public: - InMemAdjLists(std::string fName, uint64_t numNodes) - : InMemLists{std::move(fName), sizeof(common::offset_t), - common::LogicalType(common::LogicalTypeID::INTERNAL_ID), numNodes, nullptr, false} { - listHeadersBuilder = make_shared(this->fName, numNodes); - }; - - void saveToFile() override; - - inline std::shared_ptr getListHeadersBuilder() const { - return listHeadersBuilder; - } - inline uint32_t getListSize(common::offset_t nodeOffset) const { - return listHeadersBuilder->getListSize(nodeOffset); - } -}; - -class InMemStringLists : public InMemListsWithOverflow { -public: - InMemStringLists(std::string fName, uint64_t numNodes, - std::shared_ptr listHeadersBuilder) - : InMemListsWithOverflow{std::move(fName), - common::LogicalType(common::LogicalTypeID::STRING), numNodes, - std::move(listHeadersBuilder), nullptr} {}; -}; - -class InMemListLists : public InMemListsWithOverflow { -public: - InMemListLists(std::string fName, common::LogicalType dataType, uint64_t numNodes, - std::shared_ptr listHeadersBuilder, - std::unique_ptr csvReaderConfig) - : InMemListsWithOverflow{std::move(fName), std::move(dataType), numNodes, - std::move(listHeadersBuilder), std::move(csvReaderConfig)} {}; -}; - -class InMemListsFactory { -public: - static std::unique_ptr getInMemPropertyLists(const std::string& fName, - const common::LogicalType& dataType, uint64_t numNodes, - common::CSVReaderConfig* csvReaderConfig, - std::shared_ptr listHeadersBuilder = nullptr); -}; - -template<> -void InMemLists::templateCopyArrayToRelLists( - arrow::Array* boundNodeOffsets, arrow::Array* posInRelList, arrow::Array* array); - -// FIXED_LIST -template<> -void InMemLists::setValueFromString( - common::offset_t nodeOffset, uint64_t pos, const char* val, uint64_t length); - -template<> -void InMemListsWithOverflow::setValueFromStringWithOverflow( - PageByteCursor& overflowCursor, common::offset_t nodeOffset, uint64_t pos, const char* val, - uint64_t length); -template<> -void InMemListsWithOverflow::setValueFromStringWithOverflow( - PageByteCursor& overflowCursor, common::offset_t nodeOffset, uint64_t pos, const char* val, - uint64_t length); - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/index/hash_index.h b/src/include/storage/index/hash_index.h index 543ac411f1..4351533513 100644 --- a/src/include/storage/index/hash_index.h +++ b/src/include/storage/index/hash_index.h @@ -2,7 +2,6 @@ #include -#include "function/hash/hash_functions.h" #include "hash_index_builder.h" #include "storage/storage_structure/disk_overflow_file.h" diff --git a/src/include/storage/index/hash_index_slot.h b/src/include/storage/index/hash_index_slot.h index 21aa2dc875..ea14650048 100644 --- a/src/include/storage/index/hash_index_slot.h +++ b/src/include/storage/index/hash_index_slot.h @@ -4,7 +4,6 @@ #include "common/constants.h" #include "common/types/internal_id_t.h" -#include "common/types/ku_string.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/local_storage.h b/src/include/storage/local_storage.h index 3110f446a2..0b06f9d4e0 100644 --- a/src/include/storage/local_storage.h +++ b/src/include/storage/local_storage.h @@ -1,10 +1,11 @@ #pragma once -#include "local_table.h" +#include "storage/local_table.h" namespace kuzu { namespace storage { class NodesStore; +class StorageManager; // Data structures in LocalStorage are not thread-safe. // For now, we only support single thread insertions and updates. Once we optimize them with diff --git a/src/include/storage/local_table.h b/src/include/storage/local_table.h index 5668374090..8186dbb663 100644 --- a/src/include/storage/local_table.h +++ b/src/include/storage/local_table.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "common/vector/value_vector.h" diff --git a/src/include/storage/stats/node_table_statistics.h b/src/include/storage/stats/node_table_statistics.h index b26c896d68..189ba3206a 100644 --- a/src/include/storage/stats/node_table_statistics.h +++ b/src/include/storage/stats/node_table_statistics.h @@ -3,9 +3,11 @@ #include #include -#include "catalog/node_table_schema.h" +#include "common/vector/value_vector.h" +#include "storage/buffer_manager/buffer_manager.h" +#include "storage/stats/metadata_dah_info.h" #include "storage/stats/table_statistics.h" -#include "storage/store/rels_store.h" +#include "storage/wal/wal.h" namespace kuzu { namespace common { diff --git a/src/include/storage/stats/nodes_store_statistics.h b/src/include/storage/stats/nodes_store_statistics.h index 4738ff9162..be7149cc24 100644 --- a/src/include/storage/stats/nodes_store_statistics.h +++ b/src/include/storage/stats/nodes_store_statistics.h @@ -1,7 +1,10 @@ #pragma once +#include "catalog/node_table_schema.h" #include "storage/stats/node_table_statistics.h" #include "storage/stats/table_statistics_collection.h" +#include "storage/storage_utils.h" +#include "transaction/transaction.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/stats/property_statistics.h b/src/include/storage/stats/property_statistics.h index e54dbf37f9..594564b8bf 100644 --- a/src/include/storage/stats/property_statistics.h +++ b/src/include/storage/stats/property_statistics.h @@ -1,9 +1,11 @@ #pragma once #include "common/types/types.h" -#include "transaction/transaction.h" namespace kuzu { +namespace transaction { +class Transaction; +}; namespace storage { class PropertyStatistics { diff --git a/src/include/storage/stats/rel_table_statistics.h b/src/include/storage/stats/rel_table_statistics.h index 09f513af4d..e2d4f03af5 100644 --- a/src/include/storage/stats/rel_table_statistics.h +++ b/src/include/storage/stats/rel_table_statistics.h @@ -1,9 +1,9 @@ #pragma once -#include - +#include "common/enums/rel_direction.h" +#include "storage/buffer_manager/buffer_manager.h" +#include "storage/stats/metadata_dah_info.h" #include "storage/stats/table_statistics.h" -#include "storage/storage_utils.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/stats/rels_store_statistics.h b/src/include/storage/stats/rels_store_statistics.h index 30bcd8291c..caf7f9714d 100644 --- a/src/include/storage/stats/rels_store_statistics.h +++ b/src/include/storage/stats/rels_store_statistics.h @@ -2,6 +2,7 @@ #include "storage/stats/rel_table_statistics.h" #include "storage/stats/table_statistics_collection.h" +#include "storage/storage_utils.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/stats/table_statistics.h b/src/include/storage/stats/table_statistics.h index 0df12fdbe3..025503c22b 100644 --- a/src/include/storage/stats/table_statistics.h +++ b/src/include/storage/stats/table_statistics.h @@ -1,9 +1,6 @@ #pragma once -#include -#include - -#include "storage/stats/metadata_dah_info.h" +#include "common/enums/table_type.h" #include "storage/stats/property_statistics.h" namespace kuzu { diff --git a/src/include/storage/stats/table_statistics_collection.h b/src/include/storage/stats/table_statistics_collection.h index da26923de9..b64648a363 100644 --- a/src/include/storage/stats/table_statistics_collection.h +++ b/src/include/storage/stats/table_statistics_collection.h @@ -1,6 +1,10 @@ #pragma once +#include "catalog/table_schema.h" +#include "storage/buffer_manager/buffer_manager.h" +#include "storage/stats/metadata_dah_info.h" #include "storage/stats/table_statistics.h" +#include "transaction/transaction.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/storage_info.h b/src/include/storage/storage_info.h index dc8acc87d2..3b89a782a2 100644 --- a/src/include/storage/storage_info.h +++ b/src/include/storage/storage_info.h @@ -1,9 +1,7 @@ #pragma once -#include "exception" #include - -#include "common/utils.h" +#include namespace kuzu { namespace storage { diff --git a/src/include/storage/storage_manager.h b/src/include/storage/storage_manager.h index a4770c5952..ff4c79676b 100644 --- a/src/include/storage/storage_manager.h +++ b/src/include/storage/storage_manager.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/enums/access_mode.h" #include "storage/store/nodes_store.h" #include "storage/store/rels_store.h" diff --git a/src/include/storage/storage_structure/column.h b/src/include/storage/storage_structure/column.h deleted file mode 100644 index 309041e4c5..0000000000 --- a/src/include/storage/storage_structure/column.h +++ /dev/null @@ -1,254 +0,0 @@ -#pragma once - -#include "catalog/catalog.h" -#include "common/exception/storage.h" -#include "common/types/value/value.h" -#include "storage/storage_structure/disk_overflow_file.h" -#include "storage/storage_structure/storage_structure.h" - -namespace kuzu { -namespace storage { - -using read_data_func_t = std::function; -using write_data_func_t = std::function; - -class NullColumn; - -class Column : public BaseColumnOrList { -public: - // Currently extended by SERIAL column. - explicit Column(const common::LogicalType& dataType) : BaseColumnOrList{dataType} {}; - - Column(const StorageStructureIDAndFName& structureIDAndFName, - const common::LogicalType& dataType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode) - : Column(structureIDAndFName, dataType, storage::StorageUtils::getDataTypeSize(dataType), - bufferManager, wal, accessMode){}; - - Column(const StorageStructureIDAndFName& structureIDAndFName, - const common::LogicalType& dataType, size_t elementSize, BufferManager* bufferManager, - WAL* wal, common::AccessMode accessMode, bool requireNullBits = true); - - virtual void read(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector); - - void write(common::ValueVector* nodeIDVector, common::ValueVector* vectorToWriteFrom); - - bool isNull(common::offset_t nodeOffset, transaction::Transaction* transaction); - virtual void setNull(common::offset_t nodeOffset); - - inline NullColumn* getNullColumn() { return nullColumn.get(); } - -protected: - void lookup(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector, uint32_t vectorPos); - - virtual void lookup(transaction::Transaction* transaction, common::offset_t nodeOffset, - common::ValueVector* resultVector, uint32_t vectorPos); - virtual void scan(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector); - virtual void write(common::offset_t nodeOffset, common::ValueVector* vectorToWriteFrom, - uint32_t posInVectorToWriteFrom); - - void readFromPage(transaction::Transaction* transaction, common::page_idx_t pageIdx, - const std::function& func); - -private: - static void readValuesFromPage(transaction::Transaction* transaction, uint8_t* frame, - PageElementCursor& pageCursor, common::ValueVector* resultVector, uint32_t posInVector, - uint32_t numValuesToRead, DiskOverflowFile* diskOverflowFile); - static void writeValueToPage(uint8_t* frame, uint16_t posInFrame, common::ValueVector* vector, - uint32_t posInVector, DiskOverflowFile* diskOverflowFile); - -protected: - // no logical-physical page mapping is required for columns - std::function identityMapper = [](uint32_t i) { - return i; - }; - - read_data_func_t readDataFunc; - write_data_func_t writeDataFunc; - std::unique_ptr diskOverflowFile; - std::unique_ptr nullColumn; -}; - -class NullColumn : public Column { -public: - NullColumn(const StorageStructureIDAndFName& structureIDAndFName, BufferManager* bufferManager, - WAL* wal, common::AccessMode accessMode) - : Column{structureIDAndFName, common::LogicalType(common::LogicalTypeID::BOOL), - sizeof(bool), bufferManager, wal, accessMode, false /* requireNullBits */} { - readDataFunc = NullColumn::readNullsFromPage; - } - - void write(common::offset_t nodeOffset, common::ValueVector* vectorToWriteFrom, - uint32_t posInVectorToWriteFrom) final; - - bool readValue(common::offset_t nodeOffset, transaction::Transaction* transaction); - void setValue(common::offset_t nodeOffset, bool isNull = true); - -private: - static void readNullsFromPage(transaction::Transaction* transaction, uint8_t* frame, - PageElementCursor& pageCursor, common::ValueVector* resultVector, uint32_t posInVector, - uint32_t numValuesToRead, DiskOverflowFile* diskOverflowFile); -}; - -class PropertyColumnWithOverflow : public Column { -public: - PropertyColumnWithOverflow(const StorageStructureIDAndFName& structureIDAndFNameOfMainColumn, - const common::LogicalType& dataType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode) - : Column{structureIDAndFNameOfMainColumn, dataType, bufferManager, wal, accessMode} { - diskOverflowFile = std::make_unique( - structureIDAndFNameOfMainColumn, bufferManager, wal, accessMode); - } - - inline DiskOverflowFile* getDiskOverflowFile() { return diskOverflowFile.get(); } - inline BMFileHandle* getDiskOverflowFileHandle() { return diskOverflowFile->getFileHandle(); } -}; - -class StringPropertyColumn : public PropertyColumnWithOverflow { -public: - StringPropertyColumn(const StorageStructureIDAndFName& structureIDAndFNameOfMainColumn, - const common::LogicalType& dataType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode) - : PropertyColumnWithOverflow{ - structureIDAndFNameOfMainColumn, dataType, bufferManager, wal, accessMode} { - writeDataFunc = StringPropertyColumn::writeStringToPage; - }; - -private: - inline void lookup(transaction::Transaction* transaction, common::offset_t nodeOffset, - common::ValueVector* resultVector, uint32_t vectorPos) final { - resultVector->resetAuxiliaryBuffer(); - Column::lookup(transaction, nodeOffset, resultVector, vectorPos); - if (!resultVector->isNull(vectorPos)) { - diskOverflowFile->scanSingleStringOverflow( - transaction->getType(), *resultVector, vectorPos); - } - } - inline void scan(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector) final { - resultVector->resetAuxiliaryBuffer(); - Column::scan(transaction, nodeIDVector, resultVector); - diskOverflowFile->scanStrings(transaction->getType(), *resultVector); - } - - static void writeStringToPage(uint8_t* frame, uint16_t posInFrame, common::ValueVector* vector, - uint32_t posInVector, DiskOverflowFile* diskOverflowFile); -}; - -class ListPropertyColumn : public PropertyColumnWithOverflow { -public: - ListPropertyColumn(const StorageStructureIDAndFName& structureIDAndFNameOfMainColumn, - const common::LogicalType& dataType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode) - : PropertyColumnWithOverflow{ - structureIDAndFNameOfMainColumn, dataType, bufferManager, wal, accessMode} { - readDataFunc = ListPropertyColumn::readListsFromPage; - writeDataFunc = ListPropertyColumn::writeListToPage; - }; - -private: - static void readListsFromPage(transaction::Transaction* transaction, uint8_t* frame, - PageElementCursor& pageCursor, common::ValueVector* resultVector, uint32_t posInVector, - uint32_t numValuesToRead, DiskOverflowFile* diskOverflowFile); - static void writeListToPage(uint8_t* frame, uint16_t posInFrame, common::ValueVector* vector, - uint32_t posInVector, DiskOverflowFile* diskOverflowFile); -}; - -class StructPropertyColumn : public Column { -public: - StructPropertyColumn(const StorageStructureIDAndFName& structureIDAndFName, - const common::LogicalType& dataType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode); - - void read(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector) final; - - void setNull(common::offset_t nodeOffset) final; - - void write(common::offset_t nodeOffset, common::ValueVector* vectorToWriteFrom, - uint32_t posInVectorToWriteFrom) override; - -private: - std::vector> structFieldColumns; -}; - -class InternalIDColumn : public Column { -public: - InternalIDColumn(const StorageStructureIDAndFName& structureIDAndFName, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode) - : Column{structureIDAndFName, common::LogicalType(common::LogicalTypeID::INTERNAL_ID), - sizeof(common::offset_t), bufferManager, wal, accessMode, - true /* requireNullBits */} { - readDataFunc = InternalIDColumn::readInternalIDsFromPage; - writeDataFunc = InternalIDColumn::writeInternalIDToPage; - } - -private: - static void readInternalIDsFromPage(transaction::Transaction* transaction, uint8_t* frame, - PageElementCursor& pageCursor, common::ValueVector* resultVector, uint32_t posInVector, - uint32_t numValuesToRead, DiskOverflowFile* diskOverflowFile); - static void writeInternalIDToPage(uint8_t* frame, uint16_t posInFrame, - common::ValueVector* vector, uint32_t posInVector, DiskOverflowFile* diskOverflowFile); -}; - -class SerialColumn : public Column { -public: - SerialColumn() : Column{common::LogicalType{common::LogicalTypeID::SERIAL}} {} - - void read(transaction::Transaction* transaction, common::ValueVector* nodeIDVector, - common::ValueVector* resultVector) final; -}; - -class ColumnFactory { -public: - static std::unique_ptr getColumn(const StorageStructureIDAndFName& structureIDAndFName, - const common::LogicalType& logicalType, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode) { - switch (logicalType.getLogicalTypeID()) { - case common::LogicalTypeID::INT64: - case common::LogicalTypeID::INT32: - case common::LogicalTypeID::INT16: - case common::LogicalTypeID::INT8: - case common::LogicalTypeID::UINT64: - case common::LogicalTypeID::UINT32: - case common::LogicalTypeID::UINT16: - case common::LogicalTypeID::UINT8: - case common::LogicalTypeID::INT128: - case common::LogicalTypeID::DOUBLE: - case common::LogicalTypeID::FLOAT: - case common::LogicalTypeID::BOOL: - case common::LogicalTypeID::DATE: - case common::LogicalTypeID::TIMESTAMP: - case common::LogicalTypeID::INTERVAL: - case common::LogicalTypeID::FIXED_LIST: - return std::make_unique( - structureIDAndFName, logicalType, bufferManager, wal, accessMode); - case common::LogicalTypeID::BLOB: - case common::LogicalTypeID::STRING: - return std::make_unique( - structureIDAndFName, logicalType, bufferManager, wal, accessMode); - case common::LogicalTypeID::VAR_LIST: - return std::make_unique( - structureIDAndFName, logicalType, bufferManager, wal, accessMode); - case common::LogicalTypeID::INTERNAL_ID: - return std::make_unique( - structureIDAndFName, bufferManager, wal, accessMode); - case common::LogicalTypeID::STRUCT: - return std::make_unique( - structureIDAndFName, logicalType, bufferManager, wal, accessMode); - case common::LogicalTypeID::SERIAL: - return std::make_unique(); - default: - throw common::StorageException("Invalid type for property column creation."); - } - } -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_structure/db_file_utils.h b/src/include/storage/storage_structure/db_file_utils.h index 5a15bd9aee..24162f2227 100644 --- a/src/include/storage/storage_structure/db_file_utils.h +++ b/src/include/storage/storage_structure/db_file_utils.h @@ -2,8 +2,6 @@ #include #include -#include -#include #include "common/types/types.h" #include "storage/buffer_manager/bm_file_handle.h" diff --git a/src/include/storage/storage_structure/disk_array.h b/src/include/storage/storage_structure/disk_array.h index 647d1d2f92..7f7bfdd7bb 100644 --- a/src/include/storage/storage_structure/disk_array.h +++ b/src/include/storage/storage_structure/disk_array.h @@ -4,6 +4,7 @@ #include "common/types/types.h" #include "db_file_utils.h" #include "storage/buffer_manager/bm_file_handle.h" +#include "storage/storage_utils.h" #include "storage/wal/wal.h" #include "transaction/transaction.h" diff --git a/src/include/storage/storage_structure/disk_overflow_file.h b/src/include/storage/storage_structure/disk_overflow_file.h index cb9aa04c16..387e23228a 100644 --- a/src/include/storage/storage_structure/disk_overflow_file.h +++ b/src/include/storage/storage_structure/disk_overflow_file.h @@ -2,8 +2,6 @@ #include -#include "common/types/ku_list.h" -#include "common/vector/value_vector.h" #include "storage/buffer_manager/buffer_manager.h" #include "storage/storage_structure/db_file_utils.h" #include "storage/storage_utils.h" diff --git a/src/include/storage/storage_structure/in_mem_file.h b/src/include/storage/storage_structure/in_mem_file.h index 8f54042d2d..0d956ff834 100644 --- a/src/include/storage/storage_structure/in_mem_file.h +++ b/src/include/storage/storage_structure/in_mem_file.h @@ -2,7 +2,7 @@ #include -#include "common/constants.h" +#include "common/types/ku_string.h" #include "common/types/value/value.h" #include "storage/storage_structure/in_mem_page.h" #include "storage/storage_utils.h" diff --git a/src/include/storage/storage_structure/in_mem_page.h b/src/include/storage/storage_structure/in_mem_page.h index 05695c4701..171c89bf39 100644 --- a/src/include/storage/storage_structure/in_mem_page.h +++ b/src/include/storage/storage_structure/in_mem_page.h @@ -1,11 +1,7 @@ #pragma once +#include #include -#include - -#include "common/constants.h" -#include "common/null_mask.h" -#include "common/types/internal_id_t.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/storage_structure/lists/list_headers.h b/src/include/storage/storage_structure/lists/list_headers.h deleted file mode 100644 index 0412e0357a..0000000000 --- a/src/include/storage/storage_structure/lists/list_headers.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include - -#include "storage/storage_structure/disk_array.h" - -namespace kuzu { -namespace storage { - -using csr_offset_t = uint32_t; - -/** - * ListHeaders holds the headers of all lists in a single Lists data structure, which implements a - * chunked CSR, where each chunk stores ListsMetadataConstants::LISTS_CHUNK_SIZE many lists. - * - * A header of a list is a unsigned integer values. Each value records the start CSR offset of the - * list inside the chunk, and the last value of each chunk records the length of the list within - * the chunk. - * - * Using Lists::numElementsPerPage (which is stored in the base class StorageStructure), this offset - * can be turned into a logical pageIdx (which we call idxInPageList), which can later be turned - * into a physical page index (which we refer to as listPageIdx) in the .lists file. This is done as - * follows: Consider a nodeOffset v that is in chunk c. We obtain the the beginning of the - * "pageList" of the chunk by going to idxOfPageListBeginInPageLists = - * chunkToPageListHeadIdxMap(c). PageLists are the list of physical page idx's in the .lists file - * that store the contents of the lists in a chunk. Each chunk has a page list. Similarly each large - * list has a pageList (see below for large lists)Now suppose the CSR offset of v is such - * that it should be in the "2"nd page of the chunk. So the idxInPageList for v's list is 2. Then we - * can go to pageLists[idxOfPageListBeginInPageLists+idxInPageList], which gives us the physical - * pageIdx that contains v's list in the .lists file. We cannot always directly go to - * pageLists[idxOfPageListBeginInPageLists+idxInPageList] because the page list of the chunk is - * logically divided into "page groups" ListsMetadataConstants::PAGE_LIST_GROUP_SIZE with a pointer - * to the next page group. That is, suppose PAGE_LIST_GROUP_SIZE = 3 and we need to find the - * physical pageIdx of idxInPageList=5'th page. Then we need to follow one "pointer" at - * idxOfNextPageGroupBeginInPageLists=pageLists[idxOfPageListBeginInPageLists+3] (+0, +1, and +2 - * store the physical page idx's for the first 3 pages and +3 stores the pointer to the beginning of - * the next page group). Then we go to pageLists[idxOfNextPageGroupBeginInPageLists + (5-3=2)]. - */ - -static constexpr uint64_t LIST_HEADERS_HEADER_PAGE_IDX = 0; - -class ListHeadersBuilder { -public: - explicit ListHeadersBuilder(const std::string& baseListFName, uint64_t numElements); - - inline csr_offset_t getCSROffset(common::offset_t offset) { - return offset % common::ListsMetadataConstants::LISTS_CHUNK_SIZE == 0 ? - 0 : - (*headersBuilder)[offset - 1]; - }; - inline csr_offset_t getListSize(common::offset_t offset) const { - return offset % common::ListsMetadataConstants::LISTS_CHUNK_SIZE == 0 ? - (*headersBuilder)[offset] : - (*headersBuilder)[offset] - (*headersBuilder)[offset - 1]; - }; - inline uint64_t getNumValues() { return headersBuilder->getNumElements(); } - - inline void setCSROffset(common::offset_t offset, csr_offset_t csrOffset) { - (*headersBuilder)[offset - 1] = csrOffset; - } - inline void saveToDisk() { headersBuilder->saveToDisk(); } - -private: - std::unique_ptr fileHandle; - std::unique_ptr> headersBuilder; -}; - -class ListHeaders { -public: - explicit ListHeaders(const StorageStructureIDAndFName& storageStructureIDAndFNameForBaseList, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode); - - inline csr_offset_t getCSROffset(common::offset_t offset) const { - return offset % common::ListsMetadataConstants::LISTS_CHUNK_SIZE == 0 ? - 0 : - (*headersDiskArray)[offset - 1]; - }; - inline csr_offset_t getCSROffset( - const common::offset_t offset, transaction::TransactionType transactionType) const { - return offset % common::ListsMetadataConstants::LISTS_CHUNK_SIZE == 0 ? - 0 : - headersDiskArray->get(offset - 1, transactionType); - } - inline csr_offset_t getListSize(common::offset_t offset) const { - return offset % common::ListsMetadataConstants::LISTS_CHUNK_SIZE == 0 ? - (*headersDiskArray)[offset] : - (*headersDiskArray)[offset] - (*headersDiskArray)[offset - 1]; - }; - inline uint64_t getNumElements(transaction::TransactionType transactionType) const { - return headersDiskArray->getNumElements(transactionType); - } - - inline void update(common::offset_t offset, csr_offset_t csrOffset) { - headersDiskArray->update(offset - 1, csrOffset); - } - - inline void checkpointInMemoryIfNecessary() const { - headersDiskArray->checkpointInMemoryIfNecessary(); - } - inline void rollbackInMemoryIfNecessary() const { - headersDiskArray->rollbackInMemoryIfNecessary(); - } - inline void pushBack(csr_offset_t csrOffset) { headersDiskArray->pushBack(csrOffset); } - -private: - // The CSR offset inside the chunk for each relList. The size of relList[i] is calculated as - // header[i] - header[i-1]. - std::unique_ptr> headersDiskArray; - std::unique_ptr fileHandle; - StorageStructureIDAndFName storageStructureIDAndFName; -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_structure/lists/lists.h b/src/include/storage/storage_structure/lists/lists.h deleted file mode 100644 index 46be261784..0000000000 --- a/src/include/storage/storage_structure/lists/lists.h +++ /dev/null @@ -1,290 +0,0 @@ -#pragma once - -#include "common/exception/storage.h" -#include "lists_update_store.h" -#include "storage/storage_structure/disk_overflow_file.h" -#include "storage/storage_structure/lists/list_handle.h" -#include "storage/storage_structure/storage_structure.h" - -namespace kuzu { -namespace storage { - -struct InMemList { - InMemList(uint64_t numElements, uint64_t elementSize, bool requireNullMask) - : numElements{numElements} { - listData = std::make_unique(numElements * elementSize); - nullMask = requireNullMask ? std::make_unique( - common::NullMask::getNumNullEntries(numElements)) : - nullptr; - } - - inline uint8_t* getListData() const { return listData.get(); } - inline bool hasNullBuffer() const { return nullMask != nullptr; } - inline common::NullMask* getNullMask() const { return nullMask.get(); } - - uint64_t numElements; - std::unique_ptr listData; - std::unique_ptr nullMask; -}; - -/** - * A lists data structure holds a list of homogeneous values for each offset in it. Lists are used - * for storing Adjacency List, Rel Property Lists. - * - * The offsets in the Lists are partitioned into fixed size. Hence, each offset, and its list, - * belongs to a chunk. If the offset's list is small (less than the PAGE_SIZE) it is stored together - * along with other lists in that chunk as in a CSR. However, large lists are stored out of their - * regular chunks and span multiple pages. The nature, size and logical location of the list is - * given by a 32-bit header value (explained in {@class ListHeaders}). Given the logical location of - * a list, {@class ListsMetadata} contains information that maps logical location of the list to the - * actual physical location in the Lists file on disk. - * */ -class Lists : public BaseColumnOrList { - friend class ListsUpdateIterator; - friend class ListsUpdateIteratorFactory; - -public: - Lists(const StorageStructureIDAndFName& storageStructureIDAndFName, - const common::LogicalType& dataType, const size_t& elementSize, - std::shared_ptr headers, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode, ListsUpdatesStore* listsUpdatesStore) - : Lists{storageStructureIDAndFName, dataType, elementSize, std::move(headers), - bufferManager, true /*hasNULLBytes*/, wal, accessMode, listsUpdatesStore} {}; - inline ListsMetadata& getListsMetadata() { return metadata; }; - inline std::shared_ptr getHeaders() const { return headers; }; - inline uint64_t getNumElementsFromListHeader(common::offset_t nodeOffset) const { - return headers->getListSize(nodeOffset); - } - inline uint64_t getNumElementsInListsUpdatesStore(common::offset_t nodeOffset) { - return listsUpdatesStore->getNumInsertedRelsForNodeOffset( - storageStructureIDAndFName.storageStructureID.listFileID, nodeOffset); - } - inline uint64_t getTotalNumElementsInList( - transaction::TransactionType transactionType, common::offset_t nodeOffset) { - return getNumElementsInPersistentStore(transactionType, nodeOffset) + - (transactionType == transaction::TransactionType::WRITE ? - getNumElementsInListsUpdatesStore(nodeOffset) - - listsUpdatesStore->getNumDeletedRels( - storageStructureIDAndFName.storageStructureID.listFileID, - nodeOffset) : - 0); - } - virtual inline void checkpointInMemoryIfNecessary() { - metadata.checkpointInMemoryIfNecessary(); - } - virtual inline void rollbackInMemoryIfNecessary() { metadata.rollbackInMemoryIfNecessary(); } - virtual inline bool mayContainNulls() const { return true; } - virtual inline void setDeletedRelsIfNecessary(transaction::Transaction* transaction, - ListHandle& listHandle, common::ValueVector* valueVector) { - // DO NOTHING. - } - virtual void readValues(transaction::Transaction* transaction, common::ValueVector* valueVector, - ListHandle& listHandle); - virtual void readFromList(common::ValueVector* valueVector, ListHandle& listHandle); - uint64_t getNumElementsInPersistentStore( - transaction::TransactionType transactionType, common::offset_t nodeOffset); - void initListReadingState(common::offset_t nodeOffset, ListHandle& listHandle, - transaction::TransactionType transactionType); - std::unique_ptr createInMemListWithDataFromUpdateStoreOnly( - common::offset_t nodeOffset, std::vector& insertedRelsTupleIdxInFT); - // This function writes the persistent store data (skipping over the deleted rels) and update - // store data to the inMemList. - std::unique_ptr writeToInMemList(common::offset_t nodeOffset, - const std::vector& insertedRelTupleIdxesInFT, - const std::unordered_set& deletedRelOffsetsForList, - UpdatedPersistentListOffsets* updatedPersistentListOffsets); - void fillInMemListsFromPersistentStore(common::offset_t nodeOffset, - uint64_t numElementsInPersistentStore, InMemList& inMemList, - const std::unordered_set& deletedRelOffsetsInList, - UpdatedPersistentListOffsets* updatedPersistentListOffsets = nullptr); - -protected: - virtual inline DiskOverflowFile* getDiskOverflowFileIfExists() { return nullptr; } - Lists(const StorageStructureIDAndFName& storageStructureIDAndFName, - const common::LogicalType& dataType, const size_t& elementSize, - std::shared_ptr headers, BufferManager* bufferManager, bool hasNULLBytes, - WAL* wal, common::AccessMode accessMode, ListsUpdatesStore* listsUpdatesStore) - : BaseColumnOrList{storageStructureIDAndFName, dataType, elementSize, bufferManager, - hasNULLBytes, wal, accessMode}, - storageStructureIDAndFName{storageStructureIDAndFName}, - metadata{storageStructureIDAndFName, bufferManager, wal, accessMode}, - headers{std::move(headers)}, listsUpdatesStore{listsUpdatesStore} {}; - -private: - void fillInMemListsFromFrame(InMemList& inMemList, const uint8_t* frame, uint64_t elemPosInPage, - uint64_t numElementsToReadInCurPage, - const std::unordered_set& deletedRelOffsetsInList, uint64_t numElementsRead, - uint64_t& nextPosToWriteToInMemList, - UpdatedPersistentListOffsets* updatedPersistentListOffsets); - - void readPropertyUpdatesToInMemListIfExists(InMemList& inMemList, - UpdatedPersistentListOffsets* updatedPersistentListOffsets, uint64_t numElementsRead, - uint64_t numElementsToReadInCurPage, uint64_t nextPosToWriteToInMemList); - -protected: - StorageStructureIDAndFName storageStructureIDAndFName; - ListsMetadata metadata; - std::shared_ptr headers; - ListsUpdatesStore* listsUpdatesStore; -}; - -class PropertyListsWithOverflow : public Lists { -public: - PropertyListsWithOverflow(const StorageStructureIDAndFName& storageStructureIDAndFName, - const common::LogicalType& dataType, std::shared_ptr headers, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode, - ListsUpdatesStore* listsUpdatesStore) - : Lists{storageStructureIDAndFName, dataType, - storage::StorageUtils::getDataTypeSize(dataType), std::move(headers), bufferManager, - wal, accessMode, listsUpdatesStore}, - diskOverflowFile{storageStructureIDAndFName, bufferManager, wal, accessMode} {} - -private: - inline DiskOverflowFile* getDiskOverflowFileIfExists() override { return &diskOverflowFile; } - -public: - DiskOverflowFile diskOverflowFile; -}; - -class StringPropertyLists : public PropertyListsWithOverflow { - -public: - StringPropertyLists(const StorageStructureIDAndFName& storageStructureIDAndFName, - const std::shared_ptr& headers, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode, ListsUpdatesStore* listsUpdatesStore) - : PropertyListsWithOverflow{storageStructureIDAndFName, - common::LogicalType{common::LogicalTypeID::STRING}, headers, bufferManager, wal, - accessMode, listsUpdatesStore} {}; - -private: - void readFromList(common::ValueVector* valueVector, ListHandle& listHandle) override; -}; - -class ListPropertyLists : public PropertyListsWithOverflow { - -public: - ListPropertyLists(const StorageStructureIDAndFName& storageStructureIDAndFName, - const common::LogicalType& dataType, const std::shared_ptr& headers, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode, - ListsUpdatesStore* listsUpdatesStore) - : PropertyListsWithOverflow{storageStructureIDAndFName, dataType, headers, bufferManager, - wal, accessMode, listsUpdatesStore} {}; - -private: - void readListFromPages( - common::ValueVector* valueVector, ListHandle& listHandle, PageElementCursor& pageCursor); - void readFromList(common::ValueVector* valueVector, ListHandle& listHandle) override; -}; - -class AdjLists : public Lists { - -public: - AdjLists(const StorageStructureIDAndFName& storageStructureIDAndFName, - common::table_id_t nbrTableID, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode, ListsUpdatesStore* listsUpdatesStore) - : Lists{storageStructureIDAndFName, common::LogicalType(common::LogicalTypeID::INTERNAL_ID), - sizeof(common::offset_t), - std::make_shared( - storageStructureIDAndFName, bufferManager, wal, accessMode), - bufferManager, false /* hasNullBytes */, wal, accessMode, listsUpdatesStore}, - nbrTableID{nbrTableID} {}; - - inline bool mayContainNulls() const final { return false; } - - void readValues(transaction::Transaction* transaction, common::ValueVector* valueVector, - ListHandle& listHandle) final; - - inline void checkpointInMemoryIfNecessary() final { - headers->checkpointInMemoryIfNecessary(); - Lists::checkpointInMemoryIfNecessary(); - } - - inline void rollbackInMemoryIfNecessary() final { - headers->rollbackInMemoryIfNecessary(); - Lists::rollbackInMemoryIfNecessary(); - } - -private: - void readFromList(common::ValueVector* valueVector, ListHandle& listHandle) final; - void readFromListsUpdatesStore(ListHandle& listHandle, common::ValueVector* valueVector); - void readFromPersistentStore(ListHandle& listHandle, common::ValueVector* valueVector); - -private: - common::table_id_t nbrTableID; -}; - -class RelIDList : public Lists { - -public: - RelIDList(const StorageStructureIDAndFName& storageStructureIDAndFName, - std::shared_ptr headers, BufferManager* bufferManager, WAL* wal, - common::AccessMode accessMode, ListsUpdatesStore* listsUpdatesStore) - : Lists{storageStructureIDAndFName, common::LogicalType{common::LogicalTypeID::INTERNAL_ID}, - sizeof(common::offset_t), std::move(headers), bufferManager, wal, accessMode, - listsUpdatesStore} {} - - void setDeletedRelsIfNecessary(transaction::Transaction* transaction, ListHandle& listHandle, - common::ValueVector* relIDVector) override; - - std::unordered_set getDeletedRelOffsetsInListForNodeOffset( - common::offset_t nodeOffset); - - list_offset_t getListOffset(common::offset_t nodeOffset, common::offset_t relOffset); - - void readFromList(common::ValueVector* valueVector, ListHandle& listHandle) override; - -private: - inline bool mayContainNulls() const override { return false; } - - inline common::table_id_t getRelTableID() const { - return storageStructureIDAndFName.storageStructureID.listFileID.relPropertyListID - .relNodeTableAndDir.relTableID; - } -}; - -class ListsFactory { - -public: - static std::unique_ptr getLists(const StorageStructureIDAndFName& structureIDAndFName, - const common::LogicalType& dataType, const std::shared_ptr& adjListsHeaders, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode, - ListsUpdatesStore* listsUpdatesStore) { - assert(listsUpdatesStore != nullptr); - switch (dataType.getLogicalTypeID()) { - case common::LogicalTypeID::INT64: - case common::LogicalTypeID::INT32: - case common::LogicalTypeID::INT16: - case common::LogicalTypeID::INT8: - case common::LogicalTypeID::UINT64: - case common::LogicalTypeID::UINT32: - case common::LogicalTypeID::UINT16: - case common::LogicalTypeID::UINT8: - case common::LogicalTypeID::INT128: - case common::LogicalTypeID::DOUBLE: - case common::LogicalTypeID::FLOAT: - case common::LogicalTypeID::BOOL: - case common::LogicalTypeID::DATE: - case common::LogicalTypeID::TIMESTAMP: - case common::LogicalTypeID::INTERVAL: - case common::LogicalTypeID::FIXED_LIST: - return std::make_unique(structureIDAndFName, dataType, - storage::StorageUtils::getDataTypeSize(dataType), adjListsHeaders, bufferManager, - wal, accessMode, listsUpdatesStore); - case common::LogicalTypeID::BLOB: - case common::LogicalTypeID::STRING: - return std::make_unique(structureIDAndFName, adjListsHeaders, - bufferManager, wal, accessMode, listsUpdatesStore); - case common::LogicalTypeID::VAR_LIST: - return std::make_unique(structureIDAndFName, dataType, - adjListsHeaders, bufferManager, wal, accessMode, listsUpdatesStore); - case common::LogicalTypeID::INTERNAL_ID: - return std::make_unique(structureIDAndFName, adjListsHeaders, bufferManager, - wal, accessMode, listsUpdatesStore); - default: - throw common::StorageException("Invalid type for property list creation."); - } - } -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_structure/lists/lists_metadata.h b/src/include/storage/storage_structure/lists/lists_metadata.h deleted file mode 100644 index f06d60b3e6..0000000000 --- a/src/include/storage/storage_structure/lists/lists_metadata.h +++ /dev/null @@ -1,115 +0,0 @@ -#pragma once - -#include "storage/storage_structure/disk_array.h" -#include "storage/storage_structure/storage_structure.h" - -namespace spdlog { -class logger; -} - -namespace kuzu { -namespace storage { - -class BaseListsMetadata { - -public: - static constexpr uint64_t CHUNK_PAGE_LIST_HEAD_IDX_MAP_HEADER_PAGE_IDX = 0; - static constexpr uint64_t CHUNK_PAGE_LIST_HEADER_PAGE_IDX = 1; - - explicit BaseListsMetadata() { - logger = common::LoggerUtils::getLogger(common::LoggerConstants::LoggerEnum::STORAGE); - } - - inline static std::function getIdxInPageListToListPageIdxMapper( - BaseInMemDiskArray* pageLists, uint32_t pageListsHead) { - return std::bind(getPageIdxFromAPageList, pageLists, pageListsHead, std::placeholders::_1); - } - - static uint64_t getPageIdxFromAPageList(BaseInMemDiskArray* pageLists, - uint32_t pageListHead, uint32_t idxInPageList); - -protected: - std::shared_ptr logger; -}; - -class ListsMetadata : public BaseListsMetadata { - friend class ListsUpdateIterator; - -public: - explicit ListsMetadata(const StorageStructureIDAndFName& storageStructureIDAndFNameForBaseList, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode); - - // Returns a function that can map the logical pageIdx of a chunk ito its corresponding physical - // pageIdx in a disk file. - inline std::function getPageMapperForChunkIdx(uint32_t chunkIdx) { - return getIdxInPageListToListPageIdxMapper( - pageLists.get(), (*chunkToPageListHeadIdxMap)[chunkIdx]); - } - - inline void checkpointInMemoryIfNecessary() { - chunkToPageListHeadIdxMap->checkpointInMemoryIfNecessary(); - pageLists->checkpointInMemoryIfNecessary(); - } - - inline void rollbackInMemoryIfNecessary() { - chunkToPageListHeadIdxMap->rollbackInMemoryIfNecessary(); - pageLists->rollbackInMemoryIfNecessary(); - } - -private: - std::unique_ptr metadataVersionedFileHandle; - StorageStructureIDAndFName storageStructureIDAndFName; - // chunkToPageListHeadIdxMapBuilder holds pointers to the head of pageList of each chunk. - // For instance, chunkToPageListHeadIdxMapBuilder[3] is a pointer in `pageLists` from where - // the pageList of chunk 3 begins. - std::unique_ptr> chunkToPageListHeadIdxMap; - // pageLists is a blob that contains the pageList of each chunk. Each pageList is broken - // into smaller list group of size PAGE_LIST_GROUP_SIZE and chained together. List group may - // not be contiguous and requires pointer chasing to read the required physical pageId from the - // list. pageLists is used both to store the list of pages for large lists as well as small - // lists of each chunk. - std::unique_ptr> pageLists; -}; - -/** - * Lists Metadata holds the information necessary to locate a list in the collection of disk pages - * that organizes and stores {@class Lists} data structure. Each object of Lists requires - * ListsMetadata object that helps in locating. - * - * The mapper functions (called, IdxInPageListToListPageIdxMaper) of this class maps the idxs in - * page lists to the actual physical location in disk pages. These are the - * ``logicalToPhysicalPageMapper'' mappers used in the BaseColumnOrList common functions for reading - * data from disk for columns and lists. - */ -class ListsMetadataBuilder : public BaseListsMetadata { - -public: - explicit ListsMetadataBuilder(const std::string& listBaseFName); - - // Returns a function that can map the logical pageIdx of a chunk ito its corresponding physical - // pageIdx in a disk file. - inline std::function getPageMapperForChunkIdx(uint32_t chunkIdx) { - return getIdxInPageListToListPageIdxMapper( - pageListsBuilder.get(), (*chunkToPageListHeadIdxMapBuilder)[chunkIdx]); - } - void initChunkPageLists(uint32_t numChunks); - - // To be called only after call to initChunkPageLists(...). Assumes pageList of chunks 0 to - // chunkId - 1 has already been populated. - void populateChunkPageList(uint32_t chunkId, uint32_t numPages, uint32_t startPageId); - - void saveToDisk(); - -private: - // Creates a new pageList (in pageListGroups of size 3) by enumerating the pageIds sequentially - // in the list, starting from `startPageId` till `startPageId + numPages - 1`. - void populatePageIdsInAPageList(uint32_t numPages, uint32_t startPageId); - -private: - std::unique_ptr metadataFileHandleForBuilding; - std::unique_ptr> chunkToPageListHeadIdxMapBuilder; - std::unique_ptr> pageListsBuilder; -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_structure/lists/lists_update_store.h b/src/include/storage/storage_structure/lists/lists_update_store.h deleted file mode 100644 index a119234dfa..0000000000 --- a/src/include/storage/storage_structure/lists/lists_update_store.h +++ /dev/null @@ -1,183 +0,0 @@ -#pragma once - -#include - -#include "catalog/rel_table_schema.h" -#include "common/data_chunk/data_chunk.h" -#include "common/enums/rel_direction.h" -#include "common/types/types.h" -#include "processor/result/factorized_table.h" -#include "storage/storage_structure/lists/list_handle.h" -#include "storage/storage_utils.h" - -namespace kuzu { -namespace storage { - -typedef uint64_t list_offset_t; - -struct UpdatedPersistentListOffsets { -public: - inline void insertOffset(list_offset_t listOffset, processor::ft_tuple_idx_t ftTupleIdx) { - listOffsetFTIdxMap[listOffset] = ftTupleIdx; - } - inline bool hasUpdates() const { return !listOffsetFTIdxMap.empty(); } - -public: - std::map listOffsetFTIdxMap; -}; - -struct ListsUpdatesForNodeOffset { -public: - explicit ListsUpdatesForNodeOffset(const catalog::RelTableSchema& relTableSchema); - - inline bool hasUpdates() const { - return isNewlyAddedNode || !insertedRelsTupleIdxInFT.empty() || - !deletedRelOffsets.empty() || hasAnyUpdatedPersistentListOffsets(); - } - - bool hasAnyUpdatedPersistentListOffsets() const; - -public: - bool isNewlyAddedNode; - std::vector insertedRelsTupleIdxInFT; - std::unordered_map - updatedPersistentListOffsets; - std::unordered_set deletedRelOffsets; -}; - -struct ListsUpdateInfo { -public: - ListsUpdateInfo(common::ValueVector* propertyVector, common::property_id_t propertyID, - common::offset_t relOffset, uint64_t fwdListOffset, uint64_t bwdListOffset) - : propertyVector{propertyVector}, propertyID{propertyID}, relOffset{relOffset}, - fwdListOffset{fwdListOffset}, bwdListOffset{bwdListOffset} {} - - bool isStoredInPersistentStore() const { return fwdListOffset != -1 || bwdListOffset != -1; } - -public: - common::ValueVector* propertyVector; - common::property_id_t propertyID; - common::offset_t relOffset; - list_offset_t fwdListOffset; - list_offset_t bwdListOffset; -}; - -// Shouldn't need to be shared, except that MSVC doesn't allow maps inside vectors to have -// non-copyable values. -using ListsUpdatesPerNode = std::map>; -using ListsUpdatesPerChunk = std::map; - -struct InMemList; - -class ListsUpdatesStore { - -public: - ListsUpdatesStore(MemoryManager& memoryManager, catalog::RelTableSchema& relTableSchema); - - inline void clear() { - ftOfInsertedRels->clear(); - for (auto& [_, propertyUpdates] : listsUpdates) { - propertyUpdates->clear(); - } - initListsUpdatesPerTablePerDirection(); - } - inline ListsUpdatesPerChunk& getListsUpdatesPerChunk( - common::RelDataDirection relDataDirection) { - return listsUpdatesPerDirection[relDataDirection]; - } - - void updateSchema(catalog::RelTableSchema& relTableSchema); - - bool isNewlyAddedNode(ListFileID& listFileID, common::offset_t nodeOffset) const; - - uint64_t getNumDeletedRels(ListFileID& listFileID, common::offset_t nodeOffset) const; - - bool isRelDeletedInPersistentStore( - ListFileID& listFileID, common::offset_t nodeOffset, common::offset_t relOffset) const; - - bool hasUpdates() const; - - void readInsertedRelsToList(ListFileID& listFileID, - std::vector tupleIdxes, InMemList& inMemList, - uint64_t numElementsInPersistentStore, DiskOverflowFile* diskOverflowFile, - const common::LogicalType& dataType); - - // If this is a one-to-one relTable, all properties are stored in columns. - // In this case, the listsUpdatesStore should not store the insert rels in FT. - void insertRelIfNecessary(const common::ValueVector* srcNodeIDVector, - const common::ValueVector* dstNodeIDVector, - const std::vector& relPropertyVectors); - - bool deleteRelIfNecessary(common::ValueVector* srcNodeIDVector, - common::ValueVector* dstNodeIDVector, common::ValueVector* relIDVector); - - uint64_t getNumInsertedRelsForNodeOffset( - ListFileID& listFileID, common::offset_t nodeOffset) const; - - void readValues( - ListFileID& listFileID, ListHandle& listSyncState, common::ValueVector* valueVector) const; - - bool hasAnyDeletedRelsInPersistentStore( - ListFileID& listFileID, common::offset_t nodeOffset) const; - - // This function is called ifNecessary because it only handles the updates to a propertyList. - // If the property is stored as a column in both direction(e.g. we are updating a ONE-ONE rel - // table), this function won't do any operations in this case. - void updateRelIfNecessary(common::ValueVector* srcNodeIDVector, - common::ValueVector* dstNodeIDVector, const ListsUpdateInfo& listsUpdateInfo); - - void readUpdatesToPropertyVectorIfExists(ListFileID& listFileID, common::offset_t nodeOffset, - common::ValueVector* propertyVector, list_offset_t startListOffset); - - void readPropertyUpdateToInMemList(ListFileID& listFileID, processor::ft_tuple_idx_t ftTupleIdx, - InMemList& inMemList, uint64_t posToWriteToInMemList, const common::LogicalType& dataType, - DiskOverflowFile* overflowFileOfInMemList); - - void initNewlyAddedNodes(common::nodeID_t& nodeID); - -private: - static inline RelNodeTableAndDir getRelNodeTableAndDirFromListFileID(ListFileID& listFileID) { - return listFileID.listType == ListType::ADJ_LISTS ? - listFileID.adjListsID.relNodeTableAndDir : - listFileID.relPropertyListID.relNodeTableAndDir; - } - inline int64_t getTupleIdxIfInsertedRel(int64_t relID) { - return ftOfInsertedRels->findValueInFlatColumn(INTERNAL_REL_ID_IDX_IN_FT, relID); - } - - void initInsertedRelsAndListsUpdates(); - - processor::ft_col_idx_t getColIdxInFT(ListFileID& listFileID) const; - - void initListsUpdatesPerTablePerDirection(); - - ListsUpdatesForNodeOffset* getOrCreateListsUpdatesForNodeOffset( - common::RelDataDirection relDirection, common::nodeID_t nodeID); - - ListsUpdatesForNodeOffset* getListsUpdatesForNodeOffsetIfExists( - ListFileID& listFileID, common::offset_t nodeOffset) const; - -private: - /* ListsUpdatesStore stores all inserted edges in a factorizedTable in the format: - * [srcNodeID, dstNodeID, relID, relProp1, relProp2, ..., relPropN]. In order to efficiently - * find the insertedEdges for a nodeTable, we introduce a mapping which stores the tupleIdxes of - * insertedEdges for each nodeTable per direction. - */ - static constexpr processor::ft_tuple_idx_t SRC_TABLE_ID_IDX_IN_FT = 0; - static constexpr processor::ft_tuple_idx_t DST_TABLE_ID_IDX_IN_FT = 1; - static constexpr processor::ft_tuple_idx_t INTERNAL_REL_ID_IDX_IN_FT = 2; - static constexpr processor::ft_tuple_idx_t LISTS_UPDATES_IDX_IN_FT = 0; - std::unique_ptr ftOfInsertedRels; - // We store all updates to the same property list inside a special factorizedTable which - // only has one column. ListsUpdates is a collection of these special factorizedTable indexed by - // propertyID. - std::unordered_map> - listsUpdates; - std::vector listsUpdatesPerDirection; - std::unordered_map propertyIDToColIdxMap; - std::unique_ptr relTableSchema; - MemoryManager& memoryManager; -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_structure/storage_structure.h b/src/include/storage/storage_structure/storage_structure.h deleted file mode 100644 index 1e752c5045..0000000000 --- a/src/include/storage/storage_structure/storage_structure.h +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#include - -#include "common/constants.h" -#include "common/vector/value_vector.h" -#include "storage/buffer_manager/buffer_manager.h" -#include "storage/storage_structure/storage_structure_utils.h" -#include "storage/storage_utils.h" -#include "storage/wal/wal.h" -#include "transaction/transaction.h" - -namespace kuzu { -namespace storage { - -typedef uint64_t chunk_idx_t; - -class ListsUpdateIterator; - -// TODO(Guodong): Clean up this class and also StorageStructureID once we finish node group-based -// rel tables. See here also https://github.com/kuzudb/kuzu/pull/1802#discussion_r1275569590. -class StorageStructure { - friend class ListsUpdateIterator; - -public: - StorageStructure() = default; - - StorageStructure(const StorageStructureIDAndFName& storageStructureIDAndFName, - BufferManager* bufferManager, WAL* wal, common::AccessMode accessMode) - : logger{common::LoggerUtils::getLogger(common::LoggerConstants::LoggerEnum::STORAGE)}, - storageStructureID{storageStructureIDAndFName.storageStructureID}, - bufferManager{bufferManager}, wal{wal} { - assert(!storageStructureIDAndFName.fName.empty()); - fileHandle = bufferManager->getBMFileHandle(storageStructureIDAndFName.fName, - accessMode == common::AccessMode::READ_ONLY ? FileHandle::O_PERSISTENT_FILE_READ_ONLY : - FileHandle::O_PERSISTENT_FILE_NO_CREATE, - BMFileHandle::FileVersionedType::VERSIONED_FILE); - } - - virtual ~StorageStructure() = default; - - inline BMFileHandle* getFileHandle() { return fileHandle.get(); } - - // check if val is in range [start, end) - static inline bool isInRange(uint64_t val, uint64_t start, uint64_t end) { - return val >= start && val < end; - } - -protected: - // If necessary creates a second version (backed by the WAL) of a page that contains the value - // that will be written to. The position of the value, which determines the original page to - // update, is computed from the given elementOffset and numElementsPerPage argument. Obtains - // *and does not release* the lock original page. Pins and updates the WAL version of the - // page. Note that caller must ensure to unpin and release the WAL version of the page by - // calling StorageStructure::unpinWALPageAndReleaseOriginalPageLock. - WALPageIdxPosInPageAndFrame createWALVersionOfPageIfNecessaryForElement( - uint64_t elementOffset, uint64_t numElementsPerPage); - -protected: - std::shared_ptr logger; - StorageStructureID storageStructureID; - std::unique_ptr fileHandle; - BufferManager* bufferManager; - WAL* wal; -}; - -// BaseColumnOrList is the parent class of Column and Lists. It abstracts the state and -// functions that are common in both column and lists, like, 1) layout info (size of a unit of -// element and number of elements that can be accommodated in a page), 2) getting pageIdx and -// pageOffset of an element and, 3) reading from pages. -class BaseColumnOrList : public StorageStructure { - -public: - explicit BaseColumnOrList(common::LogicalType dataType) : dataType{std::move(dataType)} {} - - // Maps the position of element in page to its byte offset in page. - // TODO(Everyone): we should slowly get rid of this function. - inline uint16_t mapElementPosToByteOffset(uint16_t pageElementPos) const { - return pageElementPos * elementSize; - } - - inline const uint8_t* getNullBufferInPage(const uint8_t* pageFrame) const { - return pageFrame + numElementsPerPage * elementSize; - } - -protected: - inline uint64_t getElemByteOffset(uint64_t elemPosInPage) const { - return elemPosInPage * elementSize; - } - - BaseColumnOrList(const StorageStructureIDAndFName& storageStructureIDAndFName, - common::LogicalType dataType, const size_t& elementSize, BufferManager* bufferManager, - bool hasInlineNullBytes, WAL* wal, common::AccessMode accessMode); - - void readBySequentialCopy(transaction::Transaction* transaction, common::ValueVector* vector, - PageElementCursor& cursor, - const std::function& logicalToPhysicalPageMapper); - - void readInternalIDsBySequentialCopy(transaction::Transaction* transaction, - common::ValueVector* vector, PageElementCursor& cursor, - const std::function& logicalToPhysicalPageMapper, - common::table_id_t commonTableID, bool hasNoNullGuarantee); - - void readInternalIDsFromAPageBySequentialCopy(transaction::Transaction* transaction, - common::ValueVector* vector, uint64_t vectorStartPos, common::page_idx_t physicalPageIdx, - uint16_t pagePosOfFirstElement, uint64_t numValuesToRead, common::table_id_t commonTableID, - bool hasNoNullGuarantee); - - void readNullBitsFromAPage(common::ValueVector* valueVector, const uint8_t* frame, - uint64_t posInPage, uint64_t posInVector, uint64_t numBitsToRead) const; - -private: - void readAPageBySequentialCopy(transaction::Transaction* transaction, - common::ValueVector* vector, uint64_t vectorStartPos, common::page_idx_t physicalPageIdx, - uint16_t pagePosOfFirstElement, uint64_t numValuesToRead); - -public: - common::LogicalType dataType; - size_t elementSize; - uint32_t numElementsPerPage; -}; - -} // namespace storage -} // namespace kuzu diff --git a/src/include/storage/storage_utils.h b/src/include/storage/storage_utils.h index 19eb77c8ba..6d40589c99 100644 --- a/src/include/storage/storage_utils.h +++ b/src/include/storage/storage_utils.h @@ -1,13 +1,11 @@ #pragma once +#include #include -#include "catalog/table_schema.h" -#include "common/column_data_format.h" #include "common/constants.h" #include "common/file_utils.h" #include "common/null_mask.h" -#include "common/utils.h" #include "storage/wal/wal_record.h" namespace kuzu { diff --git a/src/include/storage/store/column_chunk.h b/src/include/storage/store/column_chunk.h index ecb3d8291f..0b17db9558 100644 --- a/src/include/storage/store/column_chunk.h +++ b/src/include/storage/store/column_chunk.h @@ -1,14 +1,11 @@ #pragma once -#include "common/column_data_format.h" -#include "common/copier_config/copier_config.h" -#include "common/type_utils.h" +#include + #include "common/types/types.h" #include "common/vector/value_vector.h" #include "compression.h" #include "storage/buffer_manager/bm_file_handle.h" -#include "storage/wal/wal.h" -#include "transaction/transaction.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/store/compression.h b/src/include/storage/store/compression.h index 30f64f1f51..7f332ee9ed 100644 --- a/src/include/storage/store/compression.h +++ b/src/include/storage/store/compression.h @@ -2,7 +2,7 @@ #include #include -#include +#include #include "common/types/types.h" diff --git a/src/include/storage/store/node_group.h b/src/include/storage/store/node_group.h index 4ab35b4d2c..7e05acd6db 100644 --- a/src/include/storage/store/node_group.h +++ b/src/include/storage/store/node_group.h @@ -1,9 +1,8 @@ #pragma once -#include "catalog/catalog.h" -#include "processor/result/result_set.h" +#include "common/column_data_format.h" +#include "common/data_chunk/data_chunk.h" #include "storage/store/column_chunk.h" -#include "transaction/transaction.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/store/node_table.h b/src/include/storage/store/node_table.h index 9d11aaee28..5be845d2da 100644 --- a/src/include/storage/store/node_table.h +++ b/src/include/storage/store/node_table.h @@ -4,7 +4,7 @@ #include "storage/index/hash_index.h" #include "storage/stats/nodes_store_statistics.h" #include "storage/store/node_group.h" -#include "storage/store/node_table_data.h" +#include "storage/store/table_data.h" #include "storage/wal/wal.h" namespace kuzu { diff --git a/src/include/storage/store/nodes_store.h b/src/include/storage/store/nodes_store.h index d5e9b651ec..1e073d3724 100644 --- a/src/include/storage/store/nodes_store.h +++ b/src/include/storage/store/nodes_store.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include "storage/stats/nodes_store_statistics.h" #include "storage/store/node_table.h" diff --git a/src/include/storage/store/rel_table.h b/src/include/storage/store/rel_table.h index bcec90d0b0..8d99f6e268 100644 --- a/src/include/storage/store/rel_table.h +++ b/src/include/storage/store/rel_table.h @@ -3,7 +3,6 @@ #include "catalog/rel_table_schema.h" #include "common/column_data_format.h" #include "storage/stats/rel_table_statistics.h" -#include "storage/storage_utils.h" #include "storage/store/rel_table_data.h" namespace kuzu { diff --git a/src/include/storage/store/rels_store.h b/src/include/storage/store/rels_store.h index d03510e638..f361c8bba5 100644 --- a/src/include/storage/store/rels_store.h +++ b/src/include/storage/store/rels_store.h @@ -1,7 +1,6 @@ #pragma once #include "catalog/catalog.h" -#include "common/file_utils.h" #include "storage/stats/rels_store_statistics.h" #include "storage/store/rel_table.h" diff --git a/src/include/storage/store/sign_extend.h b/src/include/storage/store/sign_extend.h index 89044f51f5..7800aba633 100644 --- a/src/include/storage/store/sign_extend.h +++ b/src/include/storage/store/sign_extend.h @@ -18,7 +18,6 @@ #include #include -#include #include namespace kuzu { diff --git a/src/include/storage/store/string_column.h b/src/include/storage/store/string_column.h index cee342fca0..cf676893b4 100644 --- a/src/include/storage/store/string_column.h +++ b/src/include/storage/store/string_column.h @@ -1,6 +1,5 @@ #pragma once -#include "storage/stats/table_statistics.h" #include "storage/store/column.h" namespace kuzu { diff --git a/src/include/storage/store/string_column_chunk.h b/src/include/storage/store/string_column_chunk.h index f971b68da7..e64f93bda4 100644 --- a/src/include/storage/store/string_column_chunk.h +++ b/src/include/storage/store/string_column_chunk.h @@ -1,6 +1,6 @@ #pragma once -#include "common/types/blob.h" +#include "common/exception/not_implemented.h" #include "storage/storage_structure/in_mem_file.h" #include "storage/store/column_chunk.h" diff --git a/src/include/storage/store/struct_column.h b/src/include/storage/store/struct_column.h index 846c6d1882..2e1704cf60 100644 --- a/src/include/storage/store/struct_column.h +++ b/src/include/storage/store/struct_column.h @@ -1,6 +1,5 @@ #pragma once -#include "storage/stats/table_statistics.h" #include "storage/store/column.h" namespace kuzu { diff --git a/src/include/storage/store/var_list_column.h b/src/include/storage/store/var_list_column.h index 092add9dc4..5b8119df4f 100644 --- a/src/include/storage/store/var_list_column.h +++ b/src/include/storage/store/var_list_column.h @@ -1,7 +1,6 @@ #pragma once #include "column.h" -#include "storage/stats/table_statistics.h" // List is a nested data type which is stored as two columns: // 1. Offset column (type: INT64). Using offset to partition the data column into multiple lists. diff --git a/src/include/storage/store/var_list_column_chunk.h b/src/include/storage/store/var_list_column_chunk.h index 960bba9361..9aeb1e7715 100644 --- a/src/include/storage/store/var_list_column_chunk.h +++ b/src/include/storage/store/var_list_column_chunk.h @@ -1,5 +1,6 @@ #pragma once +#include "common/exception/not_implemented.h" #include "storage/store/column_chunk.h" namespace kuzu { @@ -37,7 +38,9 @@ class VarListColumnChunk : public ColumnChunk { void append(common::ValueVector* vector, common::offset_t startPosInChunk) final; inline void write(common::ValueVector* /*valueVector*/, common::ValueVector* /*offsetInChunkVector*/) override { + // LCOV_EXCL_START throw common::NotImplementedException("VarListColumnChunk::write"); + // LCOV_EXCL_END } inline VarListDataColumnChunk* getVarListDataColumnChunk() { diff --git a/src/include/storage/wal/wal_record.h b/src/include/storage/wal/wal_record.h index b0c9a0fcd5..22886d7976 100644 --- a/src/include/storage/wal/wal_record.h +++ b/src/include/storage/wal/wal_record.h @@ -1,11 +1,7 @@ #pragma once -#include "common/enums/rel_direction.h" -#include "common/exception/not_implemented.h" -#include "common/exception/runtime.h" #include "common/types/internal_id_t.h" #include "common/types/types.h" -#include "common/utils.h" namespace kuzu { namespace storage { diff --git a/src/include/storage/wal_replayer_utils.h b/src/include/storage/wal_replayer_utils.h index f52f06ce1a..bf92cb94ff 100644 --- a/src/include/storage/wal_replayer_utils.h +++ b/src/include/storage/wal_replayer_utils.h @@ -1,11 +1,8 @@ #pragma once -#include +#include #include -#include "catalog/catalog.h" -#include "storage/store/column.h" - namespace kuzu { namespace catalog { class NodeTableSchema; diff --git a/src/include/transaction/transaction.h b/src/include/transaction/transaction.h index c2e97b50ba..80bb1c96d8 100644 --- a/src/include/transaction/transaction.h +++ b/src/include/transaction/transaction.h @@ -3,7 +3,6 @@ #include #include "storage/local_storage.h" -#include "transaction_action.h" namespace kuzu { namespace transaction { diff --git a/src/include/transaction/transaction_context.h b/src/include/transaction/transaction_context.h index a5a19a1e9e..2360bf5d2f 100644 --- a/src/include/transaction/transaction_context.h +++ b/src/include/transaction/transaction_context.h @@ -1,7 +1,6 @@ #pragma once #include "transaction.h" -#include "transaction_manager.h" namespace kuzu { namespace main { diff --git a/src/include/transaction/transaction_manager.h b/src/include/transaction/transaction_manager.h index 814b10550e..846362ee46 100644 --- a/src/include/transaction/transaction_manager.h +++ b/src/include/transaction/transaction_manager.h @@ -4,7 +4,6 @@ #include #include -#include "common/utils.h" #include "storage/wal/wal.h" #include "transaction.h" diff --git a/src/main/connection.cpp b/src/main/connection.cpp index 262a97e57e..f63796857c 100644 --- a/src/main/connection.cpp +++ b/src/main/connection.cpp @@ -2,11 +2,8 @@ #include "binder/binder.h" #include "binder/visitor/statement_read_write_analyzer.h" -#include "catalog/node_table_schema.h" #include "common/exception/connection.h" -#include "common/exception/runtime.h" #include "main/database.h" -#include "main/plan_printer.h" #include "optimizer/optimizer.h" #include "parser/parser.h" #include "planner/operator/logical_plan_util.h" diff --git a/src/main/database.cpp b/src/main/database.cpp index 69de3eb9a1..5be6202e1b 100644 --- a/src/main/database.cpp +++ b/src/main/database.cpp @@ -9,10 +9,12 @@ #include "common/exception/exception.h" #include "common/file_utils.h" #include "common/logging_level_utils.h" +#include "common/utils.h" #include "processor/processor.h" #include "spdlog/spdlog.h" #include "storage/storage_manager.h" #include "storage/wal_replayer.h" +#include "transaction/transaction_action.h" #include "transaction/transaction_manager.h" using namespace kuzu::catalog; diff --git a/src/main/prepared_statement.cpp b/src/main/prepared_statement.cpp index 8b6ba760bb..bc70e4fb98 100644 --- a/src/main/prepared_statement.cpp +++ b/src/main/prepared_statement.cpp @@ -1,6 +1,6 @@ #include "main/prepared_statement.h" -#include "binder/bound_statement_result.h" +#include "binder/bound_statement_result.h" // IWYU pragma: keep (used to avoid error in destructor) #include "common/enums/statement_type.h" #include "planner/operator/logical_plan.h" diff --git a/src/main/query_result.cpp b/src/main/query_result.cpp index 8a3f08ab4e..e8835770a6 100644 --- a/src/main/query_result.cpp +++ b/src/main/query_result.cpp @@ -2,12 +2,10 @@ #include -#include "binder/expression/node_rel_expression.h" -#include "binder/expression/property_expression.h" +#include "binder/expression/expression.h" #include "common/arrow/arrow_converter.h" #include "common/types/value/node.h" #include "common/types/value/rel.h" -#include "json.hpp" #include "processor/result/factorized_table.h" #include "processor/result/flat_tuple.h" diff --git a/src/main/storage_driver.cpp b/src/main/storage_driver.cpp index 24a8d309b2..d09904131a 100644 --- a/src/main/storage_driver.cpp +++ b/src/main/storage_driver.cpp @@ -1,5 +1,7 @@ #include "main/storage_driver.h" +#include + #include "storage/storage_manager.h" using namespace kuzu::common; diff --git a/src/optimizer/filter_push_down_optimizer.cpp b/src/optimizer/filter_push_down_optimizer.cpp index bcdf07e91d..4c7e3e138d 100644 --- a/src/optimizer/filter_push_down_optimizer.cpp +++ b/src/optimizer/filter_push_down_optimizer.cpp @@ -1,13 +1,11 @@ #include "optimizer/filter_push_down_optimizer.h" -#include "binder/expression/literal_expression.h" #include "binder/expression/property_expression.h" #include "binder/expression_visitor.h" #include "planner/operator/logical_filter.h" #include "planner/operator/logical_hash_join.h" #include "planner/operator/scan/logical_dummy_scan.h" #include "planner/operator/scan/logical_index_scan.h" -#include "planner/operator/scan/logical_scan_internal_id.h" #include "planner/operator/scan/logical_scan_node_property.h" using namespace kuzu::binder; diff --git a/src/parser/transformer.cpp b/src/parser/transformer.cpp index 7877df07e0..15173c0bf4 100644 --- a/src/parser/transformer.cpp +++ b/src/parser/transformer.cpp @@ -3,7 +3,7 @@ #include "common/exception/not_implemented.h" #include "common/string_utils.h" #include "parser/explain_statement.h" -#include "parser/query/regular_query.h" +#include "parser/query/regular_query.h" // IWYU pragma: keep (fixes a forward declaration error) using namespace kuzu::common; diff --git a/src/planner/join_order/cardinality_estimator.cpp b/src/planner/join_order/cardinality_estimator.cpp index 8ef007dd34..187664f7de 100644 --- a/src/planner/join_order/cardinality_estimator.cpp +++ b/src/planner/join_order/cardinality_estimator.cpp @@ -1,7 +1,8 @@ #include "planner/join_order/cardinality_estimator.h" +#include "binder/expression/property_expression.h" +#include "common/exception/not_implemented.h" #include "planner/join_order/join_order_util.h" -#include "planner/operator/extend/logical_extend.h" #include "planner/operator/scan/logical_scan_internal_id.h" using namespace kuzu::binder; diff --git a/src/planner/join_order_enumerator_context.cpp b/src/planner/join_order_enumerator_context.cpp index 509afeaa5d..1c48af32ee 100644 --- a/src/planner/join_order_enumerator_context.cpp +++ b/src/planner/join_order_enumerator_context.cpp @@ -1,5 +1,7 @@ #include "planner/join_order_enumerator_context.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/operator/extend/logical_extend.cpp b/src/planner/operator/extend/logical_extend.cpp index 12761cedb1..4d3be4a35f 100644 --- a/src/planner/operator/extend/logical_extend.cpp +++ b/src/planner/operator/extend/logical_extend.cpp @@ -1,7 +1,5 @@ #include "planner/operator/extend/logical_extend.h" -#include "planner/operator/factorization/flatten_resolver.h" - namespace kuzu { namespace planner { diff --git a/src/planner/operator/extend/logical_recursive_extend.cpp b/src/planner/operator/extend/logical_recursive_extend.cpp index 1dee3be289..de2e455fee 100644 --- a/src/planner/operator/extend/logical_recursive_extend.cpp +++ b/src/planner/operator/extend/logical_recursive_extend.cpp @@ -2,7 +2,6 @@ #include "optimizer/factorization_rewriter.h" #include "optimizer/remove_factorization_rewriter.h" -#include "planner/operator/factorization/sink_util.h" namespace kuzu { namespace planner { diff --git a/src/planner/operator/logical_dummy_scan.cpp b/src/planner/operator/logical_dummy_scan.cpp index 5e7dddb4e0..9f09d9d7ed 100644 --- a/src/planner/operator/logical_dummy_scan.cpp +++ b/src/planner/operator/logical_dummy_scan.cpp @@ -1,5 +1,6 @@ #include "planner/operator/scan/logical_dummy_scan.h" +#include "binder/expression/literal_expression.h" #include "common/constants.h" using namespace kuzu::common; diff --git a/src/planner/operator/logical_order_by.cpp b/src/planner/operator/logical_order_by.cpp index 0db0b547f9..ee12b04f7c 100644 --- a/src/planner/operator/logical_order_by.cpp +++ b/src/planner/operator/logical_order_by.cpp @@ -1,5 +1,6 @@ #include "planner/operator/logical_order_by.h" +#include "binder/expression/expression_util.h" #include "planner/operator/factorization/flatten_resolver.h" #include "planner/operator/factorization/sink_util.h" diff --git a/src/planner/operator/logical_partitioner.cpp b/src/planner/operator/logical_partitioner.cpp index e5e451db29..605e04603c 100644 --- a/src/planner/operator/logical_partitioner.cpp +++ b/src/planner/operator/logical_partitioner.cpp @@ -1,5 +1,7 @@ #include "planner/operator/logical_partitioner.h" +#include "binder/expression/expression_util.h" + namespace kuzu { namespace planner { diff --git a/src/planner/operator/scan/logical_index_scan.cpp b/src/planner/operator/scan/logical_index_scan.cpp index 9d1ff208a5..ae7a5500c5 100644 --- a/src/planner/operator/scan/logical_index_scan.cpp +++ b/src/planner/operator/scan/logical_index_scan.cpp @@ -1,5 +1,7 @@ #include "planner/operator/scan/logical_index_scan.h" +#include "binder/expression/expression_util.h" + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_accumulate.cpp b/src/planner/plan/append_accumulate.cpp index cb2f01666e..de71f4119b 100644 --- a/src/planner/plan/append_accumulate.cpp +++ b/src/planner/plan/append_accumulate.cpp @@ -1,6 +1,7 @@ #include "planner/operator/logical_accumulate.h" #include "planner/query_planner.h" +using namespace kuzu::binder; using namespace kuzu::common; namespace kuzu { diff --git a/src/planner/plan/append_aggregate.cpp b/src/planner/plan/append_aggregate.cpp index 29c69f016f..e20e951173 100644 --- a/src/planner/plan/append_aggregate.cpp +++ b/src/planner/plan/append_aggregate.cpp @@ -1,6 +1,8 @@ #include "planner/operator/logical_aggregate.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_create.cpp b/src/planner/plan/append_create.cpp index d615092083..71254a7a82 100644 --- a/src/planner/plan/append_create.cpp +++ b/src/planner/plan/append_create.cpp @@ -1,5 +1,4 @@ -#include "binder/query/updating_clause/bound_insert_clause.h" -#include "binder/query/updating_clause/bound_set_clause.h" +#include "binder/query/updating_clause/bound_insert_info.h" #include "planner/operator/persistent/logical_insert.h" #include "planner/query_planner.h" diff --git a/src/planner/plan/append_delete.cpp b/src/planner/plan/append_delete.cpp index f8d6724e88..cbd3b5d6c7 100644 --- a/src/planner/plan/append_delete.cpp +++ b/src/planner/plan/append_delete.cpp @@ -1,12 +1,14 @@ -#include "binder/query/updating_clause/bound_delete_clause.h" +#include "binder/query/updating_clause/bound_delete_info.h" #include "planner/operator/persistent/logical_delete.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { void QueryPlanner::appendDeleteNode( - const std::vector& boundInfos, LogicalPlan& plan) { + const std::vector& boundInfos, LogicalPlan& plan) { std::vector> nodes; for (auto& boundInfo : boundInfos) { nodes.push_back(std::static_pointer_cast(boundInfo->nodeOrRel)); @@ -17,7 +19,7 @@ void QueryPlanner::appendDeleteNode( } void QueryPlanner::appendDeleteRel( - const std::vector& boundInfos, LogicalPlan& plan) { + const std::vector& boundInfos, LogicalPlan& plan) { std::vector> rels; for (auto& info : boundInfos) { auto rel = std::static_pointer_cast(info->nodeOrRel); diff --git a/src/planner/plan/append_distinct.cpp b/src/planner/plan/append_distinct.cpp index 3f513071b6..cd3052e13f 100644 --- a/src/planner/plan/append_distinct.cpp +++ b/src/planner/plan/append_distinct.cpp @@ -1,6 +1,8 @@ #include "planner/operator/logical_distinct.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { @@ -14,4 +16,4 @@ void QueryPlanner::appendDistinct( } } // namespace planner -} // namespace kuzu \ No newline at end of file +} // namespace kuzu diff --git a/src/planner/plan/append_extend.cpp b/src/planner/plan/append_extend.cpp index 61e90e3bcb..fe54a9461a 100644 --- a/src/planner/plan/append_extend.cpp +++ b/src/planner/plan/append_extend.cpp @@ -1,13 +1,15 @@ +#include "binder/expression/property_expression.h" #include "binder/expression_visitor.h" #include "catalog/rel_table_schema.h" +#include "common/exception/not_implemented.h" #include "planner/join_order/cost_model.h" #include "planner/operator/extend/logical_extend.h" #include "planner/operator/extend/logical_recursive_extend.h" -#include "planner/operator/logical_fill_table_id.h" #include "planner/operator/logical_node_label_filter.h" #include "planner/query_planner.h" using namespace kuzu::common; +using namespace kuzu::binder; using namespace kuzu::catalog; namespace kuzu { diff --git a/src/planner/plan/append_filter.cpp b/src/planner/plan/append_filter.cpp index 6300f07bb3..d2e94574ba 100644 --- a/src/planner/plan/append_filter.cpp +++ b/src/planner/plan/append_filter.cpp @@ -1,6 +1,8 @@ #include "planner/operator/logical_filter.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_in_query_call.cpp b/src/planner/plan/append_in_query_call.cpp index 2a0f191fc6..5de9fe1dce 100644 --- a/src/planner/plan/append_in_query_call.cpp +++ b/src/planner/plan/append_in_query_call.cpp @@ -2,6 +2,8 @@ #include "planner/operator/logical_in_query_call.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_join.cpp b/src/planner/plan/append_join.cpp index 0dccf1de27..ca1860fb36 100644 --- a/src/planner/plan/append_join.cpp +++ b/src/planner/plan/append_join.cpp @@ -8,7 +8,7 @@ using namespace kuzu::common; namespace kuzu { namespace planner { -void QueryPlanner::appendHashJoin(const expression_vector& joinNodeIDs, JoinType joinType, +void QueryPlanner::appendHashJoin(const binder::expression_vector& joinNodeIDs, JoinType joinType, LogicalPlan& probePlan, LogicalPlan& buildPlan) { std::vector joinConditions; for (auto& joinNodeID : joinNodeIDs) { @@ -39,8 +39,9 @@ void QueryPlanner::appendHashJoin(const expression_vector& joinNodeIDs, JoinType probePlan.setLastOperator(std::move(hashJoin)); } -void QueryPlanner::appendMarkJoin(const expression_vector& joinNodeIDs, - const std::shared_ptr& mark, LogicalPlan& probePlan, LogicalPlan& buildPlan) { +void QueryPlanner::appendMarkJoin(const binder::expression_vector& joinNodeIDs, + const std::shared_ptr& mark, LogicalPlan& probePlan, + LogicalPlan& buildPlan) { std::vector joinConditions; for (auto& joinNodeID : joinNodeIDs) { joinConditions.emplace_back(joinNodeID, joinNodeID); @@ -59,7 +60,7 @@ void QueryPlanner::appendMarkJoin(const expression_vector& joinNodeIDs, probePlan.setLastOperator(std::move(hashJoin)); } -void QueryPlanner::appendIntersect(const std::shared_ptr& intersectNodeID, +void QueryPlanner::appendIntersect(const std::shared_ptr& intersectNodeID, binder::expression_vector& boundNodeIDs, LogicalPlan& probePlan, std::vector>& buildPlans) { assert(boundNodeIDs.size() == buildPlans.size()); diff --git a/src/planner/plan/append_order_by.cpp b/src/planner/plan/append_order_by.cpp index 72fd151517..db5dade7bc 100644 --- a/src/planner/plan/append_order_by.cpp +++ b/src/planner/plan/append_order_by.cpp @@ -1,6 +1,8 @@ #include "planner/operator/logical_order_by.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_projection.cpp b/src/planner/plan/append_projection.cpp index fee29ce193..7181cb9d48 100644 --- a/src/planner/plan/append_projection.cpp +++ b/src/planner/plan/append_projection.cpp @@ -2,6 +2,8 @@ #include "planner/operator/logical_projection.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/append_scan_node.cpp b/src/planner/plan/append_scan_node.cpp index cfef94de71..4747b4bddc 100644 --- a/src/planner/plan/append_scan_node.cpp +++ b/src/planner/plan/append_scan_node.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/property_expression.h" #include "planner/operator/logical_fill_table_id.h" #include "planner/operator/scan/logical_scan_internal_id.h" #include "planner/operator/scan/logical_scan_node_property.h" diff --git a/src/planner/plan/append_set.cpp b/src/planner/plan/append_set.cpp index 0321a97b63..56347f0bc6 100644 --- a/src/planner/plan/append_set.cpp +++ b/src/planner/plan/append_set.cpp @@ -1,4 +1,4 @@ -#include "binder/query/updating_clause/bound_set_clause.h" +#include "binder/query/updating_clause/bound_set_info.h" #include "planner/operator/factorization/flatten_resolver.h" #include "planner/operator/persistent/logical_set.h" #include "planner/query_planner.h" diff --git a/src/planner/plan/append_unwind.cpp b/src/planner/plan/append_unwind.cpp index 4dac27bf14..8f49fe4548 100644 --- a/src/planner/plan/append_unwind.cpp +++ b/src/planner/plan/append_unwind.cpp @@ -2,6 +2,8 @@ #include "planner/operator/logical_unwind.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/plan_copy.cpp b/src/planner/plan/plan_copy.cpp index a2588bf545..a8e6158dcc 100644 --- a/src/planner/plan/plan_copy.cpp +++ b/src/planner/plan/plan_copy.cpp @@ -1,12 +1,14 @@ #include "binder/copy/bound_copy_from.h" #include "binder/copy/bound_copy_to.h" -#include "binder/expression/variable_expression.h" #include "catalog/node_table_schema.h" +#include "catalog/rel_table_schema.h" +#include "common/exception/not_implemented.h" #include "planner/operator/logical_partitioner.h" #include "planner/operator/persistent/logical_copy_from.h" #include "planner/operator/persistent/logical_copy_to.h" #include "planner/operator/scan/logical_index_scan.h" #include "planner/planner.h" +#include "planner/query_planner.h" using namespace kuzu::binder; using namespace kuzu::storage; diff --git a/src/planner/plan/plan_ddl.cpp b/src/planner/plan/plan_ddl.cpp index 3f64fb537f..69c8bad592 100644 --- a/src/planner/plan/plan_ddl.cpp +++ b/src/planner/plan/plan_ddl.cpp @@ -6,6 +6,8 @@ #include "planner/operator/ddl/logical_drop_table.h" #include "planner/planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/plan_join_order.cpp b/src/planner/plan/plan_join_order.cpp index 0a03f292fc..5cad0e2932 100644 --- a/src/planner/plan/plan_join_order.cpp +++ b/src/planner/plan/plan_join_order.cpp @@ -1,8 +1,10 @@ #include "binder/expression_visitor.h" +#include "common/exception/not_implemented.h" #include "planner/join_order/cost_model.h" #include "planner/operator/scan/logical_scan_internal_id.h" #include "planner/query_planner.h" +using namespace kuzu::binder; using namespace kuzu::common; namespace kuzu { diff --git a/src/planner/plan/plan_projection.cpp b/src/planner/plan/plan_projection.cpp index 819711e808..2c5907aa71 100644 --- a/src/planner/plan/plan_projection.cpp +++ b/src/planner/plan/plan_projection.cpp @@ -1,6 +1,8 @@ #include "binder/expression_visitor.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/plan_read.cpp b/src/planner/plan/plan_read.cpp index c3f604a965..c4cd742440 100644 --- a/src/planner/plan/plan_read.cpp +++ b/src/planner/plan/plan_read.cpp @@ -1,8 +1,10 @@ #include "binder/expression_visitor.h" #include "binder/query/reading_clause/bound_load_from.h" #include "binder/query/reading_clause/bound_match_clause.h" +#include "common/exception/not_implemented.h" #include "planner/query_planner.h" +using namespace kuzu::binder; using namespace kuzu::common; namespace kuzu { diff --git a/src/planner/plan/plan_single_query.cpp b/src/planner/plan/plan_single_query.cpp index 68287f3673..226dbec9f7 100644 --- a/src/planner/plan/plan_single_query.cpp +++ b/src/planner/plan/plan_single_query.cpp @@ -1,6 +1,8 @@ #include "binder/visitor/property_collector.h" #include "planner/query_planner.h" +using namespace kuzu::binder; + namespace kuzu { namespace planner { diff --git a/src/planner/plan/plan_subquery.cpp b/src/planner/plan/plan_subquery.cpp index ce76945430..96c42c184c 100644 --- a/src/planner/plan/plan_subquery.cpp +++ b/src/planner/plan/plan_subquery.cpp @@ -1,7 +1,10 @@ #include "binder/expression/existential_subquery_expression.h" +#include "binder/expression/expression_util.h" #include "binder/expression_visitor.h" +#include "common/exception/not_implemented.h" #include "planner/query_planner.h" +using namespace kuzu::binder; using namespace kuzu::common; namespace kuzu { @@ -99,8 +102,10 @@ void QueryPlanner::planExistsSubquery( auto predicates = subquery->getPredicatesSplitOnAnd(); auto correlatedExpressions = outerPlan.getSchema()->getSubExpressionsInScope(subquery); if (correlatedExpressions.empty()) { - throw common::NotImplementedException( + // LCOV_EXCL_START + throw NotImplementedException( "Exists subquery with no correlated join conditions is not yet supported."); + // LCOV_EXCL_END } // See planOptionalMatch for un-nesting logic. bool isInternalIDCorrelated = ExpressionUtil::isExpressionsWithDataType( diff --git a/src/planner/plan/plan_update.cpp b/src/planner/plan/plan_update.cpp index 2b3d7fac61..2280ebe89f 100644 --- a/src/planner/plan/plan_update.cpp +++ b/src/planner/plan/plan_update.cpp @@ -2,10 +2,12 @@ #include "binder/query/updating_clause/bound_insert_clause.h" #include "binder/query/updating_clause/bound_merge_clause.h" #include "binder/query/updating_clause/bound_set_clause.h" +#include "common/exception/not_implemented.h" #include "planner/operator/persistent/logical_merge.h" #include "planner/query_planner.h" using namespace kuzu::common; +using namespace kuzu::binder; namespace kuzu { namespace planner { @@ -36,7 +38,9 @@ void QueryPlanner::planUpdatingClause(BoundUpdatingClause& updatingClause, Logic return; } default: + // LCOV_EXCL_START throw NotImplementedException("QueryPlanner::planUpdatingClause"); + // LCOV_EXCL_END } } @@ -77,7 +81,9 @@ void QueryPlanner::planMergeClause(binder::BoundUpdatingClause& updatingClause, mark = rel->getInternalIDProperty(); } break; default: - throw common::NotImplementedException("QueryPlanner::planMergeClause"); + // LCOV_EXCL_START + throw NotImplementedException("QueryPlanner::planMergeClause"); + // LCOV_EXCL_END } std::vector> logicalInsertNodeInfos; if (mergeClause.hasInsertNodeInfo()) { diff --git a/src/planner/planner.cpp b/src/planner/planner.cpp index f33591ce9f..dc3efc26a8 100644 --- a/src/planner/planner.cpp +++ b/src/planner/planner.cpp @@ -4,12 +4,14 @@ #include "binder/bound_create_macro.h" #include "binder/bound_explain.h" #include "binder/bound_standalone_call.h" -#include "binder/expression/variable_expression.h" +#include "common/exception/not_implemented.h" #include "planner/operator/logical_comment_on.h" #include "planner/operator/logical_create_macro.h" #include "planner/operator/logical_explain.h" #include "planner/operator/logical_standalone_call.h" +#include "planner/query_planner.h" +using namespace kuzu::binder; using namespace kuzu::catalog; using namespace kuzu::common; using namespace kuzu::storage; diff --git a/src/planner/query_planner.cpp b/src/planner/query_planner.cpp index 28f07108a1..77f4b5f1a9 100644 --- a/src/planner/query_planner.cpp +++ b/src/planner/query_planner.cpp @@ -1,8 +1,11 @@ #include "planner/query_planner.h" +#include "binder/expression/property_expression.h" #include "binder/query/bound_regular_query.h" +#include "common/exception/not_implemented.h" #include "planner/operator/logical_union.h" +using namespace kuzu::binder; using namespace kuzu::common; namespace kuzu { diff --git a/src/planner/subplans_table.cpp b/src/planner/subplans_table.cpp index e2fd9eb8f5..f97a0a2a81 100644 --- a/src/planner/subplans_table.cpp +++ b/src/planner/subplans_table.cpp @@ -1,6 +1,6 @@ #include "planner/subplans_table.h" -#include "common/assert.h" +using namespace kuzu::binder; namespace kuzu { namespace planner { diff --git a/src/processor/map/create_factorized_table_scan.cpp b/src/processor/map/create_factorized_table_scan.cpp index 4573985884..018f237151 100644 --- a/src/processor/map/create_factorized_table_scan.cpp +++ b/src/processor/map/create_factorized_table_scan.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/expression_util.h" #include "processor/operator/table_scan/factorized_table_scan.h" #include "processor/plan_mapper.h" diff --git a/src/processor/map/create_result_collector.cpp b/src/processor/map/create_result_collector.cpp index b0a4ffd4be..8dd58eb0f9 100644 --- a/src/processor/map/create_result_collector.cpp +++ b/src/processor/map/create_result_collector.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/expression_util.h" #include "processor/operator/result_collector.h" #include "processor/plan_mapper.h" diff --git a/src/processor/map/expression_mapper.cpp b/src/processor/map/expression_mapper.cpp index 141e1f07de..33347546e7 100644 --- a/src/processor/map/expression_mapper.cpp +++ b/src/processor/map/expression_mapper.cpp @@ -1,12 +1,12 @@ #include "processor/expression_mapper.h" #include "binder/expression/case_expression.h" +#include "binder/expression/expression_util.h" #include "binder/expression/literal_expression.h" #include "binder/expression/node_expression.h" #include "binder/expression/parameter_expression.h" -#include "binder/expression/path_expression.h" #include "binder/expression/rel_expression.h" -#include "binder/expression_visitor.h" +#include "binder/expression_visitor.h" // IWYU pragma: keep (used in assert) #include "common/string_format.h" #include "expression_evaluator/case_evaluator.h" #include "expression_evaluator/function_evaluator.h" diff --git a/src/processor/map/map_copy_from.cpp b/src/processor/map/map_copy_from.cpp index ad23ccd30c..0f8df0c933 100644 --- a/src/processor/map/map_copy_from.cpp +++ b/src/processor/map/map_copy_from.cpp @@ -1,6 +1,6 @@ #include "binder/copy/bound_copy_from.h" +#include "catalog/node_table_schema.h" #include "planner/operator/persistent/logical_copy_from.h" -#include "processor/operator/index_lookup.h" #include "processor/operator/partitioner.h" #include "processor/operator/persistent/copy_node.h" #include "processor/operator/persistent/copy_rdf_resource.h" diff --git a/src/processor/map/map_ddl.cpp b/src/processor/map/map_ddl.cpp index 90bef4e952..8b9060072b 100644 --- a/src/processor/map/map_ddl.cpp +++ b/src/processor/map/map_ddl.cpp @@ -1,3 +1,4 @@ +#include "common/exception/not_implemented.h" #include "planner/operator/ddl/logical_alter.h" #include "planner/operator/ddl/logical_create_table.h" #include "planner/operator/ddl/logical_drop_table.h" @@ -11,7 +12,6 @@ #include "processor/operator/ddl/drop_table.h" #include "processor/operator/ddl/rename_property.h" #include "processor/operator/ddl/rename_table.h" -#include "processor/operator/table_scan/factorized_table_scan.h" #include "processor/plan_mapper.h" using namespace kuzu::binder; @@ -42,8 +42,10 @@ std::unique_ptr PlanMapper::mapCreateTable(LogicalOperator* lo case TableType::RDF: { return mapCreateRdfGraph(logicalOperator); } - default: // LCOV_EXCL_START - throw NotImplementedException("PlanMapper::mapCreateTable"); // LCOV_EXCL_STOP + default: + // LCOV_EXCL_START + throw NotImplementedException("PlanMapper::mapCreateTable"); + // LCOV_EXCL_END } } @@ -98,7 +100,9 @@ std::unique_ptr PlanMapper::mapAlter(LogicalOperator* logicalO return mapRenameProperty(logicalOperator); } default: + // LCOV_EXCL_START throw NotImplementedException("PlanMapper::mapAlter"); + // LCOV_EXCL_END } } @@ -127,7 +131,9 @@ std::unique_ptr PlanMapper::mapAddProperty(LogicalOperator* lo extraInfo->dataType->copy(), std::move(expressionEvaluator), storageManager, getOutputPos(alter), getOperatorID(), alter->getExpressionsForPrinting()); default: - throw NotImplementedException{"PlanMapper::mapAddProperty"}; + // LCOV_EXCL_START + throw NotImplementedException("PlanMapper::mapAddProperty"); + // LCOV_EXCL_END } } diff --git a/src/processor/map/map_explain.cpp b/src/processor/map/map_explain.cpp index 44a02e8583..a0043d141c 100644 --- a/src/processor/map/map_explain.cpp +++ b/src/processor/map/map_explain.cpp @@ -2,7 +2,6 @@ #include "main/plan_printer.h" #include "planner/operator/logical_explain.h" #include "processor/operator/profile.h" -#include "processor/operator/table_scan/factorized_table_scan.h" #include "processor/plan_mapper.h" using namespace kuzu::common; diff --git a/src/processor/map/map_extend.cpp b/src/processor/map/map_extend.cpp index 055d7a229d..dc5353f2c5 100644 --- a/src/processor/map/map_extend.cpp +++ b/src/processor/map/map_extend.cpp @@ -1,6 +1,9 @@ +#include "binder/expression/property_expression.h" +#include "common/exception/not_implemented.h" #include "planner/operator/extend/logical_extend.h" -#include "processor/operator/filter.h" #include "processor/operator/scan/scan_multi_rel_tables.h" +#include "processor/operator/scan/scan_rel_csr_columns.h" +#include "processor/operator/scan/scan_rel_regular_columns.h" #include "processor/plan_mapper.h" using namespace kuzu::binder; diff --git a/src/processor/map/map_insert.cpp b/src/processor/map/map_insert.cpp index 8979fdd42a..76cd58832f 100644 --- a/src/processor/map/map_insert.cpp +++ b/src/processor/map/map_insert.cpp @@ -1,4 +1,3 @@ -#include "binder/expression/node_expression.h" #include "planner/operator/persistent/logical_insert.h" #include "processor/operator/persistent/insert.h" #include "processor/plan_mapper.h" diff --git a/src/processor/map/map_intersect.cpp b/src/processor/map/map_intersect.cpp index b67fbeac35..a291083374 100644 --- a/src/processor/map/map_intersect.cpp +++ b/src/processor/map/map_intersect.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/expression_util.h" #include "planner/operator/logical_intersect.h" #include "processor/operator/intersect/intersect.h" #include "processor/operator/intersect/intersect_build.h" diff --git a/src/processor/map/map_path_property_probe.cpp b/src/processor/map/map_path_property_probe.cpp index 0c9052aebc..381d7d7547 100644 --- a/src/processor/map/map_path_property_probe.cpp +++ b/src/processor/map/map_path_property_probe.cpp @@ -1,3 +1,5 @@ +#include "binder/expression/expression_util.h" +#include "binder/expression/property_expression.h" #include "common/string_utils.h" #include "planner/operator/extend/logical_recursive_extend.h" #include "processor/operator/hash_join/hash_join_build.h" diff --git a/src/processor/map/map_scan_node_property.cpp b/src/processor/map/map_scan_node_property.cpp index 72375613f0..d332fcc6e8 100644 --- a/src/processor/map/map_scan_node_property.cpp +++ b/src/processor/map/map_scan_node_property.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/property_expression.h" #include "planner/operator/scan/logical_scan_node_property.h" #include "processor/operator/scan/scan_multi_node_tables.h" #include "processor/plan_mapper.h" diff --git a/src/processor/map/map_semi_masker.cpp b/src/processor/map/map_semi_masker.cpp index bceafbe33c..99e61ace41 100644 --- a/src/processor/map/map_semi_masker.cpp +++ b/src/processor/map/map_semi_masker.cpp @@ -1,3 +1,4 @@ +#include "common/exception/not_implemented.h" #include "planner/operator/sip/logical_semi_masker.h" #include "processor/operator/recursive_extend/recursive_join.h" #include "processor/operator/scan_node_id.h" diff --git a/src/processor/map/map_set.cpp b/src/processor/map/map_set.cpp index e6823c615a..46c82986e4 100644 --- a/src/processor/map/map_set.cpp +++ b/src/processor/map/map_set.cpp @@ -1,3 +1,4 @@ +#include "binder/expression/property_expression.h" #include "binder/expression/rel_expression.h" #include "planner/operator/persistent/logical_set.h" #include "processor/operator/persistent/set.h" diff --git a/src/processor/map/plan_mapper.cpp b/src/processor/map/plan_mapper.cpp index d2be04e9ad..313ddb18fb 100644 --- a/src/processor/map/plan_mapper.cpp +++ b/src/processor/map/plan_mapper.cpp @@ -1,7 +1,6 @@ #include "processor/plan_mapper.h" -#include - +#include "common/exception/not_implemented.h" #include "processor/operator/profile.h" using namespace kuzu::common; diff --git a/src/processor/operator/aggregate/aggregate_hash_table.cpp b/src/processor/operator/aggregate/aggregate_hash_table.cpp index 7a728f23eb..e68ed36661 100644 --- a/src/processor/operator/aggregate/aggregate_hash_table.cpp +++ b/src/processor/operator/aggregate/aggregate_hash_table.cpp @@ -2,7 +2,7 @@ #include "common/null_buffer.h" #include "common/utils.h" -#include "function/aggregate/base_count.h" +#include "function/comparison/comparison_functions.h" #include "function/hash/vector_hash_functions.h" using namespace kuzu::common; @@ -634,7 +634,7 @@ template static bool compareEntry(common::ValueVector* vector, uint32_t vectorPos, const uint8_t* entry) { uint8_t result; auto key = vector->getData() + vectorPos * vector->getNumBytesPerValue(); - kuzu::function::Equals::operation( + function::Equals::operation( *(T*)key, *(T*)entry, result, nullptr /* leftVector */, nullptr /* rightVector */); return result != 0; } diff --git a/src/processor/operator/filtering_operator.cpp b/src/processor/operator/filtering_operator.cpp index 004beb7c89..2d541bce55 100644 --- a/src/processor/operator/filtering_operator.cpp +++ b/src/processor/operator/filtering_operator.cpp @@ -1,5 +1,7 @@ #include "processor/operator/filtering_operator.h" +#include + using namespace kuzu::common; namespace kuzu { diff --git a/src/processor/operator/hash_join/hash_join_probe.cpp b/src/processor/operator/hash_join/hash_join_probe.cpp index 686cd15167..77a56b1ace 100644 --- a/src/processor/operator/hash_join/hash_join_probe.cpp +++ b/src/processor/operator/hash_join/hash_join_probe.cpp @@ -1,7 +1,5 @@ #include "processor/operator/hash_join/hash_join_probe.h" -#include "function/hash/hash_functions.h" - using namespace kuzu::common; namespace kuzu { diff --git a/src/processor/operator/intersect/intersect.cpp b/src/processor/operator/intersect/intersect.cpp index a295e75817..7db425e4c1 100644 --- a/src/processor/operator/intersect/intersect.cpp +++ b/src/processor/operator/intersect/intersect.cpp @@ -2,6 +2,8 @@ #include +#include "function/hash/hash_functions.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/processor/operator/order_by/key_block_merger.cpp b/src/processor/operator/order_by/key_block_merger.cpp index 006ee4bd46..8f8929a6e9 100644 --- a/src/processor/operator/order_by/key_block_merger.cpp +++ b/src/processor/operator/order_by/key_block_merger.cpp @@ -1,7 +1,5 @@ #include "processor/operator/order_by/key_block_merger.h" -#include "function/comparison/comparison_functions.h" - using namespace kuzu::common; using namespace kuzu::processor; using namespace kuzu::storage; diff --git a/src/processor/operator/order_by/order_by_key_encoder.cpp b/src/processor/operator/order_by/order_by_key_encoder.cpp index 9ac4aac9dc..35e7d6fa09 100644 --- a/src/processor/operator/order_by/order_by_key_encoder.cpp +++ b/src/processor/operator/order_by/order_by_key_encoder.cpp @@ -4,6 +4,8 @@ #include #include "common/string_format.h" +#include "common/utils.h" +#include "storage/storage_utils.h" using namespace kuzu::common; using namespace kuzu::storage; @@ -257,7 +259,9 @@ void OrderByKeyEncoder::getEncodingFunction(PhysicalTypeID physicalType, encode_ return; } default: - throw NotImplementedException{"OrderByKeyEncoder::getEncodingFunction"}; + // LCOV_EXCL_START + throw NotImplementedException("OrderByKeyEncoder::getEncodingFunction"); + // LCOV_EXCL_END } } diff --git a/src/processor/operator/order_by/order_by_merge.cpp b/src/processor/operator/order_by/order_by_merge.cpp index 8a8e3a4d85..589d1540a7 100644 --- a/src/processor/operator/order_by/order_by_merge.cpp +++ b/src/processor/operator/order_by/order_by_merge.cpp @@ -1,5 +1,7 @@ #include "processor/operator/order_by/order_by_merge.h" +#include + #include "common/constants.h" using namespace kuzu::common; diff --git a/src/processor/operator/order_by/top_k.cpp b/src/processor/operator/order_by/top_k.cpp index 6cc4c4ca14..8671030087 100644 --- a/src/processor/operator/order_by/top_k.cpp +++ b/src/processor/operator/order_by/top_k.cpp @@ -1,5 +1,8 @@ #include "processor/operator/order_by/top_k.h" +#include "function/binary_function_executor.h" +#include "function/comparison/comparison_functions.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/processor/operator/persistent/copy_rel_columns.cpp b/src/processor/operator/persistent/copy_rel_columns.cpp deleted file mode 100644 index 4a4e50fe1b..0000000000 --- a/src/processor/operator/persistent/copy_rel_columns.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include "processor/operator/persistent/copy_rel_columns.h" - -#include "common/exception/copy.h" -#include "common/exception/message.h" - -using namespace kuzu::common; -using namespace kuzu::storage; - -namespace kuzu { -namespace processor { - -void CopyRelColumns::executeInternal(ExecutionContext* context) { - common::row_idx_t numRows = 0; - while (children[0]->getNextTuple(context)) { - row_idx_t numFwdRows, numBwdRows; - if (info.schema->isSingleMultiplicityInDirection(RelDataDirection::FWD)) { - numFwdRows = copyRelColumns(RelDataDirection::FWD, sharedState->fwdRelData.get(), info, - localState->fwdCopyStates); - } else { - numFwdRows = countRelLists(sharedState->fwdRelData.get(), info.boundOffsetPos); - } - if (info.schema->isSingleMultiplicityInDirection(RelDataDirection::BWD)) { - numBwdRows = copyRelColumns(RelDataDirection::BWD, sharedState->bwdRelData.get(), info, - localState->bwdCopyStates); - } else { - numBwdRows = countRelLists(sharedState->bwdRelData.get(), info.nbrOffsetPos); - } - assert(numFwdRows == numBwdRows); - (void)numBwdRows; // For clang-tidy, value calculated for debug assert. - numRows += numFwdRows; - } - sharedState->incrementNumRows(numRows); -} - -row_idx_t CopyRelColumns::copyRelColumns(RelDataDirection relDirection, - DirectedInMemRelData* relData, const CopyRelInfo& info, - std::vector>& copyStates) { - auto boundOffsetPos = relDirection == FWD ? info.boundOffsetPos : info.nbrOffsetPos; - auto nbrOffsetPos = relDirection == FWD ? info.nbrOffsetPos : info.boundOffsetPos; - auto boundOffsetChunkedArray = - ArrowColumnVector::getArrowColumn(resultSet->getValueVector(boundOffsetPos).get()); - auto nbrOffsetChunkedArray = - ArrowColumnVector::getArrowColumn(resultSet->getValueVector(nbrOffsetPos).get()); - assert(boundOffsetChunkedArray->num_chunks() == nbrOffsetChunkedArray->num_chunks()); - auto numArrayChunks = nbrOffsetChunkedArray->num_chunks(); - auto nbrColumnChunk = relData->columns->adjColumnChunk.get(); - row_idx_t numRows_ = 0; - // Copy RelID and adjColumn. - for (auto i = 0; i < numArrayChunks; i++) { - auto boundOffsetArray = boundOffsetChunkedArray->chunk(i).get(); - checkViolationOfUniqueness(relDirection, boundOffsetArray, nbrColumnChunk); - auto nbrOffsetArray = nbrOffsetChunkedArray->chunk(i).get(); - assert(boundOffsetArray->length() == nbrOffsetArray->length()); - auto numRowsInChunk = boundOffsetArray->length(); - nbrColumnChunk->copyArrowArray(*nbrOffsetArray, nullptr /* copyState */, boundOffsetArray); - // RelID. - std::shared_ptr relIDBuffer; - TableCopyUtils::throwCopyExceptionIfNotOK( - arrow::AllocateBuffer((int64_t)(numRowsInChunk * sizeof(offset_t))) - .Value(&relIDBuffer)); - auto relOffsets = (offset_t*)relIDBuffer->data(); - auto internalIDValueVector = resultSet->getValueVector(info.internalIDPos); - auto startRowIdx = internalIDValueVector - ->getValue( - internalIDValueVector->state->selVector->selectedPositions[0]) - .offset; - for (auto rowIdx = 0u; rowIdx < numRowsInChunk; rowIdx++) { - relOffsets[rowIdx] = startRowIdx + rowIdx; - } - auto relIDArray = TableCopyUtils::createArrowPrimitiveArray( - std::make_shared(), relIDBuffer, boundOffsetArray->length()); - relData->columns->propertyColumnChunks - .at(catalog::RelTableSchema::INTERNAL_REL_ID_PROPERTY_ID) - ->copyArrowArray(*relIDArray, nullptr, boundOffsetChunkedArray->chunk(i).get()); - numRows_ += numRowsInChunk; - } - // Copy rel columns. - // Skip REL_ID column, which has been copied separately. - // Skip FROM and TO value vectors, which are used for index lookup only. - // The mapping is as below: - // Data value vectors: [_FROM_, _TO_, prop1, ...] - // Columns: [REL_ID, prop1, ...] - for (auto i = 2; i < info.dataPoses.size(); i++) { - auto columnID = i - 1; - auto dataPos = info.dataPoses[i]; - auto propertyChunkedArray = - ArrowColumnVector::getArrowColumn(resultSet->getValueVector(dataPos).get()); - assert(propertyChunkedArray->num_chunks() == numArrayChunks); - assert(relData->columns->propertyColumnChunks.contains(columnID)); - for (auto chunkIdx = 0; chunkIdx < numArrayChunks; chunkIdx++) { - relData->columns->propertyColumnChunks.at(columnID)->copyArrowArray( - *propertyChunkedArray->chunk(chunkIdx), copyStates[columnID].get(), - boundOffsetChunkedArray->chunk(chunkIdx).get()); - } - } - return numRows_; -} - -row_idx_t CopyRelColumns::countRelLists( - DirectedInMemRelData* relData, const DataPos& boundOffsetPos) { - auto boundOffsetChunkedArray = - ArrowColumnVector::getArrowColumn(resultSet->getValueVector(boundOffsetPos).get()); - row_idx_t numRows_ = 0; - for (auto& boundOffsetArray : boundOffsetChunkedArray->chunks()) { - auto offsets = boundOffsetArray->data()->GetValues(1 /* value buffer */); - for (auto i = 0u; i < boundOffsetArray->length(); i++) { - InMemListsUtils::incrementListSize(*relData->lists->relListsSizes, offsets[i], 1); - } - numRows_ += boundOffsetArray->length(); - } - return numRows_; -} - -void CopyRelColumns::finalize(ExecutionContext* /*context*/) { - if (sharedState->fwdRelData->relDataFormat == RelDataFormat::COLUMN) { - flushRelColumns(sharedState->fwdRelData.get()); - } else { - assert(sharedState->fwdRelData->relDataFormat == RelDataFormat::CSR_LISTS); - buildRelListsHeaders(sharedState->fwdRelData->lists->adjList->getListHeadersBuilder().get(), - *sharedState->fwdRelData->lists->relListsSizes); - buildRelListsMetadata(sharedState->fwdRelData.get()); - } - if (sharedState->bwdRelData->relDataFormat == RelDataFormat::COLUMN) { - flushRelColumns(sharedState->bwdRelData.get()); - } else { - assert(sharedState->bwdRelData->relDataFormat == RelDataFormat::CSR_LISTS); - buildRelListsHeaders(sharedState->bwdRelData->lists->adjList->getListHeadersBuilder().get(), - *sharedState->bwdRelData->lists->relListsSizes); - buildRelListsMetadata(sharedState->bwdRelData.get()); - } -} - -void CopyRelColumns::checkViolationOfUniqueness(RelDataDirection relDirection, - arrow::Array* boundNodeOffsets, storage::InMemColumnChunk* adjColumnChunk) const { - auto offsets = boundNodeOffsets->data()->GetValues(1 /* value buffer */); - for (auto i = 0u; i < boundNodeOffsets->length(); i++) { - if (!adjColumnChunk->isNull(offsets[i])) { - throw CopyException( - ExceptionMessage::violateUniquenessOfRelAdjColumn(info.schema->tableName, - getRelMultiplicityAsString(info.schema->getRelMultiplicity()), - std::to_string(offsets[i]), - RelDataDirectionUtils::relDataDirectionToString(relDirection))); - } - adjColumnChunk->getNullChunk()->setValue(false, offsets[i]); - } -} - -void CopyRelColumns::buildRelListsHeaders( - ListHeadersBuilder* relListHeadersBuilder, const atomic_uint64_vec_t& relListsSizes) { - auto numBoundNodes = relListHeadersBuilder->getNumValues(); - auto numChunks = StorageUtils::getNumChunks(numBoundNodes); - offset_t nodeOffset = 0; - for (auto chunkId = 0u; chunkId < numChunks; chunkId++) { - offset_t chunkNodeOffset = nodeOffset; - auto numNodesInChunk = std::min( - (offset_t)ListsMetadataConstants::LISTS_CHUNK_SIZE, numBoundNodes - nodeOffset); - csr_offset_t csrOffset = relListsSizes[chunkNodeOffset].load(std::memory_order_relaxed); - for (auto i = 1u; i < numNodesInChunk; i++) { - auto currNodeOffset = chunkNodeOffset + i; - auto numElementsInList = relListsSizes[currNodeOffset].load(std::memory_order_relaxed); - relListHeadersBuilder->setCSROffset(currNodeOffset, csrOffset); - csrOffset += numElementsInList; - } - relListHeadersBuilder->setCSROffset(chunkNodeOffset + numNodesInChunk, csrOffset); - nodeOffset += numNodesInChunk; - } -} - -void CopyRelColumns::buildRelListsMetadata(DirectedInMemRelData* directedInMemRelData) { - auto relListHeaders = directedInMemRelData->lists->adjList->getListHeadersBuilder().get(); - buildRelListsMetadata(directedInMemRelData->lists->adjList.get(), relListHeaders); - for (auto& [_, propertyRelLists] : directedInMemRelData->lists->propertyLists) { - buildRelListsMetadata(propertyRelLists.get(), relListHeaders); - } -} - -void CopyRelColumns::buildRelListsMetadata( - InMemLists* relLists, ListHeadersBuilder* relListHeaders) { - auto numBoundNodes = relListHeaders->getNumValues(); - auto numChunks = StorageUtils::getNumChunks(numBoundNodes); - offset_t nodeOffset = 0; - auto numValuesPerPage = relLists->getNumElementsInAPage(); - for (auto chunkIdx = 0u; chunkIdx < numChunks; chunkIdx++) { - auto numPagesForChunk = 0u, offsetInPage = 0u; - auto lastNodeOffsetInChunk = - std::min(nodeOffset + ListsMetadataConstants::LISTS_CHUNK_SIZE, numBoundNodes); - while (nodeOffset < lastNodeOffsetInChunk) { - auto numValuesInRelList = relListHeaders->getListSize(nodeOffset); - while (numValuesInRelList + offsetInPage > numValuesPerPage) { - numValuesInRelList -= (numValuesPerPage - offsetInPage); - numPagesForChunk++; - offsetInPage = 0u; - } - offsetInPage += numValuesInRelList; - nodeOffset++; - } - if (0 != offsetInPage) { - numPagesForChunk++; - } - relLists->getListsMetadataBuilder()->populateChunkPageList( - chunkIdx, numPagesForChunk, relLists->inMemFile->getNumPages()); - relLists->inMemFile->addNewPages(numPagesForChunk); - } -} - -void CopyRelColumns::flushRelColumns(DirectedInMemRelData* directedInMemRelData) { - directedInMemRelData->columns->adjColumn->flushChunk( - directedInMemRelData->columns->adjColumnChunk.get()); - directedInMemRelData->columns->adjColumn->saveToFile(); - for (auto& [propertyID, propertyColumn] : directedInMemRelData->columns->propertyColumns) { - propertyColumn->flushChunk( - directedInMemRelData->columns->propertyColumnChunks.at(propertyID).get()); - propertyColumn->saveToFile(); - } -} - -} // namespace processor -} // namespace kuzu diff --git a/src/processor/operator/persistent/copy_to_csv.cpp b/src/processor/operator/persistent/copy_to_csv.cpp index 3b959ab0b9..50d2a129d4 100644 --- a/src/processor/operator/persistent/copy_to_csv.cpp +++ b/src/processor/operator/persistent/copy_to_csv.cpp @@ -1,5 +1,7 @@ #include "processor/operator/persistent/copy_to_csv.h" +#include "function/cast/vector_cast_functions.h" + namespace kuzu { namespace processor { diff --git a/src/processor/operator/persistent/csv_file_writer.cpp b/src/processor/operator/persistent/csv_file_writer.cpp index 0740507a97..e582c5526f 100644 --- a/src/processor/operator/persistent/csv_file_writer.cpp +++ b/src/processor/operator/persistent/csv_file_writer.cpp @@ -1,6 +1,10 @@ #include "processor/operator/persistent/csv_file_writer.h" +#include + #include "common/constants.h" +#include "common/exception/not_implemented.h" +#include "common/file_utils.h" #include "common/string_utils.h" #include "common/type_utils.h" #include "common/types/date_t.h" diff --git a/src/processor/operator/persistent/insert_executor.cpp b/src/processor/operator/persistent/insert_executor.cpp index 27f287b170..bf7e13b84f 100644 --- a/src/processor/operator/persistent/insert_executor.cpp +++ b/src/processor/operator/persistent/insert_executor.cpp @@ -1,5 +1,7 @@ #include "processor/operator/persistent/insert_executor.h" +#include "storage/stats/rels_store_statistics.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/processor/operator/persistent/parquet_column_writer.cpp b/src/processor/operator/persistent/parquet_column_writer.cpp deleted file mode 100644 index 8cb8f38a76..0000000000 --- a/src/processor/operator/persistent/parquet_column_writer.cpp +++ /dev/null @@ -1,225 +0,0 @@ -#include "processor/operator/persistent/parquet_column_writer.h" - -using namespace kuzu::common; - -namespace kuzu { -namespace processor { - -void ParquetColumnWriter::nextParquetColumn(LogicalTypeID /*logicalTypeID*/) { - columnWriter = rowGroupWriter->column(currentParquetColumn); - currentParquetColumn++; - if (currentParquetColumn == totalColumns) { - currentParquetColumn = 0; - } -} - -void ParquetColumnWriter::writePrimitiveValue( - LogicalTypeID logicalTypeID, uint8_t* value, int16_t definitionLevel, int16_t repetitionLevel) { - switch (logicalTypeID) { - case LogicalTypeID::BOOL: { - auto val = *reinterpret_cast(value); - auto boolWriter = static_cast(columnWriter); - boolWriter->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::INT16: { - auto val = static_cast(*reinterpret_cast(value)); - auto int32Writer = static_cast(columnWriter); - int32Writer->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::INT32: { - auto val = *reinterpret_cast(value); - auto int32Writer = static_cast(columnWriter); - int32Writer->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::INT64: { - auto val = *reinterpret_cast(value); - auto int64Writer = static_cast(columnWriter); - int64Writer->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::DOUBLE: { - auto val = *reinterpret_cast(value); - auto doubleWriter = static_cast(columnWriter); - doubleWriter->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::FLOAT: { - auto val = *reinterpret_cast(value); - auto floatWriter = static_cast(columnWriter); - floatWriter->WriteBatch(1, &definitionLevel, &repetitionLevel, &val); - } break; - case LogicalTypeID::DATE: { - auto val = *reinterpret_cast(value); - auto int32Writer = static_cast(columnWriter); - int32Writer->WriteBatch(1, &definitionLevel, &repetitionLevel, &val.days); - } break; - case LogicalTypeID::TIMESTAMP: { - auto val = *reinterpret_cast(value); - auto int64Writer = static_cast(columnWriter); - int64Writer->WriteBatch(1, &definitionLevel, &repetitionLevel, &val.value); - } break; - case LogicalTypeID::INTERVAL: { - auto val = *reinterpret_cast(value); - auto fixedLenByteArrayWriter = static_cast(columnWriter); - uint32_t milliseconds = val.micros / Interval::MICROS_PER_MSEC; - uint8_t interval[12]; - writeLittleEndianUint32(interval, val.months); - writeLittleEndianUint32(interval + 4, val.days); - writeLittleEndianUint32(interval + 8, milliseconds); - parquet::FixedLenByteArray intervalByteArray; - intervalByteArray.ptr = interval; - fixedLenByteArrayWriter->WriteBatch(1, nullptr, nullptr, &intervalByteArray); - } break; - case LogicalTypeID::INTERNAL_ID: { - auto val = *reinterpret_cast(value); - auto byteArrayWriter = static_cast(columnWriter); - auto internalID = std::to_string(val.tableID) + ":" + std::to_string(val.offset); - parquet::ByteArray valueToWrite; - valueToWrite.ptr = reinterpret_cast(&internalID[0]); - valueToWrite.len = internalID.length(); - byteArrayWriter->WriteBatch(1, &definitionLevel, &repetitionLevel, &valueToWrite); - } break; - case LogicalTypeID::STRING: { - auto val = *reinterpret_cast(value); - auto byteArrayWriter = static_cast(columnWriter); - parquet::ByteArray valueToWrite; - valueToWrite.ptr = &val.getData()[0]; - valueToWrite.len = val.len; - byteArrayWriter->WriteBatch(1, &definitionLevel, &repetitionLevel, &valueToWrite); - } break; - default: - throw NotImplementedException("ParquetWriter::writePrimitiveValue"); - } -} - -void ParquetColumnWriter::writeColumn( - int column, ValueVector* vector, parquet::RowGroupWriter* writer) { - initNewColumn(); - currentColumn = column; - rowGroupWriter = writer; - auto selPos = vector->state->selVector->selectedPositions[0]; - uint8_t* value = vector->getData() + vector->getNumBytesPerValue() * selPos; - estimatedRowBytes += vector->getNumBytesPerValue(); - if (LogicalTypeUtils::isNested(vector->dataType)) { - std::map batch; - extractNested(value, vector, batch); - // write primitives after extraction - for (auto& [_, column] : batch) { - nextParquetColumn(column.logicalTypeID); - for (auto j = 0; j < column.values.size(); ++j) { - writePrimitiveValue(column.logicalTypeID, column.values[j], - column.definitionLevels[j], column.repetitionLevels[j]); - } - } - } else { - nextParquetColumn(vector->dataType.getLogicalTypeID()); - writePrimitiveValue(vector->dataType.getLogicalTypeID(), value); - } -} - -int ParquetColumnWriter::getRepetitionLevel( - int currentElementIdx, int parentElementIdx, int depth) { - if (isListStarting) - return 0; - if (currentElementIdx == 0) { - if (parentElementIdx == 0) { - int result = depth - 2; // depth - parent depth - 1 - return (result < 0) ? 0 : result; - } - return depth - 1; - } - return depth; -} - -// For structs, parquet flattens the data so each value has its own column if -// the key is the same. Examples: -// -// {a: {b: 1, c: 2}, d: {e: 3, f: 4}} -// numberOfPrimitiveNodes = 4 -// column[0] = {1}; -// column[1] = {2}; -// column[2] = {3}; -// column[3] = {4}; -// -// In this case, the last 'b' is a new column since it is nested in 'c' -// {a: [{b: 1}, {b: 2}], c: [{b: 3}]} -// numberOfPrimitiveNodes = 3 -// column[0] = {1,2}; -// column[1] = {3}; -// -// [{a:1, b:2}, {a:3, b:4}] -// numberOfPrimitiveNodes = 2 -// column[0] = {1,3}; -// column[1] = {2,4}; -void ParquetColumnWriter::addToParquetColumns(uint8_t* value, ValueVector* vector, - std::map& parquetColumns, int currentElementIdx, - int parentElementIdx, int depth, std::string parentStructFieldName) { - int repetitionLevel = getRepetitionLevel(currentElementIdx, parentElementIdx, depth); - if (LogicalTypeUtils::isNested(vector->dataType)) { - extractNested(value, vector, parquetColumns, currentElementIdx, parentElementIdx, depth, - parentStructFieldName); - } else { - // We define parquetBatch[column] to store the necessary information to - // write in each parquet column using writeBatch. One Kuzu column can - // have multiple parquet columns. - parquetColumns[parentStructFieldName].repetitionLevels.push_back(repetitionLevel); - parquetColumns[parentStructFieldName].definitionLevels.push_back( - maxDefinitionLevels[currentColumn]); - parquetColumns[parentStructFieldName].values.push_back(value); - parquetColumns[parentStructFieldName].logicalTypeID = vector->dataType.getLogicalTypeID(); - } -} - -void ParquetColumnWriter::extractNested(uint8_t* value, const ValueVector* vector, - std::map& parquetColumns, int currentElementIdx, - int parentElementIdx, int depth, std::string parentStructFieldName) { - switch (vector->dataType.getLogicalTypeID()) { - case LogicalTypeID::VAR_LIST: - return extractList(*reinterpret_cast(value), vector, parquetColumns, - currentElementIdx, parentElementIdx, depth, parentStructFieldName); - case LogicalTypeID::STRUCT: - return extractStruct(*reinterpret_cast(value), vector, parquetColumns, - currentElementIdx, parentElementIdx, depth, parentStructFieldName); - default: - throw NotImplementedException("ParquetColumnWriter::extractNested"); - } -} - -void ParquetColumnWriter::extractList(const list_entry_t& list, const ValueVector* vector, - std::map& parquetColumns, int currentElementIdx, - int /*parentElementIdx*/, int depth, std::string parentStructFieldName) { - auto values = ListVector::getListValues(vector, list); - auto dataVector = ListVector::getDataVector(vector); - depth++; - int elementsToAdd = (list.size == 0) ? 1 : list.size; - for (auto i = 0u; i < elementsToAdd; ++i) { - // this is used to always set the repetition level to 0 when a kuzu - // column starts - isListStarting = isListStarting && i == 0; - addToParquetColumns(values, dataVector, parquetColumns, i /* currentElementIdx */, - currentElementIdx /* parentElementIdx */, depth, parentStructFieldName); - values += ListVector::getDataVector(vector)->getNumBytesPerValue(); - } -} - -void ParquetColumnWriter::extractStruct(const struct_entry_t& val, const ValueVector* vector, - std::map& parquetColumns, int currentElementIdx, - int parentElementIdx, int depth, std::string parentStructFieldName) { - auto fields = StructType::getFields(&vector->dataType); - auto structNames = StructType::getFieldNames(&vector->dataType); - for (auto i = 0u; i < fields.size(); ++i) { - auto fieldVector = StructVector::getFieldVector(vector, i); - std::string fieldName = parentStructFieldName + structNames[i]; - addToParquetColumns(fieldVector->getData() + fieldVector->getNumBytesPerValue() * val.pos, - fieldVector.get(), parquetColumns, currentElementIdx, parentElementIdx, depth, - fieldName); - } -} - -void ParquetColumnWriter::writeLittleEndianUint32(uint8_t* buffer, uint32_t value) { - buffer[0] = (value & 0x000000FF); - buffer[1] = (value & 0x0000FF00) >> 8; - buffer[2] = (value & 0x00FF0000) >> 16; - buffer[3] = (value & 0xFF000000) >> 24; -} - -} // namespace processor -} // namespace kuzu diff --git a/src/processor/operator/persistent/reader/csv/base_csv_reader.cpp b/src/processor/operator/persistent/reader/csv/base_csv_reader.cpp index 24db3d31e7..47bed566c8 100644 --- a/src/processor/operator/persistent/reader/csv/base_csv_reader.cpp +++ b/src/processor/operator/persistent/reader/csv/base_csv_reader.cpp @@ -1,8 +1,14 @@ #include "processor/operator/persistent/reader/csv/base_csv_reader.h" +#include +#if defined(_WIN32) +#include +#else +#include +#endif + #include -#include "common/data_chunk/data_chunk.h" #include "common/exception/copy.h" #include "common/string_format.h" #include "common/system_message.h" diff --git a/src/processor/operator/persistent/reader/csv/driver.cpp b/src/processor/operator/persistent/reader/csv/driver.cpp index 159c1fa823..957a556dc2 100644 --- a/src/processor/operator/persistent/reader/csv/driver.cpp +++ b/src/processor/operator/persistent/reader/csv/driver.cpp @@ -1,13 +1,10 @@ #include "processor/operator/persistent/reader/csv/driver.h" #include "common/exception/copy.h" -#include "common/exception/message.h" #include "common/string_format.h" -#include "common/types/value/value.h" #include "function/cast/functions/cast_string_to_functions.h" #include "processor/operator/persistent/reader/csv/parallel_csv_reader.h" #include "processor/operator/persistent/reader/csv/serial_csv_reader.h" -#include "storage/store/table_copy_utils.h" using namespace kuzu::common; diff --git a/src/processor/operator/persistent/reader/csv/parallel_csv_reader.cpp b/src/processor/operator/persistent/reader/csv/parallel_csv_reader.cpp index 2d8a9920d3..a0638c09ae 100644 --- a/src/processor/operator/persistent/reader/csv/parallel_csv_reader.cpp +++ b/src/processor/operator/persistent/reader/csv/parallel_csv_reader.cpp @@ -1,5 +1,11 @@ #include "processor/operator/persistent/reader/csv/parallel_csv_reader.h" +#if defined(_WIN32) +#include +#else +#include +#endif + #include "common/exception/copy.h" #include "common/string_format.h" #include "common/system_message.h" diff --git a/src/processor/operator/persistent/reader/npy/npy_reader.cpp b/src/processor/operator/persistent/reader/npy/npy_reader.cpp index fc5d3a41d0..49cd6bd4f4 100644 --- a/src/processor/operator/persistent/reader/npy/npy_reader.cpp +++ b/src/processor/operator/persistent/reader/npy/npy_reader.cpp @@ -4,6 +4,7 @@ #include #ifdef _WIN32 +#include "common/exception/buffer_manager.h" #include #include #include @@ -12,7 +13,6 @@ #include #endif -#include "common/exception/buffer_manager.h" #include "common/exception/copy.h" #include "common/string_format.h" #include "common/utils.h" diff --git a/src/processor/operator/persistent/reader/parquet/column_reader.cpp b/src/processor/operator/persistent/reader/parquet/column_reader.cpp index b23f6fcb1c..c7e18677e1 100644 --- a/src/processor/operator/persistent/reader/parquet/column_reader.cpp +++ b/src/processor/operator/persistent/reader/parquet/column_reader.cpp @@ -1,5 +1,7 @@ #include "processor/operator/persistent/reader/parquet/column_reader.h" +#include + #include "common/exception/not_implemented.h" #include "common/types/date_t.h" #include "miniz_wrapper.hpp" diff --git a/src/processor/operator/persistent/reader/parquet/parquet_reader.cpp b/src/processor/operator/persistent/reader/parquet/parquet_reader.cpp index 66104d7bae..eff4f67efc 100644 --- a/src/processor/operator/persistent/reader/parquet/parquet_reader.cpp +++ b/src/processor/operator/persistent/reader/parquet/parquet_reader.cpp @@ -1,10 +1,10 @@ #include "processor/operator/persistent/reader/parquet/parquet_reader.h" #include "common/exception/copy.h" -#include "common/exception/not_implemented.h" #include "common/file_utils.h" #include "common/string_format.h" #include "processor/operator/persistent/reader/parquet/list_column_reader.h" +#include "processor/operator/persistent/reader/parquet/struct_column_reader.h" #include "processor/operator/persistent/reader/parquet/thrift_tools.h" using namespace kuzu_parquet::format; diff --git a/src/processor/operator/persistent/reader/rdf/rdf_reader.cpp b/src/processor/operator/persistent/reader/rdf/rdf_reader.cpp index 8d9ee11083..7c6b87c052 100644 --- a/src/processor/operator/persistent/reader/rdf/rdf_reader.cpp +++ b/src/processor/operator/persistent/reader/rdf/rdf_reader.cpp @@ -4,6 +4,7 @@ #include "common/constants.h" #include "common/exception/copy.h" +#include "common/exception/not_implemented.h" #include "common/string_format.h" #include "common/vector/value_vector.h" #include "serd.h" @@ -141,9 +142,9 @@ SerdStatus RDFReader::readerStatementSink(void* handle, SerdStatementFlags /*fla reader->vectorSize++; reader->rowOffset++; } break; - // LCOV_EXCL_START default: - throw common::NotImplementedException("RDFReader::statementSink"); + // LCOV_EXCL_START + throw NotImplementedException("RDFReader::statementSink"); // LCOV_EXCL_STOP } diff --git a/src/processor/operator/persistent/reader_functions.cpp b/src/processor/operator/persistent/reader_functions.cpp index 3b75a9e94d..a75e2e0de6 100644 --- a/src/processor/operator/persistent/reader_functions.cpp +++ b/src/processor/operator/persistent/reader_functions.cpp @@ -1,9 +1,8 @@ #include "processor/operator/persistent/reader_functions.h" -#include "common/exception/copy.h" +#include "common/enums/table_type.h" using namespace kuzu::common; -using namespace kuzu::catalog; using namespace kuzu::storage; namespace kuzu { diff --git a/src/processor/operator/persistent/reader_state.cpp b/src/processor/operator/persistent/reader_state.cpp index 8121e336fb..fffdf71a09 100644 --- a/src/processor/operator/persistent/reader_state.cpp +++ b/src/processor/operator/persistent/reader_state.cpp @@ -2,7 +2,6 @@ #include -using namespace kuzu::catalog; using namespace kuzu::common; using namespace kuzu::storage; diff --git a/src/processor/operator/persistent/writer/parquet/column_writer.cpp b/src/processor/operator/persistent/writer/parquet/column_writer.cpp index 83a701fb73..b172f32032 100644 --- a/src/processor/operator/persistent/writer/parquet/column_writer.cpp +++ b/src/processor/operator/persistent/writer/parquet/column_writer.cpp @@ -1,7 +1,7 @@ #include "processor/operator/persistent/writer/parquet/column_writer.h" #include "common/exception/not_implemented.h" -#include "common/string_utils.h" +#include "common/string_format.h" #include "function/cast/functions/numeric_limits.h" #include "processor/operator/persistent/writer/parquet/boolean_column_writer.h" #include "processor/operator/persistent/writer/parquet/interval_column_writer.h" diff --git a/src/processor/operator/persistent/writer/parquet/string_column_writer.cpp b/src/processor/operator/persistent/writer/parquet/string_column_writer.cpp index 7277cf6ef3..088c6cf8ee 100644 --- a/src/processor/operator/persistent/writer/parquet/string_column_writer.cpp +++ b/src/processor/operator/persistent/writer/parquet/string_column_writer.cpp @@ -2,6 +2,7 @@ #include "function/comparison/comparison_functions.h" #include "function/hash/hash_functions.h" +#include "processor/operator/persistent/reader/parquet/parquet_rle_bp_decoder.h" namespace kuzu { namespace processor { diff --git a/src/processor/operator/profile.cpp b/src/processor/operator/profile.cpp index 12dcada880..af55a6e3a7 100644 --- a/src/processor/operator/profile.cpp +++ b/src/processor/operator/profile.cpp @@ -1,7 +1,6 @@ #include "processor/operator/profile.h" #include "main/plan_printer.h" -#include "processor/physical_plan.h" using namespace kuzu::common; diff --git a/src/processor/operator/recursive_extend/path_property_probe.cpp b/src/processor/operator/recursive_extend/path_property_probe.cpp index 97d2fb8127..1148d24d0e 100644 --- a/src/processor/operator/recursive_extend/path_property_probe.cpp +++ b/src/processor/operator/recursive_extend/path_property_probe.cpp @@ -1,6 +1,6 @@ #include "processor/operator/recursive_extend/path_property_probe.h" -#include "function/hash/vector_hash_functions.h" +#include "function/hash/hash_functions.h" using namespace kuzu::common; diff --git a/src/processor/operator/recursive_extend/recursive_join.cpp b/src/processor/operator/recursive_extend/recursive_join.cpp index 5a478876c5..edbc2d038c 100644 --- a/src/processor/operator/recursive_extend/recursive_join.cpp +++ b/src/processor/operator/recursive_extend/recursive_join.cpp @@ -1,5 +1,6 @@ #include "processor/operator/recursive_extend/recursive_join.h" +#include "common/exception/not_implemented.h" #include "processor/operator/recursive_extend/all_shortest_path_state.h" #include "processor/operator/recursive_extend/scan_frontier.h" #include "processor/operator/recursive_extend/shortest_path_state.h" diff --git a/src/processor/result/flat_tuple.cpp b/src/processor/result/flat_tuple.cpp index cc39bc3ac8..46150d50af 100644 --- a/src/processor/result/flat_tuple.cpp +++ b/src/processor/result/flat_tuple.cpp @@ -1,5 +1,7 @@ #include "processor/result/flat_tuple.h" +#include + #include "common/exception/runtime.h" #include "common/string_format.h" #include "common/types/value/value.h" diff --git a/src/storage/buffer_manager/bm_file_handle.cpp b/src/storage/buffer_manager/bm_file_handle.cpp index ce1aa322f3..77ca6de6af 100644 --- a/src/storage/buffer_manager/bm_file_handle.cpp +++ b/src/storage/buffer_manager/bm_file_handle.cpp @@ -1,6 +1,7 @@ #include "storage/buffer_manager/bm_file_handle.h" #include "storage/buffer_manager/buffer_manager.h" +#include "storage/storage_utils.h" using namespace kuzu::common; diff --git a/src/storage/buffer_manager/buffer_manager.cpp b/src/storage/buffer_manager/buffer_manager.cpp index 933015424f..4d6f41e5bc 100644 --- a/src/storage/buffer_manager/buffer_manager.cpp +++ b/src/storage/buffer_manager/buffer_manager.cpp @@ -1,7 +1,10 @@ #include "storage/buffer_manager/buffer_manager.h" +#include + #include "common/constants.h" #include "common/exception/buffer_manager.h" +#include "common/exception/not_implemented.h" #if defined(_WIN32) #include diff --git a/src/storage/buffer_manager/memory_manager.cpp b/src/storage/buffer_manager/memory_manager.cpp index 640b0e26e3..d708b8a44e 100644 --- a/src/storage/buffer_manager/memory_manager.cpp +++ b/src/storage/buffer_manager/memory_manager.cpp @@ -2,7 +2,6 @@ #include -#include "common/utils.h" #include "storage/buffer_manager/buffer_manager.h" using namespace kuzu::common; diff --git a/src/storage/file_handle.cpp b/src/storage/file_handle.cpp index 26a81b51c9..1454b7816c 100644 --- a/src/storage/file_handle.cpp +++ b/src/storage/file_handle.cpp @@ -1,6 +1,7 @@ #include "storage/file_handle.h" -#include "common/utils.h" +#include +#include using namespace kuzu::common; diff --git a/src/storage/index/hash_index_utils.cpp b/src/storage/index/hash_index_utils.cpp index cb23ec9c3a..0bdf72ab8b 100644 --- a/src/storage/index/hash_index_utils.cpp +++ b/src/storage/index/hash_index_utils.cpp @@ -2,6 +2,7 @@ #include "common/exception/copy.h" #include "common/exception/storage.h" +#include "common/type_utils.h" using namespace kuzu::common; using namespace kuzu::transaction; diff --git a/src/storage/local_table.cpp b/src/storage/local_table.cpp index d43a57d09c..ddd537f0a9 100644 --- a/src/storage/local_table.cpp +++ b/src/storage/local_table.cpp @@ -4,7 +4,6 @@ #include "common/exception/runtime.h" #include "storage/store/node_table.h" #include "storage/store/string_column.h" -#include "storage/store/string_column_chunk.h" #include "storage/store/struct_column.h" #include "storage/store/var_list_column.h" #include "storage/store/var_list_column_chunk.h" diff --git a/src/storage/stats/node_table_statistics.cpp b/src/storage/stats/node_table_statistics.cpp index e761bbd87d..8827bc5119 100644 --- a/src/storage/stats/node_table_statistics.cpp +++ b/src/storage/stats/node_table_statistics.cpp @@ -4,6 +4,7 @@ #include "common/serializer/serializer.h" #include "common/string_format.h" #include "storage/stats/table_statistics_collection.h" +#include "storage/storage_utils.h" using namespace kuzu::common; diff --git a/src/storage/stats/nodes_store_statistics.cpp b/src/storage/stats/nodes_store_statistics.cpp index b1b92d5138..b5e2dac63e 100644 --- a/src/storage/stats/nodes_store_statistics.cpp +++ b/src/storage/stats/nodes_store_statistics.cpp @@ -1,8 +1,5 @@ #include "storage/stats/nodes_store_statistics.h" -#include "common/constants.h" -#include "common/string_utils.h" - using namespace kuzu::common; namespace kuzu { diff --git a/src/storage/stats/table_statistics.cpp b/src/storage/stats/table_statistics.cpp index 4a12251cdb..58368fce28 100644 --- a/src/storage/stats/table_statistics.cpp +++ b/src/storage/stats/table_statistics.cpp @@ -1,6 +1,7 @@ #include "storage/stats/table_statistics.h" #include "catalog/table_schema.h" +#include "common/exception/not_implemented.h" #include "common/serializer/deserializer.h" #include "common/serializer/serializer.h" #include "storage/stats/node_table_statistics.h" diff --git a/src/storage/storage_structure/disk_array.cpp b/src/storage/storage_structure/disk_array.cpp index 94a65f4865..6e6e259d03 100644 --- a/src/storage/storage_structure/disk_array.cpp +++ b/src/storage/storage_structure/disk_array.cpp @@ -4,7 +4,7 @@ #include "common/utils.h" #include "storage/index/hash_index_header.h" #include "storage/index/hash_index_slot.h" -#include "storage/store/column.h" +#include "storage/store/column_chunk.h" using namespace kuzu::common; using namespace kuzu::transaction; diff --git a/src/storage/storage_structure/disk_overflow_file.cpp b/src/storage/storage_structure/disk_overflow_file.cpp index 0f8a5dea5b..b4747c93e9 100644 --- a/src/storage/storage_structure/disk_overflow_file.cpp +++ b/src/storage/storage_structure/disk_overflow_file.cpp @@ -1,9 +1,7 @@ #include "storage/storage_structure/disk_overflow_file.h" -#include "common/null_buffer.h" #include "common/string_format.h" #include "common/type_utils.h" -#include "common/types/value/value.h" using lock_t = std::unique_lock; diff --git a/src/storage/storage_structure/in_mem_page.cpp b/src/storage/storage_structure/in_mem_page.cpp index 8e47bf68ad..8c9ff0a982 100644 --- a/src/storage/storage_structure/in_mem_page.cpp +++ b/src/storage/storage_structure/in_mem_page.cpp @@ -1,8 +1,10 @@ #include "storage/storage_structure/in_mem_page.h" -#include #include +#include "common/constants.h" +#include "common/null_mask.h" + using namespace kuzu::common; namespace kuzu { diff --git a/src/storage/storage_utils.cpp b/src/storage/storage_utils.cpp index 841ea6ce90..f5ec04faf6 100644 --- a/src/storage/storage_utils.cpp +++ b/src/storage/storage_utils.cpp @@ -1,11 +1,11 @@ #include "storage/storage_utils.h" +#include "common/exception/runtime.h" #include "common/null_buffer.h" #include "common/string_format.h" -#include "common/string_utils.h" -#include "storage/storage_manager.h" +#include "common/types/ku_list.h" +#include "common/types/ku_string.h" -using namespace kuzu::catalog; using namespace kuzu::common; namespace kuzu { diff --git a/src/storage/store/column.cpp b/src/storage/store/column.cpp index 78d07b5772..e089d12ccb 100644 --- a/src/storage/store/column.cpp +++ b/src/storage/store/column.cpp @@ -2,6 +2,7 @@ #include +#include "common/exception/not_implemented.h" #include "storage/stats/property_statistics.h" #include "storage/store/column_chunk.h" #include "storage/store/compression.h" diff --git a/src/storage/store/column_chunk.cpp b/src/storage/store/column_chunk.cpp index 038c0eb6f7..7f5f8441a7 100644 --- a/src/storage/store/column_chunk.cpp +++ b/src/storage/store/column_chunk.cpp @@ -1,14 +1,11 @@ #include "storage/store/column_chunk.h" -#include "common/types/value/nested.h" -#include "storage/storage_structure/db_file_utils.h" #include "storage/store/compression.h" #include "storage/store/string_column_chunk.h" #include "storage/store/struct_column_chunk.h" #include "storage/store/var_list_column_chunk.h" using namespace kuzu::common; -using namespace kuzu::transaction; namespace kuzu { namespace storage { diff --git a/src/storage/store/compression.cpp b/src/storage/store/compression.cpp index 5948c8057c..03eae36671 100644 --- a/src/storage/store/compression.cpp +++ b/src/storage/store/compression.cpp @@ -1,7 +1,5 @@ #include "storage/store/compression.h" -#include - #include #include "common/exception/not_implemented.h" diff --git a/src/storage/store/node_group.cpp b/src/storage/store/node_group.cpp index d4d83c4114..ea3b497638 100644 --- a/src/storage/store/node_group.cpp +++ b/src/storage/store/node_group.cpp @@ -1,9 +1,8 @@ #include "storage/store/node_group.h" #include "common/constants.h" -#include "storage/store/node_table.h" +#include "storage/store/table_data.h" -using namespace kuzu::processor; using namespace kuzu::common; using namespace kuzu::catalog; using namespace kuzu::transaction; diff --git a/src/storage/store/node_table.cpp b/src/storage/store/node_table.cpp index 60526503fc..4dfa0f08c5 100644 --- a/src/storage/store/node_table.cpp +++ b/src/storage/store/node_table.cpp @@ -3,6 +3,7 @@ #include "catalog/node_table_schema.h" #include "common/exception/message.h" #include "common/exception/runtime.h" +#include "storage/store/node_table_data.h" #include "transaction/transaction.h" using namespace kuzu::catalog; diff --git a/src/storage/store/rel_table.cpp b/src/storage/store/rel_table.cpp index 7b423052d2..52dce8e95c 100644 --- a/src/storage/store/rel_table.cpp +++ b/src/storage/store/rel_table.cpp @@ -1,6 +1,5 @@ #include "storage/store/rel_table.h" -#include "common/string_format.h" #include "storage/stats/rels_store_statistics.h" using namespace kuzu::catalog; diff --git a/src/storage/store/rel_table_data.cpp b/src/storage/store/rel_table_data.cpp index 2cc9593815..19261f81c5 100644 --- a/src/storage/store/rel_table_data.cpp +++ b/src/storage/store/rel_table_data.cpp @@ -1,5 +1,6 @@ #include "storage/store/rel_table_data.h" +#include "common/assert.h" #include "storage/stats/rels_store_statistics.h" using namespace kuzu::catalog; diff --git a/src/storage/store/string_column.cpp b/src/storage/store/string_column.cpp index ba31d1ecf1..0c344e54eb 100644 --- a/src/storage/store/string_column.cpp +++ b/src/storage/store/string_column.cpp @@ -1,5 +1,6 @@ #include "storage/store/string_column.h" +#include "common/type_utils.h" #include "storage/store/string_column_chunk.h" using namespace kuzu::catalog; diff --git a/src/storage/store/string_column_chunk.cpp b/src/storage/store/string_column_chunk.cpp index b4ced0c1b0..d4a27aed8a 100644 --- a/src/storage/store/string_column_chunk.cpp +++ b/src/storage/store/string_column_chunk.cpp @@ -1,7 +1,7 @@ #include "storage/store/string_column_chunk.h" -#include "common/exception/message.h" #include "common/exception/not_implemented.h" +#include "common/type_utils.h" #include "storage/store/table_copy_utils.h" using namespace kuzu::common; diff --git a/src/storage/store/struct_column.cpp b/src/storage/store/struct_column.cpp index d3310a08d5..e6d4c62e3e 100644 --- a/src/storage/store/struct_column.cpp +++ b/src/storage/store/struct_column.cpp @@ -1,6 +1,5 @@ #include "storage/store/struct_column.h" -#include "storage/stats/table_statistics.h" #include "storage/store/struct_column_chunk.h" using namespace kuzu::catalog; diff --git a/src/storage/store/struct_column_chunk.cpp b/src/storage/store/struct_column_chunk.cpp index bd0244bd0d..b322eb331a 100644 --- a/src/storage/store/struct_column_chunk.cpp +++ b/src/storage/store/struct_column_chunk.cpp @@ -1,11 +1,5 @@ #include "storage/store/struct_column_chunk.h" -#include "common/exception/not_implemented.h" -#include "common/types/value/nested.h" -#include "storage/store/string_column_chunk.h" -#include "storage/store/table_copy_utils.h" -#include "storage/store/var_list_column_chunk.h" - using namespace kuzu::common; namespace kuzu { diff --git a/src/storage/store/var_list_column_chunk.cpp b/src/storage/store/var_list_column_chunk.cpp index 0358b9c24c..9238fb1829 100644 --- a/src/storage/store/var_list_column_chunk.cpp +++ b/src/storage/store/var_list_column_chunk.cpp @@ -1,6 +1,5 @@ #include "storage/store/var_list_column_chunk.h" -#include "common/types/value/nested.h" #include "common/types/value/value.h" using namespace kuzu::common; diff --git a/src/storage/wal/wal.cpp b/src/storage/wal/wal.cpp index b7b5ff3640..95743e80e9 100644 --- a/src/storage/wal/wal.cpp +++ b/src/storage/wal/wal.cpp @@ -1,7 +1,8 @@ #include "storage/wal/wal.h" +#include "common/exception/runtime.h" #include "common/utils.h" -#include "spdlog/spdlog.h" +#include "spdlog/spdlog.h" // IWYU pragma: keep: public interface to spdlog. #include "storage/storage_utils.h" using namespace kuzu::common; @@ -193,7 +194,7 @@ WALIterator::WALIterator(std::shared_ptr fileHandle, std::mutex& m void WALIterator::getNextRecord(WALRecord& retVal) { lock_t lck{mtx}; if (!hasNextRecordNoLock()) { - throw RuntimeException("WALIterator cannot read more log records from the WAL."); + throw RuntimeException("WALIterator cannot read more log records from the WAL."); } WALRecord::constructWALRecordFromBytes( retVal, currentHeaderPageBuffer.get(), offsetInCurrentHeaderPage); diff --git a/src/storage/wal/wal_record.cpp b/src/storage/wal/wal_record.cpp index 4ea212542c..c2336f9d1c 100644 --- a/src/storage/wal/wal_record.cpp +++ b/src/storage/wal/wal_record.cpp @@ -1,5 +1,7 @@ #include "storage/wal/wal_record.h" +#include "common/exception/not_implemented.h" + using namespace kuzu::common; namespace kuzu { @@ -14,7 +16,9 @@ bool DBFileID::operator==(const DBFileID& rhs) const { return nodeIndexID == rhs.nodeIndexID; } default: { - throw common::NotImplementedException("DBFileID::operator=="); + // LCOV_EXCL_START + throw NotImplementedException("DBFileID::operator=="); + // LCOV_EXCL_END } } } @@ -31,7 +35,9 @@ std::string dbFileTypeToString(DBFileType dbFileType) { return "NODE_INDEX"; } default: { + // LCOV_EXCL_START throw NotImplementedException("dbFileTypeToString"); + // LCOV_EXCL_END } } } @@ -98,8 +104,10 @@ bool WALRecord::operator==(const WALRecord& rhs) const { return addPropertyRecord == rhs.addPropertyRecord; } default: { - throw common::RuntimeException("Unrecognized WAL record type inside ==. recordType: " + - walRecordTypeToString(recordType)); + // LCOV_EXCL_START + throw NotImplementedException("Unrecognized WAL record type inside ==. recordType: " + + walRecordTypeToString(recordType)); + // LCOV_EXCL_END } } } @@ -143,7 +151,9 @@ std::string walRecordTypeToString(WALRecordType walRecordType) { return "DROP_PROPERTY_RECORD"; } default: { + // LCOV_EXCL_START throw NotImplementedException("walRecordTypeToString"); + // LCOV_EXCL_END } } } diff --git a/src/storage/wal_replayer.cpp b/src/storage/wal_replayer.cpp index 680b59e0c5..e52040cc4f 100644 --- a/src/storage/wal_replayer.cpp +++ b/src/storage/wal_replayer.cpp @@ -1,6 +1,7 @@ #include "storage/wal_replayer.h" #include "catalog/node_table_schema.h" +#include "common/exception/not_implemented.h" #include "common/exception/storage.h" #include "storage/storage_manager.h" #include "storage/storage_utils.h" @@ -315,7 +316,9 @@ void WALReplayer::replayDropTableRecord(const kuzu::storage::WALRecord& walRecor // TODO(Guodong): Do nothing for now. Should remove metaDA and reclaim free pages. } break; default: { - throw NotImplementedException{"WALReplayer::replayDropTableRecord"}; + // LCOV_EXCL_START + throw NotImplementedException("WALReplayer::replayDropTableRecord"); + // LCOV_EXCL_END } } } else { @@ -335,7 +338,9 @@ void WALReplayer::replayDropTableRecord(const kuzu::storage::WALRecord& walRecor // TODO(Guodong): Do nothing for now. Should remove metaDA and reclaim free pages. } break; default: { - throw NotImplementedException{"WALReplayer::replayDropTableRecord"}; + // LCOV_EXCL_START + throw NotImplementedException("WALReplayer::replayDropTableRecord"); + // LCOV_EXCL_END } } } @@ -362,7 +367,9 @@ void WALReplayer::replayDropPropertyRecord(const kuzu::storage::WALRecord& walRe // TODO(Guodong): Do nothing for now. Should remove metaDA and reclaim free pages. } break; default: { - throw NotImplementedException{"WALReplayer::replayDropPropertyRecord"}; + // LCOV_EXCL_START + throw NotImplementedException("WALReplayer::replayDropPropertyRecord"); + // LCOV_EXCL_END } } } else { @@ -378,7 +385,9 @@ void WALReplayer::replayDropPropertyRecord(const kuzu::storage::WALRecord& walRe // TODO(Guodong): Do nothing for now. Should remove metaDA and reclaim free pages. } break; default: { - throw NotImplementedException{"WALReplayer::replayDropPropertyRecord"}; + // LCOV_EXCL_START + throw NotImplementedException("WALReplayer::replayDropPropertyRecord"); + // LCOV_EXCL_END } } } @@ -398,7 +407,9 @@ void WALReplayer::replayAddPropertyRecord(const kuzu::storage::WALRecord& walRec case TableType::REL: { } break; default: { - throw NotImplementedException{"WALReplayer::replayDropPropertyRecord"}; + // LCOV_EXCL_START + throw NotImplementedException("WALReplayer::replayDropPropertyRecord"); + // LCOV_EXCL_END } } } else { @@ -414,7 +425,9 @@ void WALReplayer::replayAddPropertyRecord(const kuzu::storage::WALRecord& walRec // DO NOTHING. } break; default: { + // LCOV_EXCL_START throw NotImplementedException{"WALReplayer::replayDropPropertyRecord"}; + // LCOV_EXCL_END } } } @@ -430,7 +443,9 @@ void WALReplayer::replayAddPropertyRecord(const kuzu::storage::WALRecord& walRec tableSchema->getColumnID(propertyID)); } break; default: { + // LCOV_EXCL_START throw NotImplementedException{"WALReplayer::replayDropPropertyRecord"}; + // LCOV_EXCL_END } } } @@ -488,8 +503,10 @@ BMFileHandle* WALReplayer::getVersionedFileHandleIfWALVersionAndBMShouldBeCleare index->getFileHandle(); } default: + // LCOV_EXCL_START throw NotImplementedException( "WALReplayer::getVersionedFileHandleIfWALVersionAndBMShouldBeCleared"); + // LCOV_EXCL_END } } diff --git a/src/storage/wal_replayer_utils.cpp b/src/storage/wal_replayer_utils.cpp index ef0c3924a2..b73df5da55 100644 --- a/src/storage/wal_replayer_utils.cpp +++ b/src/storage/wal_replayer_utils.cpp @@ -1,6 +1,7 @@ #include "storage/wal_replayer_utils.h" #include "catalog/node_table_schema.h" +#include "common/exception/not_implemented.h" #include "storage/index/hash_index_builder.h" using namespace kuzu::catalog; diff --git a/src/transaction/transaction_context.cpp b/src/transaction/transaction_context.cpp index 6a77b3ba18..1e2679fd99 100644 --- a/src/transaction/transaction_context.cpp +++ b/src/transaction/transaction_context.cpp @@ -4,6 +4,7 @@ #include "common/exception/not_implemented.h" #include "common/exception/transaction_manager.h" #include "main/database.h" +#include "transaction/transaction_manager.h" using namespace kuzu::common; diff --git a/src/transaction/transaction_manager.cpp b/src/transaction/transaction_manager.cpp index 921a3df6fe..308dfc51db 100644 --- a/src/transaction/transaction_manager.cpp +++ b/src/transaction/transaction_manager.cpp @@ -1,5 +1,7 @@ #include "transaction/transaction_manager.h" +#include + #include "common/exception/transaction_manager.h" using namespace kuzu::common; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb2fcd732c..57698c9d6c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,9 @@ include(FetchContent) +# Disable WERROR for gtest +if(ENABLE_WERROR) + set(CMAKE_COMPILE_WARNING_AS_ERROR FALSE) +endif() FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git @@ -10,6 +14,9 @@ FetchContent_MakeAvailable(googletest) add_library(GTest::GTest INTERFACE IMPORTED) target_link_libraries(GTest::GTest INTERFACE gtest_main) target_link_libraries(GTest::GTest INTERFACE gmock_main) +if(ENABLE_WERROR) + set(CMAKE_COMPILE_WARNING_AS_ERROR TRUE) +endif() enable_testing() add_subdirectory(test_helper) diff --git a/test/c_api/connection_test.cpp b/test/c_api/connection_test.cpp index 7104155d76..e448c46d29 100644 --- a/test/c_api/connection_test.cpp +++ b/test/c_api/connection_test.cpp @@ -1,6 +1,9 @@ +#include + #include "c_api_test/c_api_test.h" using ::testing::Test; +using namespace kuzu::main; using namespace kuzu::testing; class CApiConnectionTest : public CApiTest { diff --git a/test/c_api/data_type_test.cpp b/test/c_api/data_type_test.cpp index d424410aa3..c44218ca63 100644 --- a/test/c_api/data_type_test.cpp +++ b/test/c_api/data_type_test.cpp @@ -1,5 +1,7 @@ -#include "c_api_test/c_api_test.h" -using namespace kuzu::main; +#include "c_api/kuzu.h" +#include "common/types/types.h" +#include "gtest/gtest.h" + using namespace kuzu::common; TEST(CApiDataTypeTest, Create) { diff --git a/test/c_api/database_test.cpp b/test/c_api/database_test.cpp index 4100eb7a8b..9cfa8a0897 100644 --- a/test/c_api/database_test.cpp +++ b/test/c_api/database_test.cpp @@ -1,4 +1,9 @@ -#include "c_api_test/c_api_test.h" +#include "c_api/kuzu.h" +#include "graph_test/api_graph_test.h" +#include "gtest/gtest.h" + +using namespace kuzu::main; +using namespace kuzu::testing; class CApiDatabaseTest : public APIEmptyDBTest { public: diff --git a/test/c_api/flat_tuple_test.cpp b/test/c_api/flat_tuple_test.cpp index c3afb2515b..bdc7c48ab8 100644 --- a/test/c_api/flat_tuple_test.cpp +++ b/test/c_api/flat_tuple_test.cpp @@ -1,6 +1,8 @@ #include "c_api_test/c_api_test.h" + using namespace kuzu::common; using namespace kuzu::main; +using namespace kuzu::testing; class CApiFlatTupleTest : public CApiTest { public: diff --git a/test/c_api/prepared_statement_test.cpp b/test/c_api/prepared_statement_test.cpp index c891493a06..fdc29c6cec 100644 --- a/test/c_api/prepared_statement_test.cpp +++ b/test/c_api/prepared_statement_test.cpp @@ -1,5 +1,8 @@ #include "c_api_test/c_api_test.h" +using namespace kuzu::main; +using namespace kuzu::testing; + class CApiPreparedStatementTest : public CApiTest { public: std::string getInputDir() override { diff --git a/test/c_api/query_result_test.cpp b/test/c_api/query_result_test.cpp index 35bc0fedc2..913e1807c3 100644 --- a/test/c_api/query_result_test.cpp +++ b/test/c_api/query_result_test.cpp @@ -5,6 +5,7 @@ using namespace kuzu::main; using namespace kuzu::common; using namespace kuzu::processor; +using namespace kuzu::testing; class CApiQueryResultTest : public CApiTest { public: diff --git a/test/c_api/value_test.cpp b/test/c_api/value_test.cpp index 87b965ed27..209fc37d8d 100644 --- a/test/c_api/value_test.cpp +++ b/test/c_api/value_test.cpp @@ -1,6 +1,8 @@ #include "c_api_test/c_api_test.h" + using namespace kuzu::main; using namespace kuzu::common; +using namespace kuzu::testing; class CApiValueTest : public CApiTest { public: diff --git a/test/common/date_test.cpp b/test/common/date_test.cpp index be6ef784a3..e13979c204 100644 --- a/test/common/date_test.cpp +++ b/test/common/date_test.cpp @@ -1,5 +1,3 @@ -#include - #include "common/types/date_t.h" #include "gtest/gtest.h" diff --git a/test/common/time_test.cpp b/test/common/time_test.cpp index 795b8794ba..e2b54fdf7c 100644 --- a/test/common/time_test.cpp +++ b/test/common/time_test.cpp @@ -1,8 +1,5 @@ -#include - #include "common/exception/conversion.h" -#include "common/exception/test.h" -#include "common/types/timestamp_t.h" +#include "common/types/dtime_t.h" #include "gtest/gtest.h" using namespace kuzu::common; diff --git a/test/common/timestamp_test.cpp b/test/common/timestamp_test.cpp index de877b3f37..63979f0c36 100644 --- a/test/common/timestamp_test.cpp +++ b/test/common/timestamp_test.cpp @@ -1,5 +1,3 @@ -#include - #include "common/exception/conversion.h" #include "common/types/date_t.h" #include "common/types/timestamp_t.h" diff --git a/test/graph_test/base_graph_test.cpp b/test/graph_test/base_graph_test.cpp index 21e3b058b3..ea7cc7e7de 100644 --- a/test/graph_test/base_graph_test.cpp +++ b/test/graph_test/base_graph_test.cpp @@ -1,11 +1,12 @@ #include "graph_test/base_graph_test.h" -#include "binder/binder.h" +#include + #include "common/string_format.h" #include "spdlog/spdlog.h" -using ::testing::Test; using namespace kuzu::common; +using namespace kuzu::main; namespace kuzu { namespace testing { diff --git a/test/graph_test/graph_test.cpp b/test/graph_test/graph_test.cpp index 2fc2b950ad..fb6b74d016 100644 --- a/test/graph_test/graph_test.cpp +++ b/test/graph_test/graph_test.cpp @@ -2,10 +2,14 @@ #include "binder/binder.h" #include "parser/parser.h" +#include "planner/operator/logical_plan_util.h" +#include "planner/planner.h" #include "spdlog/spdlog.h" #include "storage/storage_manager.h" +#include "transaction/transaction_manager.h" using ::testing::Test; +using namespace kuzu::binder; using namespace kuzu::catalog; using namespace kuzu::common; using namespace kuzu::planner; diff --git a/test/include/c_api_test/c_api_test.h b/test/include/c_api_test/c_api_test.h index 6ebcdb1077..399cd67d7c 100644 --- a/test/include/c_api_test/c_api_test.h +++ b/test/include/c_api_test/c_api_test.h @@ -1,17 +1,10 @@ #pragma once -#include - #include "c_api/kuzu.h" -#include "common/file_utils.h" #include "graph_test/api_graph_test.h" -#include "gtest/gtest.h" -#include "main/kuzu.h" -#include "parser/parser.h" -#include "test_helper/test_helper.h" -using ::testing::Test; -using namespace kuzu::testing; +namespace kuzu { +namespace testing { class CApiTest : public APIDBTest { public: @@ -44,3 +37,6 @@ class CApiTest : public APIDBTest { APIDBTest::TearDown(); } }; + +} // namespace testing +} // namespace kuzu diff --git a/test/include/graph_test/api_graph_test.h b/test/include/graph_test/api_graph_test.h index da899e9349..994a8a07ba 100644 --- a/test/include/graph_test/api_graph_test.h +++ b/test/include/graph_test/api_graph_test.h @@ -1,12 +1,8 @@ #pragma once -#include - #include "graph_test/base_graph_test.h" #include "main/kuzu.h" -using ::testing::Test; - namespace kuzu { namespace testing { diff --git a/test/include/graph_test/base_graph_test.h b/test/include/graph_test/base_graph_test.h index c6b50e8677..286b962a23 100644 --- a/test/include/graph_test/base_graph_test.h +++ b/test/include/graph_test/base_graph_test.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "common/file_utils.h" #include "common/string_format.h" #include "gtest/gtest.h" diff --git a/test/include/graph_test/graph_test.h b/test/include/graph_test/graph_test.h index f160a9759b..ef8c5322ea 100644 --- a/test/include/graph_test/graph_test.h +++ b/test/include/graph_test/graph_test.h @@ -1,18 +1,8 @@ -#include - -#include "common/file_utils.h" #include "graph_test/base_graph_test.h" -#include "gtest/gtest.h" #include "main/kuzu.h" -#include "parser/parser.h" -#include "planner/operator/logical_plan_util.h" -#include "planner/planner.h" -#include "test_helper/test_helper.h" #include "test_runner/test_runner.h" #include "transaction/transaction_context.h" -using ::testing::Test; - namespace kuzu { namespace testing { diff --git a/test/include/main_test_helper/main_test_helper.h b/test/include/main_test_helper/main_test_helper.h index 43f8ad6b59..8d07ba5ed8 100644 --- a/test/include/main_test_helper/main_test_helper.h +++ b/test/include/main_test_helper/main_test_helper.h @@ -1,7 +1,6 @@ #pragma once #include "graph_test/base_graph_test.h" -#include "json.hpp" namespace kuzu { namespace testing { @@ -20,7 +19,7 @@ class ApiTest : public BaseGraphTest { return TestHelper::appendKuzuRootPath("dataset/tinysnb/"); } - static void assertMatchPersonCountStar(Connection* conn) { + static void assertMatchPersonCountStar(main::Connection* conn) { auto result = conn->query("MATCH (a:person) RETURN COUNT(*)"); ASSERT_TRUE(result->hasNext()); auto tuple = result->getNext(); @@ -28,7 +27,7 @@ class ApiTest : public BaseGraphTest { ASSERT_FALSE(result->hasNext()); } - static void executeLongRunningQuery(Connection* conn) { + static void executeLongRunningQuery(main::Connection* conn) { auto result = conn->query("MATCH (a:person)-[:knows*1..28]->(b:person) RETURN COUNT(*)"); ASSERT_FALSE(result->isSuccess()); ASSERT_EQ(result->getErrorMessage(), "Interrupted."); diff --git a/test/include/main_test_helper/private_main_test_helper.h b/test/include/main_test_helper/private_main_test_helper.h index 0b5de6e1c7..edff4223d3 100644 --- a/test/include/main_test_helper/private_main_test_helper.h +++ b/test/include/main_test_helper/private_main_test_helper.h @@ -1,7 +1,6 @@ #pragma once #include "graph_test/graph_test.h" -#include "json.hpp" namespace kuzu { namespace testing { @@ -20,7 +19,7 @@ class PrivateApiTest : public DBTest { return TestHelper::appendKuzuRootPath("dataset/tinysnb/"); } - static void assertMatchPersonCountStar(Connection* conn) { + static void assertMatchPersonCountStar(main::Connection* conn) { auto result = conn->query("MATCH (a:person) RETURN COUNT(*)"); ASSERT_TRUE(result->hasNext()); auto tuple = result->getNext(); @@ -28,7 +27,7 @@ class PrivateApiTest : public DBTest { ASSERT_FALSE(result->hasNext()); } - static void executeLongRunningQuery(Connection* conn) { + static void executeLongRunningQuery(main::Connection* conn) { auto result = conn->query("MATCH (a:person)-[:knows*1..28]->(b:person) RETURN COUNT(*)"); ASSERT_FALSE(result->isSuccess()); ASSERT_EQ(result->getErrorMessage(), "Interrupted."); diff --git a/test/include/test_helper/test_helper.h b/test/include/test_helper/test_helper.h index 1cc69c0592..5e4811e377 100644 --- a/test/include/test_helper/test_helper.h +++ b/test/include/test_helper/test_helper.h @@ -1,11 +1,7 @@ #pragma once -#include - #include "main/kuzu.h" -using namespace kuzu::main; - namespace kuzu { namespace testing { @@ -35,9 +31,9 @@ class TestHelper { const std::string& path, bool checkOutputOrder = false); static std::vector convertResultToString( - QueryResult& queryResult, bool checkOutputOrder = false); + main::QueryResult& queryResult, bool checkOutputOrder = false); - static void executeScript(const std::string& path, Connection& conn); + static void executeScript(const std::string& path, main::Connection& conn); static std::string getTestListFile() { return appendKuzuRootPath(std::string(E2E_TEST_FILES_DIRECTORY) + "/test_list"); @@ -50,7 +46,7 @@ class TestHelper { static std::string getMillisecondsSuffix(); private: - static void initializeConnection(TestQueryConfig* config, Connection& conn); + static void initializeConnection(TestQueryConfig* config, main::Connection& conn); }; } // namespace testing diff --git a/test/include/test_runner/csv_to_parquet_converter.h b/test/include/test_runner/csv_to_parquet_converter.h index 2f3708d8ad..9a2fe67114 100644 --- a/test/include/test_runner/csv_to_parquet_converter.h +++ b/test/include/test_runner/csv_to_parquet_converter.h @@ -1,4 +1,6 @@ -#include "main/kuzu.h" +#include +#include +#include namespace kuzu { namespace testing { diff --git a/test/include/test_runner/test_group.h b/test/include/test_runner/test_group.h index f8da7ca743..7d397c4096 100644 --- a/test/include/test_runner/test_group.h +++ b/test/include/test_runner/test_group.h @@ -1,8 +1,13 @@ #pragma once + +#include #include #include +#include +#include +#include -#include "main/kuzu.h" +#include "common/constants.h" namespace kuzu { namespace testing { diff --git a/test/include/test_runner/test_parser.h b/test/include/test_runner/test_parser.h index 413f0cb94a..14d82a10e3 100644 --- a/test/include/test_runner/test_parser.h +++ b/test/include/test_runner/test_parser.h @@ -1,9 +1,7 @@ -#include #include #include #include "common/exception/test.h" -#include "common/file_utils.h" #include "test_runner/test_group.h" namespace kuzu { diff --git a/test/include/test_runner/test_runner.h b/test/include/test_runner/test_runner.h index f0d32dfbaa..e68f018d3b 100644 --- a/test/include/test_runner/test_runner.h +++ b/test/include/test_runner/test_runner.h @@ -1,10 +1,6 @@ #pragma once -#include "common/file_utils.h" -#include "gtest/gtest.h" -#include "parser/parser.h" -#include "planner/operator/logical_plan_util.h" -#include "planner/planner.h" +#include "main/connection.h" #include "test_runner/test_group.h" namespace kuzu { diff --git a/test/main/config_test.cpp b/test/main/config_test.cpp index 6094da038a..9dc0dd19cf 100644 --- a/test/main/config_test.cpp +++ b/test/main/config_test.cpp @@ -1,6 +1,7 @@ #include "main_test_helper/main_test_helper.h" using namespace kuzu::common; +using namespace kuzu::main; using namespace kuzu::testing; TEST_F(ApiTest, ClientConfig) { diff --git a/test/main/connection_test.cpp b/test/main/connection_test.cpp index 8b5992b1e6..c933c7c670 100644 --- a/test/main/connection_test.cpp +++ b/test/main/connection_test.cpp @@ -7,6 +7,7 @@ #include "main_test_helper/main_test_helper.h" using namespace kuzu::common; +using namespace kuzu::main; using namespace kuzu::testing; TEST_F(ApiTest, BasicConnect) { diff --git a/test/main/storage_driver_test.cpp b/test/main/storage_driver_test.cpp index 1ab5816ef4..5ee9df3a18 100644 --- a/test/main/storage_driver_test.cpp +++ b/test/main/storage_driver_test.cpp @@ -1,6 +1,7 @@ #include "main/storage_driver.h" #include "main_test_helper/main_test_helper.h" +using namespace kuzu::main; using namespace kuzu::testing; using namespace kuzu::common; diff --git a/test/runner/e2e_copy_transaction_test.cpp b/test/runner/e2e_copy_transaction_test.cpp index bcb0dd0c45..1fd4f1d9f8 100644 --- a/test/runner/e2e_copy_transaction_test.cpp +++ b/test/runner/e2e_copy_transaction_test.cpp @@ -1,11 +1,13 @@ #include +#include "binder/bound_statement_result.h" #include "graph_test/graph_test.h" #include "processor/plan_mapper.h" #include "processor/processor.h" using namespace kuzu::catalog; using namespace kuzu::common; +using namespace kuzu::main; using namespace kuzu::processor; using namespace kuzu::storage; using namespace kuzu::testing; diff --git a/test/runner/e2e_ddl_test.cpp b/test/runner/e2e_ddl_test.cpp index 54465e998d..f81c7a3542 100644 --- a/test/runner/e2e_ddl_test.cpp +++ b/test/runner/e2e_ddl_test.cpp @@ -1,3 +1,4 @@ +#include "binder/bound_statement_result.h" #include "common/string_format.h" #include "graph_test/graph_test.h" #include "processor/plan_mapper.h" diff --git a/test/storage/CMakeLists.txt b/test/storage/CMakeLists.txt index e149e8fbf2..0f76e7c082 100644 --- a/test/storage/CMakeLists.txt +++ b/test/storage/CMakeLists.txt @@ -1,3 +1,2 @@ -#add_kuzu_test(disk_array_update_test disk_array_update_test.cpp) add_kuzu_test(node_insertion_deletion_test node_insertion_deletion_test.cpp) add_kuzu_test(compression_test compression_test.cpp) diff --git a/test/storage/compression_test.cpp b/test/storage/compression_test.cpp index 0ff4c69cb6..fff580791f 100644 --- a/test/storage/compression_test.cpp +++ b/test/storage/compression_test.cpp @@ -1,6 +1,5 @@ #include "gtest/gtest.h" #include "storage/store/compression.h" -#include using namespace kuzu::common; using namespace kuzu::storage; diff --git a/test/storage/disk_array_update_test.cpp b/test/storage/disk_array_update_test.cpp deleted file mode 100644 index ebf11d6f9d..0000000000 --- a/test/storage/disk_array_update_test.cpp +++ /dev/null @@ -1,327 +0,0 @@ -#include "graph_test/graph_test.h" - -using namespace kuzu::common; -using namespace kuzu::storage; -using namespace kuzu::testing; - -// TODO(Guodong): the current disk array update test relies on unstructured property which -// has been removed in the recent PRs. - -// Tests the core update functionality of DiskArray and InMemDiskArray. Specifically tests that -// updates to DiskArrays happen transactionally. The tests use ListHeaders, which consists of a -// single DiskArray as a wrapper. This is required and we cannot (easily) write tests that directly -// update the disk array and then checkpoint manually, and check that we obtain the correct version. -// The updates we perform on the list do not correspond to a real update that would happen on the -// database. -class BaseDiskArrayUpdateTests : public DBTest { - -public: - void SetUp() override { - DBTest::SetUp(); - initWithoutLoadingGraph(); - } - - void initWithoutLoadingGraph() { - createDBAndConn(); - auto personTableID = - getCatalog(*database)->getReadOnlyVersion()->getNodeTableIDFromName("person"); - personNodeTable = getStorageManager(*database)->getNodesStore().getNodeTable(personTableID); - conn->beginWriteTransaction(); - } - - // This function is necessary to call to trigger the checkpoint/rollback mechanism of the - // database: since we are using list_headers as a wrapper around the headerDA DiskArray, which - // we use as our DiskArray in these tests, a call to set the property list of nodeOffset to - // empty will trigger the following: the UnstructuredPropertyLists will have an "update"; then - // this will trigger UnstructuredPropertyLists to add itself to - // wal->addToUpdatedUnstructuredPropertyLists when prepareCommitOrRollbackIfNecessary called; - // then the WALReplayer will call checkpoint/rollbackInMemory on this UnstructuredPropertyLists; - // finally UnstructuredPropertyLists will call headerDA->checkpoint/rollbackInMemoryIfNecessary. - void setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism() { - personNodeTable->getUnstrPropertyLists()->initEmptyPropertyLists(0); - } - - void testBasicUpdate(bool isCommit, TransactionTestType transactionTestType) { - setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism(); - // This is a simple test to test where we change each element i in a disk array with - // value i and the verify that we are able to do this transactionally. - auto headersDA = - personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - // Warning: We are explicitly assuming here that page_idx_t is uint32_t. If this changes, - // this test might break. - for (uint32_t nodeOffset = 0; nodeOffset <= 999; ++nodeOffset) { - headersDA->update(nodeOffset, nodeOffset); - } - - // We first test that read and write trxs can read different values from a disk array. - for (uint32_t nodeOffset = 0; nodeOffset <= 999; ++nodeOffset) { - ASSERT_EQ(0, headersDA->get(nodeOffset, TransactionType::READ_ONLY)); - ASSERT_EQ(nodeOffset, headersDA->get(nodeOffset, TransactionType::WRITE)); - } - - commitOrRollbackConnectionAndInitDBIfNecessary(isCommit, transactionTestType); - headersDA = personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - if (isCommit) { - for (node_offset_t nodeOffset = 0; nodeOffset <= 999; ++nodeOffset) { - ASSERT_EQ(nodeOffset, headersDA->get(nodeOffset, TransactionType::READ_ONLY)); - ASSERT_EQ(nodeOffset, headersDA->get(nodeOffset, TransactionType::WRITE)); - } - } else { - for (node_offset_t nodeOffset = 0; nodeOffset <= 999; ++nodeOffset) { - ASSERT_EQ(0, headersDA->get(nodeOffset, TransactionType::READ_ONLY)); - ASSERT_EQ(0, headersDA->get(nodeOffset, TransactionType::WRITE)); - } - } - } - - void testBasicPushBack(bool isCommit, TransactionTestType transactionTestType) { - setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism(); - auto headersDA = - personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - headersDA->pushBack(1234); - ASSERT_EQ(1000, headersDA->getNumElements(TransactionType::READ_ONLY)); - try { - headersDA->get(1000, TransactionType::READ_ONLY); - FAIL(); - } catch (exception& e) {} - ASSERT_EQ(1001, headersDA->getNumElements(TransactionType::WRITE)); - ASSERT_EQ(1234, headersDA->get(1000, TransactionType::WRITE)); - try { - headersDA->get(1001, TransactionType::WRITE); - FAIL(); - } catch (exception& e) {} - - commitOrRollbackConnectionAndInitDBIfNecessary(isCommit, transactionTestType); - - headersDA = personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - if (isCommit) { - ASSERT_EQ(1001, headersDA->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(1001, headersDA->getNumElements(TransactionType::WRITE)); - ASSERT_EQ(1234, headersDA->get(1000, TransactionType::READ_ONLY)); - ASSERT_EQ(1234, headersDA->get(1000, TransactionType::WRITE)); - } else { - ASSERT_EQ(1000, headersDA->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(1000, headersDA->getNumElements(TransactionType::WRITE)); - } - } - - void testPushBack( - uint64_t sizeAfterPushing, bool isCommit, TransactionTestType transactionTestType) { - setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism(); - auto headersDA = - personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - auto oldNumPages = headersDA->getFileHandle()->getNumPages(); - uint64_t prevNumElements = headersDA->getNumElements(TransactionType::READ_ONLY); - for (int arrayOff = prevNumElements; arrayOff < sizeAfterPushing; ++arrayOff) { - headersDA->pushBack(arrayOff); - } - ASSERT_EQ(prevNumElements, headersDA->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(sizeAfterPushing, headersDA->getNumElements(TransactionType::WRITE)); - for (int arrayOff = prevNumElements; arrayOff < sizeAfterPushing; ++arrayOff) { - ASSERT_EQ(arrayOff, headersDA->get(arrayOff, TransactionType::WRITE)); - } - commitOrRollbackConnectionAndInitDBIfNecessary(isCommit, transactionTestType); - headersDA = personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - - if (isCommit) { - ASSERT_EQ(sizeAfterPushing, headersDA->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(sizeAfterPushing, headersDA->getNumElements(TransactionType::WRITE)); - for (int arrayOff = prevNumElements; arrayOff < sizeAfterPushing; ++arrayOff) { - ASSERT_EQ(arrayOff, headersDA->get(arrayOff, TransactionType::READ_ONLY)); - ASSERT_EQ(arrayOff, headersDA->get(arrayOff, TransactionType::WRITE)); - } - } else { - ASSERT_EQ(oldNumPages, headersDA->getFileHandle()->getNumPages()); - ASSERT_EQ(prevNumElements, headersDA->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(prevNumElements, headersDA->getNumElements(TransactionType::WRITE)); - } - } - - void testTwoPushBackBatches(bool isCommit, TransactionTestType transactionTestType, - uint64_t sizeAfterPushingFirstPhase) { - setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism(); - uint64_t sizeAfterPushing = sizeAfterPushingFirstPhase; - testPushBack(sizeAfterPushing, isCommit, transactionTestType); - if (isCommit) { - // If we have committed. We do another test and push back some more data (1 element - // to be exact) and test that we can get read/write visibility correctly. - sizeAfterPushing++; - testPushBack(sizeAfterPushing, isCommit, transactionTestType); - } - } - -public: - NodeTable* personNodeTable; -}; - -class DiskArrayUpdateTests : public BaseDiskArrayUpdateTests { - -public: - string getInputDir() override { return "dataset/non-empty-disk-array-db/"; } -}; - -class DiskArrayUpdateEmptyDBTests : public BaseDiskArrayUpdateTests { - -public: - string getInputDir() override { return "dataset/empty-db/"; } -}; - -TEST_F(DiskArrayUpdateTests, BasicUpdateTestCommitNormalExecution) { - testBasicUpdate(true /* is commit */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, BasicUpdateTestCommitRecovery) { - testBasicUpdate(true /* is commit */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, BasicUpdateTestRollbackNormalExecution) { - testBasicUpdate(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, BasicUpdateTestRollbackRecovery) { - testBasicUpdate(false /* is rollback */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, BasicPushBackTestCommitNormalExecution) { - testBasicPushBack(true /* is commit */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, BasicPushBackTestCommitRecovery) { - testBasicPushBack(true /* is commit */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, BasicPushBackTestRollbackNormalExecution) { - testBasicPushBack(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, BasicPushBackTestRollbackRecovery) { - testBasicPushBack(false /* is rollback */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewAPTestCommitNormalExecution) { - testPushBack(1025, true /* is commit */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewAPTestCommitRecovery) { - testPushBack(1025, true /* is commit */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewAPTestRollbackNormalExecution) { - testPushBack(1025, false /* is rollback */, TransactionTestType::NORMAL_EXECUTION); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewAPTestRollbackRecovery) { - testPushBack(1025, false /* is rollback */, TransactionTestType::RECOVERY); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewPIPTestCommitNormalExecution) { - // 1023*1024 + 1 requires adding a new PIP in the first batch. - testTwoPushBackBatches(true /* is commit */, TransactionTestType::NORMAL_EXECUTION, - 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewPIPTestCommitRecovery) { - testTwoPushBackBatches(true /* is commit */, TransactionTestType::RECOVERY, - 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewPIPTestRollbackNormalExecution) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION, - 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddNewPIPTestRollbackRecovery) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::RECOVERY, - 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillOnePIPTestCommitNormalExecution) { - // 1023*1024 fills an entire PIP in the first batch. - testTwoPushBackBatches(true /* is commit */, TransactionTestType::NORMAL_EXECUTION, - 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillOnePIPTestCommitRecovery) { - testTwoPushBackBatches(true /* is commit */, TransactionTestType::RECOVERY, - 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillOnePIPTestRollbackNormalExecution) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION, - 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillOnePIPTestRollbackRecovery) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::RECOVERY, - 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddTwoNewPIPsTestCommitNormalExecution) { - // 2*1023*1024 + 1 requires adding two new PIPs in the first batch. - testTwoPushBackBatches(true /* is commit */, TransactionTestType::NORMAL_EXECUTION, - 2 * 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddTwoNewPIPsTestCommitRecovery) { - testTwoPushBackBatches(true /* is commit */, TransactionTestType::RECOVERY, - 2 * 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddTwoNewPIPsTestRollbackNormalExecution) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION, - 2 * 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToAddTwoNewPIPsTestRollbackRecovery) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::RECOVERY, - 2 * 1023 * 1024 + 1 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillTwoPIPsTestCommitNormalExecution) { - // 2*1023*1024 fills an entire PIP in the first batch. - testTwoPushBackBatches(true /* is commit */, TransactionTestType::NORMAL_EXECUTION, - 2 * 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillTwoPIPsTestCommitRecovery) { - testTwoPushBackBatches(true /* is commit */, TransactionTestType::RECOVERY, - 2 * 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillTwoPIPsTestRollbackNormalExecution) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::NORMAL_EXECUTION, - 2 * 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateTests, PushBackEnoughToFillTwoPIPsTestRollbackRecovery) { - testTwoPushBackBatches(false /* is rollback */, TransactionTestType::RECOVERY, - 2 * 1023 * 1024 /* size after first batch */); -} - -TEST_F(DiskArrayUpdateEmptyDBTests, EmptyDiskArrayUpdatesTest) { - auto headers = personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - ASSERT_EQ(0, headers->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(0, headers->getNumElements(TransactionType::WRITE)); - - // First test that we cannot update to 0th location, which doesn't exist. - try { - headers->update(0, 1234); - FAIL(); - } catch (exception& e) {} - setNodeOffset0ToEmptyListToTriggerCheckpointOrRecoveryMechanism(); - // In an ideal test, we should test that the WRITE and READ_ONLY transactions read different - // values (e.g., WRITE sees a numElements of 1 and READ_ONLY sees 0). However we cannot do that - // test here because unstructured property lists do not update the header until during - // committing. Instead currently it accumulates all updates in its local - // UnstructuredListUpdateStore. So even if we read the header's size for WRITE transaction, we - // would read 0 before committing. So the only thing we can test is that after the commit, both - // READ and WRITE sees a header with size 1 and headers[0] = 0 (which is the header empty lists - // get). - commitOrRollbackConnectionAndInitDBIfNecessary( - true /* is commit */, TransactionTestType::NORMAL_EXECUTION); - headers = personNodeTable->getUnstrPropertyLists()->getHeaders()->headersDiskArray.get(); - ASSERT_EQ(1, headers->getNumElements(TransactionType::READ_ONLY)); - ASSERT_EQ(1, headers->getNumElements(TransactionType::WRITE)); - ASSERT_EQ(0, headers->get(0, TransactionType::READ_ONLY)); - ASSERT_EQ(0, headers->get(0, TransactionType::WRITE)); -} diff --git a/test/storage/node_insertion_deletion_test.cpp b/test/storage/node_insertion_deletion_test.cpp index 0eeb0bda9f..0d83a58962 100644 --- a/test/storage/node_insertion_deletion_test.cpp +++ b/test/storage/node_insertion_deletion_test.cpp @@ -1,8 +1,7 @@ #include "graph_test/graph_test.h" -#include "storage/storage_manager.h" -#include "storage/wal_replayer.h" using namespace kuzu::common; +using namespace kuzu::main; using namespace kuzu::storage; using namespace kuzu::testing; diff --git a/test/test_helper/test_helper.cpp b/test/test_helper/test_helper.cpp index 0fc07323ee..6183201502 100644 --- a/test/test_helper/test_helper.cpp +++ b/test/test_helper/test_helper.cpp @@ -3,7 +3,6 @@ #include #include -#include "json.hpp" #include "spdlog/spdlog.h" using namespace kuzu::common; diff --git a/test/test_runner/csv_to_parquet_converter.cpp b/test/test_runner/csv_to_parquet_converter.cpp deleted file mode 100644 index 48e56be7c7..0000000000 --- a/test/test_runner/csv_to_parquet_converter.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "test_runner/csv_to_parquet_converter.h" - -#include - -#include "common/exception/test.h" -#include "common/file_utils.h" -#include "common/string_format.h" -#include "common/string_utils.h" -#include "spdlog/spdlog.h" -#include "test_helper/test_helper.h" -#include -#include -#include -#include -#include - -using namespace kuzu::common; - -namespace kuzu { -namespace testing { - -arrow::Status CSVToParquetConverter::runCSVToParquetConversion( - const std::string& inputFile, const std::string& outputFile, char delimiter, bool hasHeader) { - std::shared_ptr outFileStream; - std::shared_ptr infile; - std::shared_ptr csvTable; - ARROW_ASSIGN_OR_RAISE(infile, arrow::io::ReadableFile::Open(inputFile)) - auto readOptions = arrow::csv::ReadOptions::Defaults(); - auto parseOptions = arrow::csv::ParseOptions::Defaults(); - readOptions.autogenerate_column_names = !hasHeader; - parseOptions.delimiter = delimiter; - ARROW_ASSIGN_OR_RAISE( - auto csvReader, arrow::csv::TableReader::Make(arrow::io::default_io_context(), infile, - readOptions, parseOptions, arrow::csv::ConvertOptions::Defaults())) - ARROW_ASSIGN_OR_RAISE(csvTable, csvReader->Read()) - ARROW_ASSIGN_OR_RAISE(outFileStream, arrow::io::FileOutputStream::Open(outputFile)) - PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable( - *csvTable, arrow::default_memory_pool(), outFileStream, csvTable->num_rows())); - return arrow::Status::OK(); -} - -void CSVToParquetConverter::copySchema( - const std::string& csvDatasetPath, const std::string& parquetDatasetPath) { - auto parquetSchemaFile = - FileUtils::joinPath(parquetDatasetPath, std::string(TestHelper::SCHEMA_FILE_NAME)); - FileUtils::copyFile(FileUtils::joinPath(csvDatasetPath, "schema.cypher"), - FileUtils::joinPath(parquetDatasetPath, "schema.cypher"), - std::filesystem::copy_options::overwrite_existing); -} - -CSVToParquetConverter::CopyCommandInfo CSVToParquetConverter::createCopyCommandInfo( - const std::string& parquetDatasetPath, std::string copyStatement) { - auto tokens = StringUtils::split(copyStatement, " "); - auto path = std::filesystem::path(StringUtils::extractStringBetween(tokens[3], '"', '"')); - CopyCommandInfo copyCommandInfo; - copyCommandInfo.table = tokens[1]; - copyCommandInfo.csvFilePath = TestHelper::appendKuzuRootPath(path.string()); - copyCommandInfo.parquetFilePath = parquetDatasetPath + "/" + path.stem().string() + ".parquet"; - std::transform(copyStatement.begin(), copyStatement.end(), copyStatement.begin(), - [](unsigned char c) { return std::tolower(c); }); - copyCommandInfo.csvHasHeader = (copyStatement.find("header=true") != std::string::npos); - std::size_t delimPos = copyStatement.find("delim='"); - copyCommandInfo.delimiter = (delimPos != std::string::npos) ? copyStatement[delimPos + 7] : ','; - return copyCommandInfo; -} - -std::vector -CSVToParquetConverter::readCopyCommandsFromCopyCypherFile( - const std::string& csvDatasetPath, const std::string& parquetDatasetPath) { - auto copyFile = FileUtils::joinPath(csvDatasetPath, TestHelper::COPY_FILE_NAME); - std::ifstream file(copyFile); - if (!file.is_open()) { - throw TestException(stringFormat("Error opening file: {}, errno: {}.", copyFile, errno)); - } - std::string line; - std::vector copyCommands; - while (getline(file, line)) { - copyCommands.push_back(createCopyCommandInfo(parquetDatasetPath, line)); - } - return copyCommands; -} - -void CSVToParquetConverter::createCopyFile(const std::string& parquetDatasetPath, - const std::vector& copyCommands) { - auto targetCopyCypherFile = FileUtils::joinPath(parquetDatasetPath, TestHelper::COPY_FILE_NAME); - std::ofstream outfile(targetCopyCypherFile); - if (!outfile.is_open()) { - throw TestException( - stringFormat("Error opening file: {}, errno: {}.", targetCopyCypherFile, errno)); - } - for (const auto& copyCommand : copyCommands) { - auto cmd = "COPY " + copyCommand.table + " FROM '" + copyCommand.parquetFilePath + "'"; - outfile << cmd << std::endl; - } -} - -void CSVToParquetConverter::convertCSVFilesToParquet( - const std::vector& copyCommands) { - for (auto copyCommand : copyCommands) { - if (!FileUtils::fileOrPathExists(copyCommand.parquetFilePath)) { - spdlog::info( - "CONVERTING: {} to {}", copyCommand.csvFilePath, copyCommand.parquetFilePath); - auto status = runCSVToParquetConversion(copyCommand.csvFilePath, - copyCommand.parquetFilePath, copyCommand.delimiter, copyCommand.csvHasHeader); - assert(status.ok()); - } - } -} - -std::string CSVToParquetConverter::convertCSVDatasetToParquet( - const std::string& csvDatasetPath, const std::string& parquetDatasetPath) { - FileUtils::createDirIfNotExists(parquetDatasetPath); - std::vector copyCommands = - readCopyCommandsFromCopyCypherFile(csvDatasetPath, parquetDatasetPath); - copySchema(csvDatasetPath, parquetDatasetPath); - createCopyFile(parquetDatasetPath, copyCommands); - convertCSVFilesToParquet(copyCommands); - return parquetDatasetPath; -} - -} // namespace testing -} // namespace kuzu diff --git a/test/test_runner/test_parser.cpp b/test/test_runner/test_parser.cpp index e658bc95fe..855ee2ed0e 100644 --- a/test/test_runner/test_parser.cpp +++ b/test/test_runner/test_parser.cpp @@ -2,6 +2,7 @@ #include +#include "common/file_utils.h" #include "common/string_utils.h" #include "test_helper/test_helper.h" diff --git a/test/test_runner/test_runner.cpp b/test/test_runner/test_runner.cpp index 9953147b15..c8a7d5079f 100644 --- a/test/test_runner/test_runner.cpp +++ b/test/test_runner/test_runner.cpp @@ -4,6 +4,8 @@ #include "common/exception/test.h" #include "common/string_utils.h" +#include "gtest/gtest.h" +#include "planner/operator/logical_plan.h" #include "spdlog/spdlog.h" #include "test_helper/test_helper.h" diff --git a/test/util_tests/string_format.cpp b/test/util_tests/string_format.cpp index 47d2b29207..b113be7a79 100644 --- a/test/util_tests/string_format.cpp +++ b/test/util_tests/string_format.cpp @@ -1,8 +1,6 @@ #include "common/string_format.h" -#include "common/enums/rel_direction.h" #include "common/exception/internal.h" -#include "common/types/internal_id_t.h" #include "gtest/gtest.h" using namespace kuzu::common; diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index f45fcecfe8..d095b117d3 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -1,12 +1,12 @@ -add_subdirectory(antlr4_runtime) add_subdirectory(antlr4_cypher) +add_subdirectory(antlr4_runtime) +add_subdirectory(fast_float) +add_subdirectory(fastpfor) add_subdirectory(glob) -add_subdirectory(utf8proc) +add_subdirectory(miniparquet) +add_subdirectory(miniz) add_subdirectory(pybind11) add_subdirectory(re2) add_subdirectory(serd) -add_subdirectory(fastpfor) -add_subdirectory(fast_float) -add_subdirectory(miniparquet) +add_subdirectory(utf8proc) add_subdirectory(zstd) -add_subdirectory(miniz) diff --git a/tools/benchmark/benchmark.cpp b/tools/benchmark/benchmark.cpp index 83f92eee40..4f6bb32ba2 100644 --- a/tools/benchmark/benchmark.cpp +++ b/tools/benchmark/benchmark.cpp @@ -1,12 +1,12 @@ #include "benchmark.h" -#include #include #include "spdlog/spdlog.h" #include "test_helper.h" using namespace kuzu::common; +using namespace kuzu::main; namespace kuzu { namespace benchmark { diff --git a/tools/java_api/src/jni/kuzu_java.cpp b/tools/java_api/src/jni/kuzu_java.cpp index 3649317404..07aea573a3 100644 --- a/tools/java_api/src/jni/kuzu_java.cpp +++ b/tools/java_api/src/jni/kuzu_java.cpp @@ -4,6 +4,7 @@ #include "binder/bound_statement_result.h" // This header is generated at build time. See CMakeLists.txt. #include "com_kuzudb_KuzuNative.h" +#include "common/exception/conversion.h" #include "common/exception/exception.h" #include "common/types/types.h" #include "common/types/value/nested.h" diff --git a/tools/shell/embedded_shell.cpp b/tools/shell/embedded_shell.cpp index e4204d39ba..ff0ce70f4e 100644 --- a/tools/shell/embedded_shell.cpp +++ b/tools/shell/embedded_shell.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "catalog/catalog.h" #include "common/string_utils.h"