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

Function TEST

cpp/src/arrow/compute/row/compare_test.cc:41–117  ·  view source on GitHub ↗

Specialized case for GH-39577.

Source from the content-addressed store, hash-verified

39
40// Specialized case for GH-39577.
41TEST(KeyCompare, CompareColumnsToRowsCuriousFSB) {
42 int fsb_length = 9;
43 int num_rows = 7;
44
45 MemoryPool* pool = default_memory_pool();
46 TempVectorStack stack;
47 ASSERT_OK(stack.Init(pool, KeyCompare::CompareColumnsToRowsTempStackUsage(num_rows)));
48
49 auto column_right = ArrayFromJSON(fixed_size_binary(fsb_length), R"([
50 "000000000",
51 "111111111",
52 "222222222",
53 "333333333",
54 "444444444",
55 "555555555",
56 "666666666"])");
57 ExecBatch batch_right({column_right}, num_rows);
58
59 std::vector<KeyColumnMetadata> column_metadatas_right;
60 ASSERT_OK(ColumnMetadatasFromExecBatch(batch_right, &column_metadatas_right));
61
62 RowTableMetadata table_metadata_right;
63 table_metadata_right.FromColumnMetadataVector(column_metadatas_right, sizeof(uint64_t),
64 sizeof(uint64_t));
65
66 std::vector<KeyColumnArray> column_arrays_right;
67 ASSERT_OK(ColumnArraysFromExecBatch(batch_right, &column_arrays_right));
68
69 RowTableImpl row_table;
70 ASSERT_OK(row_table.Init(pool, table_metadata_right));
71
72 RowTableEncoder row_encoder;
73 row_encoder.Init(column_metadatas_right, sizeof(uint64_t), sizeof(uint64_t));
74 row_encoder.PrepareEncodeSelected(0, num_rows, column_arrays_right);
75
76 std::vector<uint16_t> row_ids_right(num_rows);
77 std::iota(row_ids_right.begin(), row_ids_right.end(), 0);
78 ASSERT_OK(row_encoder.EncodeSelected(&row_table, num_rows, row_ids_right.data()));
79
80 auto column_left = ArrayFromJSON(fixed_size_binary(fsb_length), R"([
81 "000000000",
82 "111111111",
83 "222222222",
84 "333333333",
85 "444444444",
86 "555555555",
87 "777777777"])");
88 ExecBatch batch_left({column_left}, num_rows);
89 std::vector<KeyColumnArray> column_arrays_left;
90 ASSERT_OK(ColumnArraysFromExecBatch(batch_left, &column_arrays_left));
91
92 std::vector<uint32_t> row_ids_left(num_rows);
93 std::iota(row_ids_left.begin(), row_ids_left.end(), 0);
94
95 LightContext ctx{CpuInfo::GetInstance()->hardware_flags(), &stack};
96
97 {
98 uint32_t num_rows_no_match;

Callers

nothing calls this directly

Calls 15

default_memory_poolFunction · 0.85
ArrayFromJSONFunction · 0.85
fixed_size_binaryFunction · 0.85
BytesForBitsFunction · 0.85
to_stringFunction · 0.85
PrepareEncodeSelectedMethod · 0.80
EncodeSelectedMethod · 0.80
hardware_flagsMethod · 0.80

Tested by

no test coverage detected