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

Method OpenCompressed

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

Source from the content-addressed store, hash-verified

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