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

Method OpenCompressed

cpp/src/arrow/dataset/file_base.cc:110–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110Result<std::shared_ptr<io::InputStream>> FileSource::OpenCompressed(
111 std::optional<Compression::type> compression) const {
112 ARROW_ASSIGN_OR_RAISE(auto file, Open());
113 auto actual_compression = Compression::type::UNCOMPRESSED;
114 if (!compression.has_value()) {
115 // Guess compression from file extension
116 auto extension = fs::internal::GetAbstractPathExtension(path());
117 if (extension == "gz") {
118 actual_compression = Compression::type::GZIP;
119 } else {
120 auto maybe_compression = util::Codec::GetCompressionType(extension);
121 if (maybe_compression.ok()) {
122 ARROW_ASSIGN_OR_RAISE(actual_compression, maybe_compression);
123 }
124 }
125 } else {
126 actual_compression = compression.value();
127 }
128 if (actual_compression == Compression::type::UNCOMPRESSED) {
129 return file;
130 }
131 ARROW_ASSIGN_OR_RAISE(auto codec, util::Codec::Create(actual_compression));
132 return io::CompressedInputStream::Make(codec.get(), std::move(file));
133}
134
135bool FileSource::Equals(const FileSource& other) const {
136 bool match_file_system =

Callers 1

DoOpenReaderFunction · 0.80

Calls 6

GetAbstractPathExtensionFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
MakeFunction · 0.50
okMethod · 0.45
valueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected