| 124 | |
| 125 | |
| 126 | def aggregation_specs_to_agg_ops( |
| 127 | agg_specs: Iterable[Any], |
| 128 | *, |
| 129 | time_window_unsupported_error_message: str, |
| 130 | ) -> Dict[str, Tuple[str, str]]: |
| 131 | agg_ops: Dict[str, Tuple[str, str]] = {} |
| 132 | for agg in agg_specs: |
| 133 | if getattr(agg, "time_window", None) is not None: |
| 134 | raise ValueError(time_window_unsupported_error_message) |
| 135 | alias = getattr(agg, "name", None) or f"{agg.function}_{agg.column}" |
| 136 | func_name = _FUNCTION_ALIASES.get(agg.function, agg.function) |
| 137 | agg_ops[alias] = (func_name, agg.column) |
| 138 | return agg_ops |
| 139 | |
| 140 | |
| 141 | __all__ = ["Aggregation", "aggregation_specs_to_agg_ops"] |