A placeholder for a reference that the io.crate.planner.operators.Fetch operator can fetch.
| 34 | * A placeholder for a reference that the {@link io.crate.planner.operators.Fetch} operator can fetch. |
| 35 | */ |
| 36 | public final class FetchStub implements Symbol { |
| 37 | |
| 38 | private final FetchMarker fetchMarker; |
| 39 | private final Reference ref; |
| 40 | |
| 41 | /** |
| 42 | * @param fetchMarker the _fetchId marker that must be used to fetch the value for the reference |
| 43 | */ |
| 44 | public FetchStub(FetchMarker fetchMarker, Reference ref) { |
| 45 | this.fetchMarker = fetchMarker; |
| 46 | this.ref = ref; |
| 47 | } |
| 48 | |
| 49 | public FetchMarker fetchMarker() { |
| 50 | return fetchMarker; |
| 51 | } |
| 52 | |
| 53 | public Reference ref() { |
| 54 | return ref; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public SymbolType symbolType() { |
| 59 | return SymbolType.FETCH_STUB; |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public <C, R> R accept(SymbolVisitor<C, R> visitor, C context) { |
| 64 | return visitor.visitFetchStub(this, context); |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public DataType<?> valueType() { |
| 69 | return ref.valueType(); |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public String toString() { |
| 74 | return toString(Style.UNQUALIFIED); |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public String toString(Style style) { |
| 79 | return ref.toString(style); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void writeTo(StreamOutput out) throws IOException { |
| 84 | throw new UnsupportedEncodingException( |
| 85 | "Cannot stream FetchStub. This is a planning symbol and not suitable for the execution layer"); |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public long ramBytesUsed() { |
| 90 | return ref.ramBytesUsed() + fetchMarker.ramBytesUsed(); |
| 91 | } |
| 92 | } |
nothing calls this directly
no outgoing calls
no test coverage detected