Navigation Menu

Skip to content

Commit

Permalink
Support Apache Arrow 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 30, 2017
1 parent 22751e8 commit 10fbb09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -956,7 +956,7 @@ AC_ARG_ENABLE(arrow,
if test "x$enable_arrow" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([ARROW],
[arrow >= 0.5.0],
[arrow >= 0.8.0],
[arrow_available=yes],
[arrow_available=no])
],
Expand Down
16 changes: 8 additions & 8 deletions lib/arrow.cpp
Expand Up @@ -353,7 +353,7 @@ namespace grnarrow {
}

grn_rc load_table(const std::shared_ptr<arrow::Table> &arrow_table) {
int n_columns = arrow_table->num_columns();
auto n_columns = arrow_table->num_columns();

if (key_column_name_.empty()) {
grn_obj ids;
Expand Down Expand Up @@ -421,7 +421,7 @@ namespace grnarrow {
grn_rc dump(arrow::io::OutputStream *output) {
std::vector<std::shared_ptr<arrow::Field>> fields;
auto n_columns = GRN_BULK_VSIZE(grn_columns_) / sizeof(grn_obj *);
for (auto i = 0; i < n_columns; ++i) {
for (size_t i = 0; i < n_columns; ++i) {
auto column = GRN_PTR_VALUE_AT(grn_columns_, i);

char column_name[GRN_TABLE_MAX_KEY_SIZE];
Expand Down Expand Up @@ -485,7 +485,7 @@ namespace grnarrow {

auto schema = std::make_shared<arrow::Schema>(fields);

std::shared_ptr<arrow::ipc::RecordBatchFileWriter> writer;
std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
auto status =
arrow::ipc::RecordBatchFileWriter::Open(output, schema, &writer);
if (!check_status(ctx_,
Expand All @@ -495,7 +495,7 @@ namespace grnarrow {
}

std::vector<grn_id> ids;
int n_records_per_batch = 1000;
size_t n_records_per_batch = 1000;
GRN_TABLE_EACH_BEGIN(ctx_, grn_table_, table_cursor, record_id) {
ids.push_back(record_id);
if (ids.size() == n_records_per_batch) {
Expand All @@ -518,10 +518,10 @@ namespace grnarrow {

void write_record_batch(std::vector<grn_id> &ids,
std::shared_ptr<arrow::Schema> &schema,
std::shared_ptr<arrow::ipc::RecordBatchFileWriter> &writer) {
std::shared_ptr<arrow::ipc::RecordBatchWriter> &writer) {
std::vector<std::shared_ptr<arrow::Array>> columns;
auto n_columns = GRN_BULK_VSIZE(grn_columns_) / sizeof(grn_obj *);
for (auto i = 0; i < n_columns; ++i) {
for (size_t i = 0; i < n_columns; ++i) {
auto grn_column = GRN_PTR_VALUE_AT(grn_columns_, i);

arrow::Status status;
Expand Down Expand Up @@ -705,8 +705,8 @@ namespace grnarrow {
std::shared_ptr<arrow::Array> *array) {
auto timestamp_ns_data_type =
std::make_shared<arrow::TimestampType>(arrow::TimeUnit::MICRO);
arrow::TimestampBuilder builder(arrow::default_memory_pool(),
timestamp_ns_data_type);
arrow::TimestampBuilder builder(timestamp_ns_data_type,
arrow::default_memory_pool());
for (auto id : ids) {
uint32_t size;
auto data = grn_obj_get_value_(ctx_, grn_column, id, &size);
Expand Down

0 comments on commit 10fbb09

Please sign in to comment.