Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:26:57

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 // This API is EXPERIMENTAL.
0019 
0020 #pragma once
0021 
0022 #include <memory>
0023 #include <string>
0024 
0025 #include "arrow/dataset/file_base.h"
0026 #include "arrow/dataset/type_fwd.h"
0027 #include "arrow/dataset/visibility.h"
0028 #include "arrow/io/type_fwd.h"
0029 #include "arrow/result.h"
0030 
0031 namespace arrow {
0032 namespace dataset {
0033 
0034 /// \addtogroup dataset-file-formats
0035 ///
0036 /// @{
0037 
0038 constexpr char kOrcTypeName[] = "orc";
0039 
0040 /// \brief A FileFormat implementation that reads from and writes to ORC files
0041 class ARROW_DS_EXPORT OrcFileFormat : public FileFormat {
0042  public:
0043   OrcFileFormat();
0044 
0045   std::string type_name() const override { return kOrcTypeName; }
0046 
0047   bool Equals(const FileFormat& other) const override {
0048     return type_name() == other.type_name();
0049   }
0050 
0051   Result<bool> IsSupported(const FileSource& source) const override;
0052 
0053   /// \brief Return the schema of the file if possible.
0054   Result<std::shared_ptr<Schema>> Inspect(const FileSource& source) const override;
0055 
0056   Result<RecordBatchGenerator> ScanBatchesAsync(
0057       const std::shared_ptr<ScanOptions>& options,
0058       const std::shared_ptr<FileFragment>& file) const override;
0059 
0060   Future<std::optional<int64_t>> CountRows(
0061       const std::shared_ptr<FileFragment>& file, compute::Expression predicate,
0062       const std::shared_ptr<ScanOptions>& options) override;
0063 
0064   Result<std::shared_ptr<FileWriter>> MakeWriter(
0065       std::shared_ptr<io::OutputStream> destination, std::shared_ptr<Schema> schema,
0066       std::shared_ptr<FileWriteOptions> options,
0067       fs::FileLocator destination_locator) const override;
0068 
0069   std::shared_ptr<FileWriteOptions> DefaultWriteOptions() override;
0070 };
0071 
0072 /// @}
0073 
0074 }  // namespace dataset
0075 }  // namespace arrow