Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ if(ARROW_CSV)
csv/options.cc
csv/parser.cc
csv/reader.cc)
if(ARROW_COMPUTE)
list(APPEND ARROW_SRCS csv/writer.cc)
endif()

list(APPEND ARROW_TESTING_SRCS csv/test_common.cc)
endif()
Expand Down
22 changes: 14 additions & 8 deletions cpp/src/arrow/csv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
# specific language governing permissions and limitations
# under the License.

add_arrow_test(csv-test
SOURCES
chunker_test.cc
column_builder_test.cc
column_decoder_test.cc
converter_test.cc
parser_test.cc
reader_test.cc)
set(CSV_TEST_SRCS
chunker_test.cc
column_builder_test.cc
column_decoder_test.cc
converter_test.cc
parser_test.cc
reader_test.cc)

# Writer depends on compute's cast functionality
if(ARROW_COMPUTE)
list(APPEND CSV_TEST_SRCS writer_test.cc)
endif()

add_arrow_test(csv-test SOURCES ${CSV_TEST_SRCS})

add_arrow_benchmark(converter_benchmark PREFIX "arrow-csv")
add_arrow_benchmark(parser_benchmark PREFIX "arrow-csv")
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/arrow/csv/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@

#include "arrow/csv/options.h"
#include "arrow/csv/reader.h"

// The writer depends on compute module for casting.
#ifdef ARROW_COMPUTE
#include "arrow/csv/writer.h"
#endif
1 change: 1 addition & 0 deletions cpp/src/arrow/csv/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ConvertOptions ConvertOptions::Defaults() {
}

ReadOptions ReadOptions::Defaults() { return ReadOptions(); }
WriteOptions WriteOptions::Defaults() { return WriteOptions(); }

} // namespace csv
} // namespace arrow
15 changes: 15 additions & 0 deletions cpp/src/arrow/csv/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,20 @@ struct ARROW_EXPORT ReadOptions {
static ReadOptions Defaults();
};

/// Experimental
struct ARROW_EXPORT WriteOptions {
/// Whether to write an initial header line with column names
bool include_header = true;

/// \brief Maximum number of rows processed at a time
///
/// The CSV writer converts and writes data in batches of N rows.
/// This number can impact performance.
int32_t batch_size = 1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively, this seems a bit low, but we can tune it later.


/// Create write options with default values
static WriteOptions Defaults();
};

} // namespace csv
} // namespace arrow
Loading