MCPcopy Create free account
hub / github.com/apache/arrow / CreateTable

Function CreateTable

cpp/examples/arrow/dataset_documentation_example.cc:51–68  ·  view source on GitHub ↗

(Doc section: Reading Datasets) Generate some data for the rest of this example.

Source from the content-addressed store, hash-verified

49// (Doc section: Reading Datasets)
50// Generate some data for the rest of this example.
51arrow::Result<std::shared_ptr<arrow::Table>> CreateTable() {
52 auto schema =
53 arrow::schema({arrow::field("a", arrow::int64()), arrow::field("b", arrow::int64()),
54 arrow::field("c", arrow::int64())});
55 std::shared_ptr<arrow::Array> array_a;
56 std::shared_ptr<arrow::Array> array_b;
57 std::shared_ptr<arrow::Array> array_c;
58 arrow::NumericBuilder<arrow::Int64Type> builder;
59 ARROW_RETURN_NOT_OK(builder.AppendValues({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}));
60 ARROW_RETURN_NOT_OK(builder.Finish(&array_a));
61 builder.Reset();
62 ARROW_RETURN_NOT_OK(builder.AppendValues({9, 8, 7, 6, 5, 4, 3, 2, 1, 0}));
63 ARROW_RETURN_NOT_OK(builder.Finish(&array_b));
64 builder.Reset();
65 ARROW_RETURN_NOT_OK(builder.AppendValues({1, 2, 1, 2, 1, 2, 1, 2, 1, 2}));
66 ARROW_RETURN_NOT_OK(builder.Finish(&array_c));
67 return arrow::Table::Make(schema, {array_a, array_b, array_c});
68}
69
70// Set up a dataset by writing two Parquet files.
71arrow::Result<std::string> CreateExampleParquetDataset(

Callers 1

ARROW_ASSIGN_OR_RAISEFunction · 0.70

Calls 6

schemaFunction · 0.50
fieldFunction · 0.50
MakeFunction · 0.50
AppendValuesMethod · 0.45
FinishMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected