Identify operators in the performance data that are not mapped to any source operation.
(
tables: Tables, src_df: pd.DataFrame, cmd_to_op_df: pd.DataFrame
)
| 156 | |
| 157 | |
| 158 | def check_unmapped_ops( |
| 159 | tables: Tables, src_df: pd.DataFrame, cmd_to_op_df: pd.DataFrame |
| 160 | ) -> None: |
| 161 | """ |
| 162 | Identify operators in the performance data that are not mapped to any source operation. |
| 163 | """ |
| 164 | opt_ids_in_src_table = set() |
| 165 | for opt_ids in src_df[COMPILER_OP_ID].dropna(): |
| 166 | if type(opt_ids) is list: |
| 167 | opt_ids_in_src_table.update(opt_ids) |
| 168 | |
| 169 | opt_df = pd.merge( |
| 170 | tables.perf[["id", "source_id"]], tables.group, on="id", how="left" |
| 171 | ) |
| 172 | opt_df = opt_df.rename(columns={"id": COMPILER_OP_ID}) |
| 173 | opt_df = pd.merge(opt_df, cmd_to_op_df, on=COMPILER_OP_ID, how="inner") |
| 174 | |
| 175 | unmapped_operators = opt_df[ |
| 176 | ~opt_df[COMPILER_OP_ID].isin(list(opt_ids_in_src_table)) |
| 177 | ] |
| 178 | |
| 179 | if not unmapped_operators.empty: |
| 180 | print("Warning: There are unmapped operators in the performance data.") |
| 181 | print(unmapped_operators) |
| 182 | return None |
| 183 | |
| 184 | |
| 185 | def build_src_df(tables: Tables, perf_df: pd.DataFrame) -> pd.DataFrame: |
no test coverage detected