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

Function GetScalars

cpp/src/arrow/array/array_test.cc:667–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667static ScalarVector GetScalars() {
668 auto hello = Buffer::FromString("hello");
669 DayTimeIntervalType::DayMilliseconds daytime{1, 100};
670 MonthDayNanoIntervalType::MonthDayNanos month_day_nanos{5, 4, 100};
671
672 FieldVector union_fields{field("string", utf8()), field("number", int32()),
673 field("other_number", int32())};
674 std::vector<int8_t> union_type_codes{5, 6, 42};
675
676 const auto sparse_union_ty = ::arrow::sparse_union(union_fields, union_type_codes);
677 const auto dense_union_ty = ::arrow::dense_union(union_fields, union_type_codes);
678
679 return {
680 std::make_shared<BooleanScalar>(false),
681 std::make_shared<Int8Scalar>(3),
682 std::make_shared<UInt16Scalar>(3),
683 std::make_shared<Int32Scalar>(3),
684 std::make_shared<UInt64Scalar>(3),
685 std::make_shared<DoubleScalar>(3.0),
686 std::make_shared<Date32Scalar>(10),
687 std::make_shared<Date64Scalar>(864000000),
688 std::make_shared<Time32Scalar>(1000, time32(TimeUnit::SECOND)),
689 std::make_shared<Time64Scalar>(1111, time64(TimeUnit::MICRO)),
690 std::make_shared<TimestampScalar>(1111, timestamp(TimeUnit::MILLI)),
691 std::make_shared<MonthIntervalScalar>(1),
692 std::make_shared<DayTimeIntervalScalar>(daytime),
693 std::make_shared<MonthDayNanoIntervalScalar>(month_day_nanos),
694 std::make_shared<DurationScalar>(60, duration(TimeUnit::SECOND)),
695 std::make_shared<BinaryScalar>(hello),
696 std::make_shared<LargeBinaryScalar>(hello),
697 std::make_shared<BinaryViewScalar>(hello),
698 std::make_shared<FixedSizeBinaryScalar>(
699 hello, fixed_size_binary(static_cast<int32_t>(hello->size()))),
700 std::make_shared<Decimal32Scalar>(Decimal32(10), smallest_decimal(7, 4)),
701 std::make_shared<Decimal64Scalar>(Decimal64(10), smallest_decimal(12, 4)),
702 std::make_shared<Decimal128Scalar>(Decimal128(10), smallest_decimal(20, 4)),
703 std::make_shared<Decimal256Scalar>(Decimal256(10), smallest_decimal(76, 38)),
704 std::make_shared<StringScalar>(hello),
705 std::make_shared<LargeStringScalar>(hello),
706 std::make_shared<StringViewScalar>(hello),
707 std::make_shared<StringViewScalar>(Buffer::FromString("long string; not inlined")),
708 std::make_shared<ListScalar>(ArrayFromJSON(int8(), "[1, 2, 3]")),
709 ScalarFromJSON(map(int8(), utf8()), R"([[1, "foo"], [2, "bar"]])"),
710 std::make_shared<LargeListScalar>(ArrayFromJSON(int8(), "[1, 1, 2, 2, 3, 3]")),
711 std::make_shared<FixedSizeListScalar>(ArrayFromJSON(int8(), "[1, 2, 3, 4]")),
712 std::make_shared<ListViewScalar>(ArrayFromJSON(int8(), "[1, 2, 3]")),
713 std::make_shared<LargeListViewScalar>(ArrayFromJSON(int8(), "[1, 1, 2, 2, 3, 3]")),
714 std::make_shared<StructScalar>(
715 ScalarVector{
716 std::make_shared<Int32Scalar>(2),
717 std::make_shared<Int32Scalar>(6),
718 },
719 struct_({field("min", int32()), field("max", int32())})),
720 // Same values, different union type codes
721 SparseUnionScalar::FromValue(std::make_shared<Int32Scalar>(100), 1,
722 sparse_union_ty),
723 SparseUnionScalar::FromValue(std::make_shared<Int32Scalar>(100), 2,
724 sparse_union_ty),

Callers 1

TEST_FFunction · 0.70

Calls 15

FromStringFunction · 0.85
sparse_unionFunction · 0.85
dense_unionFunction · 0.85
fixed_size_binaryFunction · 0.85
smallest_decimalFunction · 0.85
ArrayFromJSONFunction · 0.85
ScalarFromJSONFunction · 0.85
mapFunction · 0.85
struct_Function · 0.85
MakeNullScalarFunction · 0.85
run_end_encodedFunction · 0.85
MakeFunction · 0.70

Tested by

no test coverage detected