(from: From)
| 881 | } |
| 882 | |
| 883 | function optimizeNestedFrom(from: From): From { |
| 884 | if (from.type === `queryRef`) { |
| 885 | return new QueryRefClass(applyRecursiveOptimization(from.query), from.alias) |
| 886 | } |
| 887 | |
| 888 | if (from.type === `unionFrom`) { |
| 889 | return new UnionFromClass( |
| 890 | from.sources.map((source) => optimizeNestedFrom(source) as any), |
| 891 | ) |
| 892 | } |
| 893 | |
| 894 | if (from.type === `unionAll`) { |
| 895 | return new UnionAllClass( |
| 896 | from.queries.map((branch) => applyRecursiveOptimization(branch)), |
| 897 | ) |
| 898 | } |
| 899 | |
| 900 | return from |
| 901 | } |
| 902 | |
| 903 | function getFromSources(from: From): Array<CollectionRefClass | QueryRefClass> { |
| 904 | if (from.type === `unionFrom`) { |
no test coverage detected