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

Method CheckDecode

cpp/src/parquet/encoding_test.cc:1582–1622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1580
1581template <typename Type>
1582void TestByteStreamSplitEncoding<Type>::CheckDecode() {
1583 if constexpr (std::is_same_v<c_type, FLBA>) {
1584 // FIXED_LEN_BYTE_ARRAY
1585 // - type_length = 3
1586 {
1587 const std::vector<uint8_t> data{0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
1588 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC};
1589 const std::vector<uint8_t> raw_expected_output{0x11, 0x55, 0x99, 0x22, 0x66, 0xAA,
1590 0x33, 0x77, 0xBB, 0x44, 0x88, 0xCC};
1591 const std::vector<FLBA> expected_output{
1592 FLBA{&raw_expected_output[0]}, FLBA{&raw_expected_output[3]},
1593 FLBA{&raw_expected_output[6]}, FLBA{&raw_expected_output[9]}};
1594 CheckDecode(std::span{data}, std::span{expected_output},
1595 FLBAColumnDescriptor(3).get());
1596 }
1597 // - type_length = 1
1598 {
1599 const std::vector<uint8_t> data{0x11, 0x22, 0x33};
1600 const std::vector<uint8_t> raw_expected_output{0x11, 0x22, 0x33};
1601 const std::vector<FLBA> expected_output{FLBA{&raw_expected_output[0]},
1602 FLBA{&raw_expected_output[1]},
1603 FLBA{&raw_expected_output[2]}};
1604 CheckDecode(std::span{data}, std::span{expected_output},
1605 FLBAColumnDescriptor(1).get());
1606 }
1607 } else if constexpr (sizeof(c_type) == 4) {
1608 // INT32, FLOAT
1609 const std::vector<uint8_t> data{0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
1610 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC};
1611 const auto expected_output =
1612 ToLittleEndian<uint32_t>({0xAA774411U, 0xBB885522U, 0xCC996633U});
1613 CheckDecode(std::span{data}, std::span{expected_output});
1614 } else {
1615 // INT64, DOUBLE
1616 const std::vector<uint8_t> data{0xDE, 0xC0, 0x37, 0x13, 0x11, 0x22, 0x33, 0x44,
1617 0xAA, 0xBB, 0xCC, 0xDD, 0x55, 0x66, 0x77, 0x88};
1618 const auto expected_output =
1619 ToLittleEndian<uint64_t>({0x7755CCAA331137DEULL, 0x8866DDBB442213C0ULL});
1620 CheckDecode(std::span{data}, std::span{expected_output});
1621 }
1622}
1623
1624template <typename Type>
1625void TestByteStreamSplitEncoding<Type>::CheckEncode() {

Callers 1

TYPED_TESTFunction · 0.45

Calls 2

FLBAColumnDescriptorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected