Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Jan 2, 2019
1 parent 09187e6 commit 0ab8397
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion r/src/arrow_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#undef Free
#include <arrow/api.h>
#include <arrow/compute/api.h>
#include <arrow/csv/reader.h>
#include <arrow/io/file.h>
#include <arrow/io/memory.h>
#include <arrow/ipc/feather.h>
#include <arrow/ipc/reader.h>
#include <arrow/ipc/writer.h>
#include <arrow/type.h>
#include <arrow/csv/reader.h>

#define STOP_IF_NOT(TEST, MSG) \
do { \
Expand Down
35 changes: 22 additions & 13 deletions r/src/csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
using namespace Rcpp;

// [[Rcpp::export]]
std::shared_ptr<arrow::csv::ReadOptions> csv___ReadOptions__initialize(List_ options){
auto res = std::make_shared<arrow::csv::ReadOptions>(arrow::csv::ReadOptions::Defaults());
std::shared_ptr<arrow::csv::ReadOptions> csv___ReadOptions__initialize(List_ options) {
auto res =
std::make_shared<arrow::csv::ReadOptions>(arrow::csv::ReadOptions::Defaults());
res->use_threads = options["use_threads"];
res->block_size = options["block_size"];
return res;
}

inline char get_char(SEXP x){
return CHAR(STRING_ELT(x, 0))[0];
}
inline char get_char(SEXP x) { return CHAR(STRING_ELT(x, 0))[0]; }

// [[Rcpp::export]]
std::shared_ptr<arrow::csv::ParseOptions> csv___ParseOptions__initialize(List_ options){
auto res = std::make_shared<arrow::csv::ParseOptions>(arrow::csv::ParseOptions::Defaults());
std::shared_ptr<arrow::csv::ParseOptions> csv___ParseOptions__initialize(List_ options) {
auto res =
std::make_shared<arrow::csv::ParseOptions>(arrow::csv::ParseOptions::Defaults());
res->delimiter = get_char(options["delimiter"]);
res->quoting = options["quoting"];
res->quote_char = get_char(options["quote_char"]);
Expand All @@ -46,22 +46,31 @@ std::shared_ptr<arrow::csv::ParseOptions> csv___ParseOptions__initialize(List_ o
}

// [[Rcpp::export]]
std::shared_ptr<arrow::csv::ConvertOptions> csv___ConvertOptions__initialize(List_ options){
auto res = std::make_shared<arrow::csv::ConvertOptions>(arrow::csv::ConvertOptions::Defaults());
std::shared_ptr<arrow::csv::ConvertOptions> csv___ConvertOptions__initialize(
List_ options) {
auto res = std::make_shared<arrow::csv::ConvertOptions>(
arrow::csv::ConvertOptions::Defaults());
res->check_utf8 = options["check_utf8"];
return res;
}

// [[Rcpp::export]]
std::shared_ptr<arrow::csv::TableReader> csv___TableReader__Make(const std::shared_ptr<arrow::io::InputStream>& input, const std::shared_ptr<arrow::csv::ReadOptions>& read_options, const std::shared_ptr<arrow::csv::ParseOptions>& parse_options, const std::shared_ptr<arrow::csv::ConvertOptions>& convert_options){
std::shared_ptr<arrow::csv::TableReader> csv___TableReader__Make(
const std::shared_ptr<arrow::io::InputStream>& input,
const std::shared_ptr<arrow::csv::ReadOptions>& read_options,
const std::shared_ptr<arrow::csv::ParseOptions>& parse_options,
const std::shared_ptr<arrow::csv::ConvertOptions>& convert_options) {
std::shared_ptr<arrow::csv::TableReader> table_reader;
STOP_IF_NOT_OK(arrow::csv::TableReader::Make(arrow::default_memory_pool(), input, *read_options, *parse_options, *convert_options, &table_reader));
STOP_IF_NOT_OK(arrow::csv::TableReader::Make(arrow::default_memory_pool(), input,
*read_options, *parse_options,
*convert_options, &table_reader));
return table_reader;
}

// [[Rcpp::export]]
std::shared_ptr<arrow::Table> csv___TableReader__Read(const std::shared_ptr<arrow::csv::TableReader>& table_reader) {
std::shared_ptr<arrow::Table> table ;
std::shared_ptr<arrow::Table> csv___TableReader__Read(
const std::shared_ptr<arrow::csv::TableReader>& table_reader) {
std::shared_ptr<arrow::Table> table;
STOP_IF_NOT_OK(table_reader->Read(&table));
return table;
}

0 comments on commit 0ab8397

Please sign in to comment.