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

Function TEST_F

bolt/expression/tests/ExprStatsTest.cpp:55–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53};
54
55TEST_F(ExprStatsTest, printWithStats) {
56 vector_size_t size = 1'024;
57
58 auto data = makeRowVector({
59 makeFlatVector<int32_t>(size, [](auto row) { return row; }),
60 makeFlatVector<int32_t>(size, [](auto row) { return row % 7; }),
61 });
62
63 auto rowType = asRowType(data->type());
64 {
65 auto exprSet =
66 compileExpressions({"(c0 + 3) * c1", "(c0 + c1) % 2 = 0"}, rowType);
67
68 // Check stats before evaluation.
69 ASSERT_EQ(
70 exec::printExprWithStats(*exprSet),
71 "multiply [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#1]\n"
72 " plus [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#2]\n"
73 " cast(c0 as BIGINT) [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#3]\n"
74 " c0 [cpu time: 0ns, rows: 0, batches: 0] -> INTEGER [#4]\n"
75 " 3:BIGINT [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#5]\n"
76 " cast(c1 as BIGINT) [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#6]\n"
77 " c1 [cpu time: 0ns, rows: 0, batches: 0] -> INTEGER [#7]\n"
78 "\n"
79 "eq [cpu time: 0ns, rows: 0, batches: 0] -> BOOLEAN [#8]\n"
80 " mod [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#9]\n"
81 " cast(plus as BIGINT) [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#10]\n"
82 " plus [cpu time: 0ns, rows: 0, batches: 0] -> INTEGER [#11]\n"
83 " c0 -> INTEGER [CSE #4]\n"
84 " c1 -> INTEGER [CSE #7]\n"
85 " 2:BIGINT [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#12]\n"
86 " 0:BIGINT [cpu time: 0ns, rows: 0, batches: 0] -> BIGINT [#13]\n");
87
88 evaluate(*exprSet, data);
89
90 // Check stats after evaluation.
91 ASSERT_THAT(
92 exec::printExprWithStats(*exprSet),
93 ::testing::MatchesRegex(
94 "multiply .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#1.\n"
95 " plus .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#2.\n"
96 " cast.c0 as BIGINT. .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#3.\n"
97 " c0 .cpu time: 0ns, rows: 2048, batches: 2. -> INTEGER .#4.\n"
98 " 3:BIGINT .cpu time: 0ns, rows: 1024, batches: 1. -> BIGINT .#5.\n"
99 " cast.c1 as BIGINT. .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#6.\n"
100 " c1 .cpu time: 0ns, rows: 2048, batches: 2. -> INTEGER .#7.\n"
101 "\n"
102 "eq .cpu time: .+, rows: 1024, batches: 1. -> BOOLEAN .#8.\n"
103 " mod .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#9.\n"
104 " cast.plus as BIGINT. .cpu time: .+, rows: 1024, batches: 1. -> BIGINT .#10.\n"
105 " plus .cpu time: .+, rows: 1024, batches: 1. -> INTEGER .#11.\n"
106 " c0 -> INTEGER .CSE #4.\n"
107 " c1 -> INTEGER .CSE #7.\n"
108 " 2:BIGINT .cpu time: 0ns, rows: 1024, batches: 1. -> BIGINT .#12.\n"
109 " 0:BIGINT .cpu time: 0ns, rows: 1024, batches: 1. -> BIGINT .#13.\n"));
110 }
111
112 // Verify that common sub-expressions are identified properly.

Callers

nothing calls this directly

Calls 15

asRowTypeFunction · 0.85
compileExpressionsFunction · 0.85
printExprWithStatsFunction · 0.85
evaluateFunction · 0.85
wrapInDictionaryFunction · 0.85
registerExprSetListenerFunction · 0.85
ROWFunction · 0.85
childAtMethod · 0.80
backMethod · 0.80
exceptionCountMethod · 0.80
makeIndicesFunction · 0.50

Tested by

no test coverage detected