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

Function MakeIntervals

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

Source from the content-addressed store, hash-verified

984}
985
986Status MakeIntervals(std::shared_ptr<RecordBatch>* out) {
987 std::vector<bool> is_valid = {true, true, true, false, true, true, true};
988 auto f0 = field("f0", duration(TimeUnit::MILLI));
989 auto f1 = field("f1", duration(TimeUnit::NANO));
990 auto f2 = field("f2", duration(TimeUnit::SECOND));
991 auto f3 = field("f3", day_time_interval());
992 auto f4 = field("f4", month_interval());
993 auto f5 = field("f5", month_day_nano_interval());
994 auto schema = ::arrow::schema({f0, f1, f2, f3, f4, f5});
995
996 std::vector<int64_t> ts_values = {1489269000000, 1489270000000, 1489271000000,
997 1489272000000, 1489272000000, 1489273000000};
998
999 std::shared_ptr<Array> a0, a1, a2, a3, a4, a5;
1000 ArrayFromVector<DurationType, int64_t>(f0->type(), is_valid, ts_values, &a0);
1001 ArrayFromVector<DurationType, int64_t>(f1->type(), is_valid, ts_values, &a1);
1002 ArrayFromVector<DurationType, int64_t>(f2->type(), is_valid, ts_values, &a2);
1003 ArrayFromVector<DayTimeIntervalType, DayTimeIntervalType::DayMilliseconds>(
1004 f3->type(), is_valid, {{0, 0}, {0, 1}, {1, 1}, {2, 1}, {3, 4}, {-1, -1}}, &a3);
1005 ArrayFromVector<MonthIntervalType, int32_t>(f4->type(), is_valid, {0, -1, 1, 2, -2, 24},
1006 &a4);
1007 ArrayFromVector<MonthDayNanoIntervalType, MonthDayNanoIntervalType::MonthDayNanos>(
1008 f5->type(), is_valid,
1009 {{0, 0, 0}, {0, 0, 1}, {-1, 0, 1}, {-1, -2, -3}, {2, 4, 6}, {-3, -4, -5}}, &a5);
1010
1011 *out = RecordBatch::Make(schema, a0->length(), {a0, a1, a2, a3, a4, a5});
1012 return Status::OK();
1013}
1014
1015Status MakeTimes(std::shared_ptr<RecordBatch>* out) {
1016 std::vector<bool> is_valid = {true, true, true, false, true, true, true};

Callers

nothing calls this directly

Calls 10

day_time_intervalFunction · 0.85
month_intervalFunction · 0.85
month_day_nano_intervalFunction · 0.85
schemaFunction · 0.70
fieldFunction · 0.50
durationFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected