| 59 | |
| 60 | @dataclass(frozen=True) |
| 61 | class ExplainOption: |
| 62 | key: str |
| 63 | val: str | bool | int | None = None |
| 64 | |
| 65 | def __str__(self): |
| 66 | key = self.key.replace("_", " ").upper() |
| 67 | if self.val is None: |
| 68 | return f"{key}" |
| 69 | else: |
| 70 | return f"{key} = {literal(self.val)}" # type: ignore |
| 71 | |
| 72 | def affects_pipeline(self) -> bool: |
| 73 | """ |
| 74 | Returns true iff the `EXPLAIN` feature flag might affect the output of |
| 75 | the optimizer pipeline. |
| 76 | """ |
| 77 | return any( |
| 78 | ( |
| 79 | self.key.lower() == "reoptimize_imported_views", |
| 80 | self.key.lower().startswith("enable_"), |
| 81 | ) |
| 82 | ) |
| 83 | |
| 84 | |
| 85 | class ExplainOptionType(click.ParamType): |