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

Method testPartitionedTableImpl

bolt/exec/tests/TableScanTest.cpp:194–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 ASSERT_EQ(n, task->numFinishedDrivers());
193 }
194
195 void testPartitionedTableImpl(
196 const std::string& filePath,
197 const TypePtr& partitionType,
198 const std::optional<std::string>& partitionValue) {
199 auto split = HiveConnectorSplitBuilder(filePath)
200 .connectorId(kHiveConnectorId)
201 .fileFormat(dwio::common::FileFormat::DWRF)
202 .partitionKey("pkey", partitionValue)
203 .build();
204 auto outputType =
205 ROW({"pkey", "c0", "c1"}, {partitionType, BIGINT(), DOUBLE()});
206 ColumnHandleMap assignments = {
207 {"pkey", partitionKey("pkey", partitionType)},
208 {"c0", regularColumn("c0", BIGINT())},
209 {"c1", regularColumn("c1", DOUBLE())}};
210
211 auto op = PlanBuilder()
212 .startTableScan()
213 .outputType(outputType)
214 .assignments(assignments)
215 .endTableScan()
216 .planNode();
217
218 std::string partitionValueStr =
219 partitionValue.has_value() ? "'" + *partitionValue + "'" : "null";
220 assertQuery(
221 op, split, fmt::format("SELECT {}, * FROM tmp", partitionValueStr));
222
223 outputType = ROW({"c0", "pkey", "c1"}, {BIGINT(), partitionType, DOUBLE()});
224 op = PlanBuilder()
225 .startTableScan()
226 .outputType(outputType)
227 .assignments(assignments)
228 .endTableScan()
229 .planNode();
230 assertQuery(
231 op,
232 split,
233 fmt::format("SELECT c0, {}, c1 FROM tmp", partitionValueStr));
234 outputType = ROW({"c0", "c1", "pkey"}, {BIGINT(), DOUBLE(), partitionType});
235 op = PlanBuilder()
236 .startTableScan()
237 .outputType(outputType)
238 .assignments(assignments)
239 .endTableScan()
240 .planNode();
241 assertQuery(
242 op,
243 split,
244 fmt::format("SELECT c0, c1, {} FROM tmp", partitionValueStr));
245
246 // select only partition key
247 assignments = {{"pkey", partitionKey("pkey", partitionType)}};
248 outputType = ROW({"pkey"}, {partitionType});
249 op = PlanBuilder()
250 .startTableScan()
251 .outputType(outputType)

Callers

nothing calls this directly

Calls 10

ROWFunction · 0.85
PlanBuilderClass · 0.85
assertQueryFunction · 0.85
partitionKeyMethod · 0.80
connectorIdMethod · 0.80
outputTypeMethod · 0.80
has_valueMethod · 0.80
buildMethod · 0.45
fileFormatMethod · 0.45

Tested by

no test coverage detected