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

Function MakeTimes

cpp/src/arrow/ipc/test_common.cc:1015–1035  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1013}
1014
1015Status MakeTimes(std::shared_ptr<RecordBatch>* out) {
1016 std::vector<bool> is_valid = {true, true, true, false, true, true, true};
1017 auto f0 = field("f0", time32(TimeUnit::MILLI));
1018 auto f1 = field("f1", time64(TimeUnit::NANO));
1019 auto f2 = field("f2", time32(TimeUnit::SECOND));
1020 auto f3 = field("f3", time64(TimeUnit::NANO));
1021 auto schema = ::arrow::schema({f0, f1, f2, f3});
1022
1023 std::vector<int32_t> t32_values = {14896, 14897, 14892, 1489272000, 14893, 14895};
1024 std::vector<int64_t> t64_values = {1489269000000, 1489270000000, 1489271000000,
1025 1489272000000, 1489272000000, 1489273000000};
1026
1027 std::shared_ptr<Array> a0, a1, a2, a3;
1028 ArrayFromVector<Time32Type, int32_t>(f0->type(), is_valid, t32_values, &a0);
1029 ArrayFromVector<Time64Type, int64_t>(f1->type(), is_valid, t64_values, &a1);
1030 ArrayFromVector<Time32Type, int32_t>(f2->type(), is_valid, t32_values, &a2);
1031 ArrayFromVector<Time64Type, int64_t>(f3->type(), is_valid, t64_values, &a3);
1032
1033 *out = RecordBatch::Make(schema, a0->length(), {a0, a1, a2, a3});
1034 return Status::OK();
1035}
1036
1037template <typename BuilderType, typename T>
1038static void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& values,

Callers

nothing calls this directly

Calls 8

schemaFunction · 0.70
fieldFunction · 0.50
time32Function · 0.50
time64Function · 0.50
MakeFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected