MCPcopy Create free account
hub / github.com/bytedance/bolt / TEST_P

Function TEST_P

bolt/expression/tests/ExprTest.cpp:483–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481};
482
483TEST_P(ParameterizedExprTest, moreEncodings) {
484 const vector_size_t size = 1'000;
485 std::vector<std::string> fruits = {"apple", "pear", "grapes", "pineapple"};
486 VectorPtr a = makeFlatVector<int64_t>(size, [](auto row) { return row; });
487 VectorPtr b = vectorMaker_.flatVector(fruits);
488
489 // Wrap b in a dictionary.
490 auto indices =
491 makeIndices(size, [&fruits](auto row) { return row % fruits.size(); });
492 b = wrapInDictionary(indices, size, b);
493
494 // Wrap both a and b in another dictionary.
495 auto evenIndices = makeIndices(size / 2, [](auto row) { return row * 2; });
496
497 a = wrapInDictionary(evenIndices, size / 2, a);
498 b = wrapInDictionary(evenIndices, size / 2, b);
499
500 auto result =
501 evaluate("if(c1 = 'grapes', c0 + 10, c0)", makeRowVector({a, b}));
502 ASSERT_EQ(VectorEncoding::Simple::DICTIONARY, result->encoding());
503 ASSERT_EQ(size / 2, result->size());
504
505 auto expected = makeFlatVector<int64_t>(size / 2, [&fruits](auto row) {
506 return (fruits[row * 2 % 4] == "grapes") ? row * 2 + 10 : row * 2;
507 });
508 assertEqualVectors(expected, result);
509}
510
511TEST_P(ParameterizedExprTest, reorder) {
512 constexpr int32_t kTestSize = 20'000;

Callers

nothing calls this directly

Calls 15

wrapInDictionaryFunction · 0.85
evaluateFunction · 0.85
compileExpressionFunction · 0.85
asRowTypeFunction · 0.85
ROWFunction · 0.85
parseExpressionFunction · 0.85
extractConstantFunction · 0.85
makeConstantExprFunction · 0.85
ARRAYFunction · 0.85
MAPFunction · 0.85
randFunction · 0.85
makeIndicesInReverseFunction · 0.85

Tested by

no test coverage detected