Skip to content

Commit

Permalink
Add more helpers in arrow utils. (#559)
Browse files Browse the repository at this point in the history
+ EmptyTableBuilder::EmptySchema: generate empty schema.

Signed-off-by: Tao He <sighingnow@gmail.com>
  • Loading branch information
sighingnow authored Oct 28, 2021
1 parent 5e912b1 commit 0135c99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/basic/ds/arrow_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ Status EmptyTableBuilder::Build(const std::shared_ptr<arrow::Schema>& schema,
return Status::OK();
}

std::shared_ptr<arrow::Schema> EmptyTableBuilder::EmptySchema() {
return std::shared_ptr<arrow::Schema>(
new arrow::Schema({}, arrow::Endianness::Native));
}

std::shared_ptr<arrow::DataType> type_name_to_arrow_type(
const std::string& name) {
if (name == "bool") {
Expand Down
3 changes: 3 additions & 0 deletions modules/basic/ds/arrow_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ limitations under the License.
#include "arrow/ipc/writer.h"
#include "arrow/table.h"
#include "arrow/table_builder.h"
#include "arrow/type.h"
#include "arrow/util/config.h"
#include "glog/logging.h"

Expand Down Expand Up @@ -208,6 +209,8 @@ Status DeserializeTable(std::shared_ptr<arrow::Buffer> buffer,
struct EmptyTableBuilder {
static Status Build(const std::shared_ptr<arrow::Schema>& schema,
std::shared_ptr<arrow::Table>& table);

static std::shared_ptr<arrow::Schema> EmptySchema();
};

/**
Expand Down

0 comments on commit 0135c99

Please sign in to comment.