mpimenov commented on issue #40068:
URL: https://github.com/apache/arrow/issues/40068#issuecomment-1944285079
Dataset creation itself looks quite vanilla to me
```
std::vector<std::string> paths = FillPaths();
arrow::dataset::FileSystemFactoryOptions options;
options.partitioning = arrow::dataset::HivePartitioning::MakeFactory();
options.partition_base_dir = root_path;
options.exclude_invalid_files = true;
return arrow::dataset::FileSystemDatasetFactory::Make(
std::make_shared<arrow::fs::LocalFileSystem>(),
paths,
std::make_shared<arrow::dataset::ParquetFileFormat>(),
options
)
.ValueOrDie()
->Finish()
.ValueOrDie();
```
However, when reading it I do this (for filtering columns and such)
```
arrow::dataset::internal::Initialize();
std::vector<std::shared_ptr<arrow::Field>> fields;
for (const auto& i : dataset->schema()->fields()) {
if (options.fields_.empty() || contains(options.fields_, i->name())) {
fields.push_back(i);
}
}
dataset = dataset->ReplaceSchema(std::make_shared<arrow::Schema>(fields,
dataset->schema()->metadata())).ValueOrDie();
```
I don't know if this is idiomatic enough
--
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]