![]() |
|
|||
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 #pragma once 0019 0020 #include <memory> 0021 0022 #include "arrow/csv/options.h" 0023 #include "arrow/io/interfaces.h" 0024 #include "arrow/ipc/type_fwd.h" 0025 #include "arrow/record_batch.h" 0026 #include "arrow/table.h" 0027 0028 namespace arrow { 0029 namespace csv { 0030 0031 // Functionality for converting Arrow data to Comma separated value text. 0032 // This library supports all primitive types that can be cast to a StringArray or 0033 // a LargeStringArray. 0034 // It applies to following formatting rules: 0035 // - For non-binary types no quotes surround values. Nulls are represented as the empty 0036 // string. 0037 // - For binary types all non-null data is quoted (and quotes within data are escaped 0038 // with an additional quote). 0039 // Null values are empty and unquoted. 0040 0041 /// \defgroup csv-write-functions High-level functions for writing CSV files 0042 /// @{ 0043 0044 /// \brief Convert table to CSV and write the result to output. 0045 /// Experimental 0046 ARROW_EXPORT Status WriteCSV(const Table& table, const WriteOptions& options, 0047 arrow::io::OutputStream* output); 0048 /// \brief Convert batch to CSV and write the result to output. 0049 /// Experimental 0050 ARROW_EXPORT Status WriteCSV(const RecordBatch& batch, const WriteOptions& options, 0051 arrow::io::OutputStream* output); 0052 /// \brief Convert batches read through a RecordBatchReader 0053 /// to CSV and write the results to output. 0054 /// Experimental 0055 ARROW_EXPORT Status WriteCSV(const std::shared_ptr<RecordBatchReader>& reader, 0056 const WriteOptions& options, 0057 arrow::io::OutputStream* output); 0058 0059 /// @} 0060 0061 /// \defgroup csv-writer-factories Functions for creating an incremental CSV writer 0062 /// @{ 0063 0064 /// \brief Create a new CSV writer. User is responsible for closing the 0065 /// actual OutputStream. 0066 /// 0067 /// \param[in] sink output stream to write to 0068 /// \param[in] schema the schema of the record batches to be written 0069 /// \param[in] options options for serialization 0070 /// \return Result<std::shared_ptr<RecordBatchWriter>> 0071 ARROW_EXPORT 0072 Result<std::shared_ptr<ipc::RecordBatchWriter>> MakeCSVWriter( 0073 std::shared_ptr<io::OutputStream> sink, const std::shared_ptr<Schema>& schema, 0074 const WriteOptions& options = WriteOptions::Defaults()); 0075 0076 /// \brief Create a new CSV writer. 0077 /// 0078 /// \param[in] sink output stream to write to (does not take ownership) 0079 /// \param[in] schema the schema of the record batches to be written 0080 /// \param[in] options options for serialization 0081 /// \return Result<std::shared_ptr<RecordBatchWriter>> 0082 ARROW_EXPORT 0083 Result<std::shared_ptr<ipc::RecordBatchWriter>> MakeCSVWriter( 0084 io::OutputStream* sink, const std::shared_ptr<Schema>& schema, 0085 const WriteOptions& options = WriteOptions::Defaults()); 0086 0087 /// @} 0088 0089 } // namespace csv 0090 } // namespace arrow
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |