MCPcopy Create free account
hub / github.com/apache/arrow / GetDatasetFromFile

Function GetDatasetFromFile

cpp/examples/arrow/dataset_parquet_scan_example.cc:112–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112arrow::Result<std::shared_ptr<ds::Dataset>> GetDatasetFromFile(
113 std::shared_ptr<fs::FileSystem> fs, std::shared_ptr<ds::ParquetFileFormat> format,
114 std::string file) {
115 ds::FileSystemFactoryOptions options;
116 // The factory will try to build a child dataset.
117 ARROW_ASSIGN_OR_RAISE(auto factory,
118 ds::FileSystemDatasetFactory::Make(fs, {file}, format, options));
119
120 // Try to infer a common schema for all files.
121 ARROW_ASSIGN_OR_RAISE(auto schema, factory->Inspect(conf.inspect_options));
122 // Caller can optionally decide another schema as long as it is compatible
123 // with the previous one, e.g. `factory->Finish(compatible_schema)`.
124 ARROW_ASSIGN_OR_RAISE(auto child, factory->Finish(conf.finish_options));
125
126 ds::DatasetVector children;
127 children.resize(conf.repeat, child);
128 return ds::UnionDataset::Make(std::move(schema), std::move(children));
129}
130
131arrow::Result<std::shared_ptr<ds::Dataset>> GetDatasetFromPath(
132 std::shared_ptr<fs::FileSystem> fs, std::shared_ptr<ds::ParquetFileFormat> format,

Callers 1

GetDatasetFromPathFunction · 0.85

Calls 2

resizeMethod · 0.80
MakeFunction · 0.50

Tested by

no test coverage detected