28 lines
774 B
Python
28 lines
774 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Dict, Any
|
|
|
|
from .protocol import LocalProblem, SharedVariables, CanonicalPlan
|
|
|
|
|
|
@dataclass
|
|
class VendorPlan:
|
|
# Minimal stand-in for a vendor-specific plan representation
|
|
shard_id: str
|
|
projection: list
|
|
predicates: list
|
|
price: float
|
|
|
|
|
|
class Adapter:
|
|
"""Abstract adapter: maps a vendor-specific plan into a canonical plan."""
|
|
|
|
def to_canonical(self, vendor_plan: VendorPlan) -> CanonicalPlan:
|
|
# Simple, deterministic mapping; can be overridden by concrete adapters
|
|
return CanonicalPlan(
|
|
projection=vendor_plan.projection,
|
|
predicates=vendor_plan.predicates,
|
|
estimated_cost=float(vendor_plan.price),
|
|
)
|