diff --git a/catopt_query/core.py b/catopt_query/core.py index c867399..90f5cdc 100644 --- a/catopt_query/core.py +++ b/catopt_query/core.py @@ -24,11 +24,12 @@ def map_local_to_canonical(local: LocalProblem) -> CanonicalPlan: op = { "shard": local.shard_id, "predicates": local.predicates, - "attributes": local.projected_attributes, + "attributes": local.projection, "costs": local.costs, "constraints": local.constraints, } - total = sum(local.costs.values()) if local.costs else 0.0 + # LocalProblem.costs is a float, not a dict; summing over values would be invalid. + total = local.costs if local.costs is not None else 0.0 return CanonicalPlan(plan_id=str(uuid.uuid4()), operations=[op], total_cost=total, details={"shard_alias": local.shard_id}) @@ -45,4 +46,3 @@ def aggregate_joint_plan(local_plans: List[CanonicalPlan]) -> CanonicalPlan: def aggregate_joint_plan_from_locals(locals: List[LocalProblem]) -> CanonicalPlan: cans = [map_local_to_canonical(l) for l in locals] return aggregate_joint_plan(cans) -