MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / getFactorizedTableSchema

Function getFactorizedTableSchema

src/processor/map/map_aggregate.cpp:281–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281static FactorizedTableSchema getFactorizedTableSchema(const expression_vector& flatKeys,
282 const expression_vector& unFlatKeys, const expression_vector& payloads,
283 const std::vector<AggregateFunction>& aggregateFunctions) {
284 auto isUnFlat = false;
285 auto groupID = 0u;
286 auto tableSchema = FactorizedTableSchema();
287 for (auto& flatKey : flatKeys) {
288 auto size = LogicalTypeUtils::getRowLayoutSize(flatKey->dataType);
289 tableSchema.appendColumn(ColumnSchema(isUnFlat, groupID, size));
290 }
291 for (auto& unFlatKey : unFlatKeys) {
292 auto size = LogicalTypeUtils::getRowLayoutSize(unFlatKey->dataType);
293 tableSchema.appendColumn(ColumnSchema(isUnFlat, groupID, size));
294 }
295 for (auto& payload : payloads) {
296 auto size = LogicalTypeUtils::getRowLayoutSize(payload->dataType);
297 tableSchema.appendColumn(ColumnSchema(isUnFlat, groupID, size));
298 }
299 for (auto& aggregateFunc : aggregateFunctions) {
300 tableSchema.appendColumn(
301 ColumnSchema(isUnFlat, groupID, aggregateFunc.getAggregateStateSize()));
302 }
303 tableSchema.appendColumn(ColumnSchema(isUnFlat, groupID, sizeof(hash_t)));
304 return tableSchema;
305}
306
307std::unique_ptr<PhysicalOperator> PlanMapper::createDistinctHashAggregate(
308 const expression_vector& keys, const expression_vector& payloads, Schema* inSchema,

Callers 1

createHashAggregateMethod · 0.70

Calls 3

ColumnSchemaClass · 0.85
appendColumnMethod · 0.80
getAggregateStateSizeMethod · 0.80

Tested by

no test coverage detected