Symbol representing a sub-query
| 35 | * Symbol representing a sub-query |
| 36 | */ |
| 37 | public class SelectSymbol implements Symbol { |
| 38 | |
| 39 | private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(SelectSymbol.class); |
| 40 | |
| 41 | private final AnalyzedRelation relation; |
| 42 | private final ArrayType<?> dataType; |
| 43 | private final ResultType resultType; |
| 44 | private final boolean isCorrelated; |
| 45 | private final boolean parentIsOrderSensitive; |
| 46 | |
| 47 | public enum ResultType { |
| 48 | SINGLE_COLUMN_SINGLE_VALUE, |
| 49 | SINGLE_COLUMN_MULTIPLE_VALUES, |
| 50 | SINGLE_COLUMN_EXISTS |
| 51 | } |
| 52 | |
| 53 | public SelectSymbol(AnalyzedRelation relation, ArrayType<?> dataType, |
| 54 | ResultType resultType, |
| 55 | boolean parentIsOrderSensitive) { |
| 56 | |
| 57 | this.relation = relation; |
| 58 | this.dataType = dataType; |
| 59 | this.resultType = resultType; |
| 60 | boolean[] isCorrelatedArr = new boolean[] { false }; |
| 61 | relation.visitSymbols(symbolTree -> { |
| 62 | if (symbolTree.any(s -> s instanceof OuterColumn)) { |
| 63 | isCorrelatedArr[0] = true; |
| 64 | } |
| 65 | }); |
| 66 | this.isCorrelated = isCorrelatedArr[0]; |
| 67 | this.parentIsOrderSensitive = parentIsOrderSensitive; |
| 68 | } |
| 69 | |
| 70 | public AnalyzedRelation relation() { |
| 71 | return relation; |
| 72 | } |
| 73 | |
| 74 | public boolean isCorrelated() { |
| 75 | return isCorrelated; |
| 76 | } |
| 77 | |
| 78 | public boolean parentIsOrderSensitive() { |
| 79 | return parentIsOrderSensitive; |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void writeTo(StreamOutput out) throws IOException { |
| 84 | throw new UnsupportedOperationException("Cannot stream SelectSymbol"); |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public SymbolType symbolType() { |
| 89 | return SymbolType.SELECT_SYMBOL; |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public <C, R> R accept(SymbolVisitor<C, R> visitor, C context) { |
| 94 | return visitor.visitSelectSymbol(this, context); |
nothing calls this directly
no outgoing calls
no test coverage detected