Each call to a parameterized view with a different set of argument values produces a fresh `StorageView` that carries the substituted inner query but shares the original `StorageID`. Return that substituted query so callers can distinguish such storages by content.
| 44 | /// `StorageView` that carries the substituted inner query but shares the original `StorageID`. |
| 45 | /// Return that substituted query so callers can distinguish such storages by content. |
| 46 | ASTPtr getParameterizedViewInnerQuery(const StoragePtr & storage) |
| 47 | { |
| 48 | if (!storage) |
| 49 | return nullptr; |
| 50 | auto * view = storage->as<StorageView>(); |
| 51 | if (!view || !view->isParameterizedView()) |
| 52 | return nullptr; |
| 53 | auto metadata_snapshot = view->getInMemoryMetadataPtr(nullptr, false); |
| 54 | return metadata_snapshot->getSelectQuery().inner_query; |
| 55 | } |
| 56 | |
| 57 | } |
| 58 |
no test coverage detected