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

Function GetScalars

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

Source from the content-addressed store, hash-verified

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