pitrou commented on a change in pull request #11350: URL: https://github.com/apache/arrow/pull/11350#discussion_r723927168
########## File path: cpp/src/arrow/compute/exec/tpch_test.cc ########## @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <arrow/api.h> Review comment: For the record, we try to avoid including the `api.h` headers in internal Arrow code, as they tend to blow up compile times. Instead, one should only include the strictly necessary. ########## File path: cpp/src/arrow/compute/exec/tpch_test.cc ########## @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <arrow/api.h> +#include <arrow/compute/api.h> +#include <arrow/compute/exec/exec_plan.h> +#include <arrow/csv/api.h> +#include <arrow/dataset/api.h> +#include <arrow/filesystem/api.h> +#include <arrow/io/api.h> +#include <arrow/io/compressed.h> +#include <arrow/ipc/api.h> +#include <arrow/pretty_print.h> +#include <arrow/result.h> +#include <arrow/status.h> +#include <arrow/table.h> +#include <arrow/util/iterator.h> +#include <arrow/util/logging.h> +#include <gmock/gmock-matchers.h> + +#include <iostream> + +namespace arrow { + +Result<std::shared_ptr<dataset::Dataset>> MakeDataset(const std::string& filename) { + auto fs = std::make_shared<fs::LocalFileSystem>(); + auto fs_dataset_options = arrow::dataset::FileSystemFactoryOptions(); + auto format = std::make_shared<arrow::dataset::IpcFileFormat>(); + ARROW_ASSIGN_OR_RAISE(auto dataset_factory, + arrow::dataset::FileSystemDatasetFactory::Make( + fs, {filename}, format, fs_dataset_options)); + auto finish_options = arrow::dataset::FinishOptions(); + finish_options.validate_fragments = false; + + auto inspect_options = arrow::dataset::InspectOptions(); + inspect_options.fragments = 1; + finish_options.inspect_options = inspect_options; + return dataset_factory->Finish(finish_options); +} + +Result<std::shared_ptr<dataset::ScanOptions>> DefaultOptions( + std::shared_ptr<dataset::Dataset> dataset) { + auto scanner_builder = std::make_shared<dataset::ScannerBuilder>(std::move(dataset)); + ARROW_RETURN_NOT_OK(scanner_builder->UseAsync(true)); + ARROW_RETURN_NOT_OK(scanner_builder->UseThreads(true)); + ARROW_ASSIGN_OR_RAISE(auto scanner, scanner_builder->Finish()); + return scanner->options(); +} + +Status RunMain() { + dataset::internal::Initialize(); + ARROW_ASSIGN_OR_RAISE( + auto line_items_dataset, + MakeDataset("~/tpch_repro/ARROW-14197-input/lineitem_1.uncompressed.feather")); + ARROW_ASSIGN_OR_RAISE(auto line_items_scan_opts, DefaultOptions(line_items_dataset)); + ARROW_ASSIGN_OR_RAISE( + auto orders_dataset, + MakeDataset("~/tpch_repro/ARROW-14197-input/orders_1.uncompressed.feather")); Review comment: Should these files go into https://github.com/apache/arrow-testing/ ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
