|
@@ -219,7 +219,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
/**
|
|
|
* List of named type entries that link concrete names to stream reader and writer implementations.
|
|
|
- * Entries have the form; category, name, serializer method, deserializer method.
|
|
|
+ * Entries have the form: category, name, serializer method, deserializer method.
|
|
|
*/
|
|
|
public static List<PlanNameRegistry.Entry> namedTypeEntries() {
|
|
|
return List.of(
|
|
@@ -388,7 +388,7 @@ public final class PlanNamedTypes {
|
|
|
// -- physical plan nodes
|
|
|
static AggregateExec readAggregateExec(PlanStreamInput in) throws IOException {
|
|
|
return new AggregateExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readPhysicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)),
|
|
|
readNamedExpressions(in),
|
|
@@ -398,6 +398,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeAggregateExec(PlanStreamOutput out, AggregateExec aggregateExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(aggregateExec.child());
|
|
|
out.writeCollection(aggregateExec.groupings(), writerFromPlanWriter(PlanStreamOutput::writeExpression));
|
|
|
writeNamedExpressions(out, aggregateExec.aggregates());
|
|
@@ -406,10 +407,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static DissectExec readDissectExec(PlanStreamInput in) throws IOException {
|
|
|
- return new DissectExec(Source.EMPTY, in.readPhysicalPlanNode(), in.readExpression(), readDissectParser(in), readAttributes(in));
|
|
|
+ return new DissectExec(in.readSource(), in.readPhysicalPlanNode(), in.readExpression(), readDissectParser(in), readAttributes(in));
|
|
|
}
|
|
|
|
|
|
static void writeDissectExec(PlanStreamOutput out, DissectExec dissectExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(dissectExec.child());
|
|
|
out.writeExpression(dissectExec.inputExpression());
|
|
|
writeDissectParser(out, dissectExec.parser());
|
|
@@ -418,7 +420,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static EsQueryExec readEsQueryExec(PlanStreamInput in) throws IOException {
|
|
|
return new EsQueryExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
readEsIndex(in),
|
|
|
readAttributes(in),
|
|
|
in.readOptionalNamedWriteable(QueryBuilder.class),
|
|
@@ -430,6 +432,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static void writeEsQueryExec(PlanStreamOutput out, EsQueryExec esQueryExec) throws IOException {
|
|
|
assert esQueryExec.children().size() == 0;
|
|
|
+ out.writeNoSource();
|
|
|
writeEsIndex(out, esQueryExec.index());
|
|
|
writeAttributes(out, esQueryExec.output());
|
|
|
out.writeOptionalNamedWriteable(esQueryExec.query());
|
|
@@ -439,27 +442,29 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static EsSourceExec readEsSourceExec(PlanStreamInput in) throws IOException {
|
|
|
- return new EsSourceExec(Source.EMPTY, readEsIndex(in), readAttributes(in), in.readOptionalNamedWriteable(QueryBuilder.class));
|
|
|
+ return new EsSourceExec(in.readSource(), readEsIndex(in), readAttributes(in), in.readOptionalNamedWriteable(QueryBuilder.class));
|
|
|
}
|
|
|
|
|
|
static void writeEsSourceExec(PlanStreamOutput out, EsSourceExec esSourceExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
writeEsIndex(out, esSourceExec.index());
|
|
|
writeAttributes(out, esSourceExec.output());
|
|
|
out.writeOptionalNamedWriteable(esSourceExec.query());
|
|
|
}
|
|
|
|
|
|
static EvalExec readEvalExec(PlanStreamInput in) throws IOException {
|
|
|
- return new EvalExec(Source.EMPTY, in.readPhysicalPlanNode(), readAliases(in));
|
|
|
+ return new EvalExec(in.readSource(), in.readPhysicalPlanNode(), readAliases(in));
|
|
|
}
|
|
|
|
|
|
static void writeEvalExec(PlanStreamOutput out, EvalExec evalExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(evalExec.child());
|
|
|
writeAliases(out, evalExec.fields());
|
|
|
}
|
|
|
|
|
|
static EnrichExec readEnrichExec(PlanStreamInput in) throws IOException {
|
|
|
return new EnrichExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readPhysicalPlanNode(),
|
|
|
in.readNamedExpression(),
|
|
|
in.readString(),
|
|
@@ -470,6 +475,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeEnrichExec(PlanStreamOutput out, EnrichExec enrich) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(enrich.child());
|
|
|
out.writeNamedExpression(enrich.matchField());
|
|
|
out.writeString(enrich.policyName());
|
|
@@ -479,26 +485,28 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static ExchangeExec readExchangeExec(PlanStreamInput in) throws IOException {
|
|
|
- return new ExchangeExec(Source.EMPTY, readAttributes(in), in.readBoolean(), in.readPhysicalPlanNode());
|
|
|
+ return new ExchangeExec(in.readSource(), readAttributes(in), in.readBoolean(), in.readPhysicalPlanNode());
|
|
|
}
|
|
|
|
|
|
static void writeExchangeExec(PlanStreamOutput out, ExchangeExec exchangeExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
writeAttributes(out, exchangeExec.output());
|
|
|
out.writeBoolean(exchangeExec.isInBetweenAggs());
|
|
|
out.writePhysicalPlanNode(exchangeExec.child());
|
|
|
}
|
|
|
|
|
|
static ExchangeSinkExec readExchangeSinkExec(PlanStreamInput in) throws IOException {
|
|
|
- return new ExchangeSinkExec(Source.EMPTY, readAttributes(in), in.readPhysicalPlanNode());
|
|
|
+ return new ExchangeSinkExec(in.readSource(), readAttributes(in), in.readPhysicalPlanNode());
|
|
|
}
|
|
|
|
|
|
static void writeExchangeSinkExec(PlanStreamOutput out, ExchangeSinkExec exchangeSinkExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
writeAttributes(out, exchangeSinkExec.output());
|
|
|
out.writePhysicalPlanNode(exchangeSinkExec.child());
|
|
|
}
|
|
|
|
|
|
static ExchangeSourceExec readExchangeSourceExec(PlanStreamInput in) throws IOException {
|
|
|
- return new ExchangeSourceExec(Source.EMPTY, readAttributes(in), in.readBoolean());
|
|
|
+ return new ExchangeSourceExec(in.readSource(), readAttributes(in), in.readBoolean());
|
|
|
}
|
|
|
|
|
|
static void writeExchangeSourceExec(PlanStreamOutput out, ExchangeSourceExec exchangeSourceExec) throws IOException {
|
|
@@ -507,26 +515,28 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static FieldExtractExec readFieldExtractExec(PlanStreamInput in) throws IOException {
|
|
|
- return new FieldExtractExec(Source.EMPTY, in.readPhysicalPlanNode(), readAttributes(in));
|
|
|
+ return new FieldExtractExec(in.readSource(), in.readPhysicalPlanNode(), readAttributes(in));
|
|
|
}
|
|
|
|
|
|
static void writeFieldExtractExec(PlanStreamOutput out, FieldExtractExec fieldExtractExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(fieldExtractExec.child());
|
|
|
writeAttributes(out, fieldExtractExec.attributesToExtract());
|
|
|
}
|
|
|
|
|
|
static FilterExec readFilterExec(PlanStreamInput in) throws IOException {
|
|
|
- return new FilterExec(Source.EMPTY, in.readPhysicalPlanNode(), in.readExpression());
|
|
|
+ return new FilterExec(in.readSource(), in.readPhysicalPlanNode(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeFilterExec(PlanStreamOutput out, FilterExec filterExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(filterExec.child());
|
|
|
out.writeExpression(filterExec.condition());
|
|
|
}
|
|
|
|
|
|
static FragmentExec readFragmentExec(PlanStreamInput in) throws IOException {
|
|
|
return new FragmentExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readOptionalNamedWriteable(QueryBuilder.class),
|
|
|
in.readOptionalVInt()
|
|
@@ -534,22 +544,25 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeFragmentExec(PlanStreamOutput out, FragmentExec fragmentExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(fragmentExec.fragment());
|
|
|
out.writeOptionalNamedWriteable(fragmentExec.esFilter());
|
|
|
out.writeOptionalVInt(fragmentExec.estimatedRowSize());
|
|
|
}
|
|
|
|
|
|
static GrokExec readGrokExec(PlanStreamInput in) throws IOException {
|
|
|
+ Source source;
|
|
|
return new GrokExec(
|
|
|
- Source.EMPTY,
|
|
|
+ source = in.readSource(),
|
|
|
in.readPhysicalPlanNode(),
|
|
|
in.readExpression(),
|
|
|
- Grok.pattern(Source.EMPTY, in.readString()),
|
|
|
+ Grok.pattern(source, in.readString()),
|
|
|
readAttributes(in)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
static void writeGrokExec(PlanStreamOutput out, GrokExec grokExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(grokExec.child());
|
|
|
out.writeExpression(grokExec.inputExpression());
|
|
|
out.writeString(grokExec.pattern().pattern());
|
|
@@ -557,67 +570,73 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static LimitExec readLimitExec(PlanStreamInput in) throws IOException {
|
|
|
- return new LimitExec(Source.EMPTY, in.readPhysicalPlanNode(), in.readNamed(Expression.class));
|
|
|
+ return new LimitExec(in.readSource(), in.readPhysicalPlanNode(), in.readNamed(Expression.class));
|
|
|
}
|
|
|
|
|
|
static void writeLimitExec(PlanStreamOutput out, LimitExec limitExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(limitExec.child());
|
|
|
out.writeExpression(limitExec.limit());
|
|
|
}
|
|
|
|
|
|
static MvExpandExec readMvExpandExec(PlanStreamInput in) throws IOException {
|
|
|
- return new MvExpandExec(Source.EMPTY, in.readPhysicalPlanNode(), in.readNamedExpression());
|
|
|
+ return new MvExpandExec(in.readSource(), in.readPhysicalPlanNode(), in.readNamedExpression());
|
|
|
}
|
|
|
|
|
|
static void writeMvExpandExec(PlanStreamOutput out, MvExpandExec mvExpandExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(mvExpandExec.child());
|
|
|
out.writeNamedExpression(mvExpandExec.target());
|
|
|
}
|
|
|
|
|
|
static OrderExec readOrderExec(PlanStreamInput in) throws IOException {
|
|
|
return new OrderExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readPhysicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanNamedTypes::readOrder))
|
|
|
);
|
|
|
}
|
|
|
|
|
|
static void writeOrderExec(PlanStreamOutput out, OrderExec orderExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(orderExec.child());
|
|
|
out.writeCollection(orderExec.order(), writerFromPlanWriter(PlanNamedTypes::writeOrder));
|
|
|
}
|
|
|
|
|
|
static ProjectExec readProjectExec(PlanStreamInput in) throws IOException {
|
|
|
- return new ProjectExec(Source.EMPTY, in.readPhysicalPlanNode(), readNamedExpressions(in));
|
|
|
+ return new ProjectExec(in.readSource(), in.readPhysicalPlanNode(), readNamedExpressions(in));
|
|
|
}
|
|
|
|
|
|
static void writeProjectExec(PlanStreamOutput out, ProjectExec projectExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(projectExec.child());
|
|
|
writeNamedExpressions(out, projectExec.projections());
|
|
|
}
|
|
|
|
|
|
static RowExec readRowExec(PlanStreamInput in) throws IOException {
|
|
|
- return new RowExec(Source.EMPTY, readAliases(in));
|
|
|
+ return new RowExec(in.readSource(), readAliases(in));
|
|
|
}
|
|
|
|
|
|
static void writeRowExec(PlanStreamOutput out, RowExec rowExec) throws IOException {
|
|
|
assert rowExec.children().size() == 0;
|
|
|
+ out.writeNoSource();
|
|
|
writeAliases(out, rowExec.fields());
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
static ShowExec readShowExec(PlanStreamInput in) throws IOException {
|
|
|
- return new ShowExec(Source.EMPTY, readAttributes(in), (List<List<Object>>) in.readGenericValue());
|
|
|
+ return new ShowExec(in.readSource(), readAttributes(in), (List<List<Object>>) in.readGenericValue());
|
|
|
}
|
|
|
|
|
|
static void writeShowExec(PlanStreamOutput out, ShowExec showExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
writeAttributes(out, showExec.output());
|
|
|
out.writeGenericValue(showExec.values());
|
|
|
}
|
|
|
|
|
|
static TopNExec readTopNExec(PlanStreamInput in) throws IOException {
|
|
|
return new TopNExec(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readPhysicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanNamedTypes::readOrder)),
|
|
|
in.readNamed(Expression.class),
|
|
@@ -626,6 +645,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeTopNExec(PlanStreamOutput out, TopNExec topNExec) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writePhysicalPlanNode(topNExec.child());
|
|
|
out.writeCollection(topNExec.order(), writerFromPlanWriter(PlanNamedTypes::writeOrder));
|
|
|
out.writeExpression(topNExec.limit());
|
|
@@ -635,7 +655,7 @@ public final class PlanNamedTypes {
|
|
|
// -- Logical plan nodes
|
|
|
static Aggregate readAggregate(PlanStreamInput in) throws IOException {
|
|
|
return new Aggregate(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)),
|
|
|
readNamedExpressions(in)
|
|
@@ -643,16 +663,18 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeAggregate(PlanStreamOutput out, Aggregate aggregate) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(aggregate.child());
|
|
|
out.writeCollection(aggregate.groupings(), writerFromPlanWriter(PlanStreamOutput::writeExpression));
|
|
|
writeNamedExpressions(out, aggregate.aggregates());
|
|
|
}
|
|
|
|
|
|
static Dissect readDissect(PlanStreamInput in) throws IOException {
|
|
|
- return new Dissect(Source.EMPTY, in.readLogicalPlanNode(), in.readExpression(), readDissectParser(in), readAttributes(in));
|
|
|
+ return new Dissect(in.readSource(), in.readLogicalPlanNode(), in.readExpression(), readDissectParser(in), readAttributes(in));
|
|
|
}
|
|
|
|
|
|
static void writeDissect(PlanStreamOutput out, Dissect dissect) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(dissect.child());
|
|
|
out.writeExpression(dissect.input());
|
|
|
writeDissectParser(out, dissect.parser());
|
|
@@ -660,27 +682,29 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static EsRelation readEsRelation(PlanStreamInput in) throws IOException {
|
|
|
- return new EsRelation(Source.EMPTY, readEsIndex(in), readAttributes(in));
|
|
|
+ return new EsRelation(in.readSource(), readEsIndex(in), readAttributes(in));
|
|
|
}
|
|
|
|
|
|
static void writeEsRelation(PlanStreamOutput out, EsRelation relation) throws IOException {
|
|
|
assert relation.children().size() == 0;
|
|
|
+ out.writeNoSource();
|
|
|
writeEsIndex(out, relation.index());
|
|
|
writeAttributes(out, relation.output());
|
|
|
}
|
|
|
|
|
|
static Eval readEval(PlanStreamInput in) throws IOException {
|
|
|
- return new Eval(Source.EMPTY, in.readLogicalPlanNode(), readAliases(in));
|
|
|
+ return new Eval(in.readSource(), in.readLogicalPlanNode(), readAliases(in));
|
|
|
}
|
|
|
|
|
|
static void writeEval(PlanStreamOutput out, Eval eval) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(eval.child());
|
|
|
writeAliases(out, eval.fields());
|
|
|
}
|
|
|
|
|
|
static Enrich readEnrich(PlanStreamInput in) throws IOException {
|
|
|
return new Enrich(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readExpression(),
|
|
|
in.readNamedExpression(),
|
|
@@ -690,6 +714,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeEnrich(PlanStreamOutput out, Enrich enrich) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(enrich.child());
|
|
|
out.writeExpression(enrich.policyName());
|
|
|
out.writeNamedExpression(enrich.matchField());
|
|
@@ -700,25 +725,28 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Filter readFilter(PlanStreamInput in) throws IOException {
|
|
|
- return new Filter(Source.EMPTY, in.readLogicalPlanNode(), in.readExpression());
|
|
|
+ return new Filter(in.readSource(), in.readLogicalPlanNode(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeFilter(PlanStreamOutput out, Filter filter) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(filter.child());
|
|
|
out.writeExpression(filter.condition());
|
|
|
}
|
|
|
|
|
|
static Grok readGrok(PlanStreamInput in) throws IOException {
|
|
|
+ Source source;
|
|
|
return new Grok(
|
|
|
- Source.EMPTY,
|
|
|
+ source = in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readExpression(),
|
|
|
- Grok.pattern(Source.EMPTY, in.readString()),
|
|
|
+ Grok.pattern(source, in.readString()),
|
|
|
readAttributes(in)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
static void writeGrok(PlanStreamOutput out, Grok grok) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(grok.child());
|
|
|
out.writeExpression(grok.input());
|
|
|
out.writeString(grok.parser().pattern());
|
|
@@ -726,39 +754,42 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Limit readLimit(PlanStreamInput in) throws IOException {
|
|
|
- return new Limit(Source.EMPTY, in.readNamed(Expression.class), in.readLogicalPlanNode());
|
|
|
+ return new Limit(in.readSource(), in.readNamed(Expression.class), in.readLogicalPlanNode());
|
|
|
}
|
|
|
|
|
|
static void writeLimit(PlanStreamOutput out, Limit limit) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(limit.limit());
|
|
|
out.writeLogicalPlanNode(limit.child());
|
|
|
}
|
|
|
|
|
|
static OrderBy readOrderBy(PlanStreamInput in) throws IOException {
|
|
|
return new OrderBy(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanNamedTypes::readOrder))
|
|
|
);
|
|
|
}
|
|
|
|
|
|
static void writeOrderBy(PlanStreamOutput out, OrderBy order) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(order.child());
|
|
|
out.writeCollection(order.order(), writerFromPlanWriter(PlanNamedTypes::writeOrder));
|
|
|
}
|
|
|
|
|
|
static Project readProject(PlanStreamInput in) throws IOException {
|
|
|
- return new Project(Source.EMPTY, in.readLogicalPlanNode(), readNamedExpressions(in));
|
|
|
+ return new Project(in.readSource(), in.readLogicalPlanNode(), readNamedExpressions(in));
|
|
|
}
|
|
|
|
|
|
static void writeProject(PlanStreamOutput out, Project project) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(project.child());
|
|
|
writeNamedExpressions(out, project.projections());
|
|
|
}
|
|
|
|
|
|
static TopN readTopN(PlanStreamInput in) throws IOException {
|
|
|
return new TopN(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readLogicalPlanNode(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanNamedTypes::readOrder)),
|
|
|
in.readNamed(Expression.class)
|
|
@@ -766,6 +797,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeTopN(PlanStreamOutput out, TopN topN) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeLogicalPlanNode(topN.child());
|
|
|
out.writeCollection(topN.order(), writerFromPlanWriter(PlanNamedTypes::writeOrder));
|
|
|
out.writeExpression(topN.limit());
|
|
@@ -801,7 +833,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static FieldAttribute readFieldAttribute(PlanStreamInput in) throws IOException {
|
|
|
return new FieldAttribute(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readOptionalWithReader(PlanNamedTypes::readFieldAttribute),
|
|
|
in.readString(),
|
|
|
in.dataTypeFromTypeName(in.readString()),
|
|
@@ -814,6 +846,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeFieldAttribute(PlanStreamOutput out, FieldAttribute fileAttribute) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeOptionalWriteable(fileAttribute.parent() == null ? null : o -> writeFieldAttribute(out, fileAttribute.parent()));
|
|
|
out.writeString(fileAttribute.name());
|
|
|
out.writeString(fileAttribute.dataType().typeName());
|
|
@@ -826,7 +859,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static ReferenceAttribute readReferenceAttr(PlanStreamInput in) throws IOException {
|
|
|
return new ReferenceAttribute(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readString(),
|
|
|
in.dataTypeFromTypeName(in.readString()),
|
|
|
in.readOptionalString(),
|
|
@@ -837,6 +870,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeReferenceAttr(PlanStreamOutput out, ReferenceAttribute referenceAttribute) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeString(referenceAttribute.name());
|
|
|
out.writeString(referenceAttribute.dataType().typeName());
|
|
|
out.writeOptionalString(referenceAttribute.qualifier());
|
|
@@ -847,7 +881,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static MetadataAttribute readMetadataAttr(PlanStreamInput in) throws IOException {
|
|
|
return new MetadataAttribute(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readString(),
|
|
|
in.dataTypeFromTypeName(in.readString()),
|
|
|
in.readOptionalString(),
|
|
@@ -859,6 +893,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeMetadataAttr(PlanStreamOutput out, MetadataAttribute metadataAttribute) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeString(metadataAttribute.name());
|
|
|
out.writeString(metadataAttribute.dataType().typeName());
|
|
|
out.writeOptionalString(metadataAttribute.qualifier());
|
|
@@ -870,7 +905,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static UnsupportedAttribute readUnsupportedAttr(PlanStreamInput in) throws IOException {
|
|
|
return new UnsupportedAttribute(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readString(),
|
|
|
readUnsupportedEsField(in),
|
|
|
in.readOptionalString(),
|
|
@@ -879,6 +914,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeUnsupportedAttr(PlanStreamOutput out, UnsupportedAttribute unsupportedAttribute) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeString(unsupportedAttribute.name());
|
|
|
writeUnsupportedEsField(out, unsupportedAttribute.field());
|
|
|
out.writeOptionalString(unsupportedAttribute.hasCustomMessage() ? unsupportedAttribute.unresolvedMessage() : null);
|
|
@@ -983,22 +1019,24 @@ public final class PlanNamedTypes {
|
|
|
// -- BinaryComparison
|
|
|
|
|
|
static BinaryComparison readBinComparison(PlanStreamInput in, String name) throws IOException {
|
|
|
+ var source = in.readSource();
|
|
|
var operation = in.readEnum(BinaryComparisonProcessor.BinaryComparisonOperation.class);
|
|
|
var left = in.readExpression();
|
|
|
var right = in.readExpression();
|
|
|
var zoneId = in.readOptionalZoneId();
|
|
|
return switch (operation) {
|
|
|
- case EQ -> new Equals(Source.EMPTY, left, right, zoneId);
|
|
|
- case NULLEQ -> new NullEquals(Source.EMPTY, left, right, zoneId);
|
|
|
- case NEQ -> new NotEquals(Source.EMPTY, left, right, zoneId);
|
|
|
- case GT -> new GreaterThan(Source.EMPTY, left, right, zoneId);
|
|
|
- case GTE -> new GreaterThanOrEqual(Source.EMPTY, left, right, zoneId);
|
|
|
- case LT -> new LessThan(Source.EMPTY, left, right, zoneId);
|
|
|
- case LTE -> new LessThanOrEqual(Source.EMPTY, left, right, zoneId);
|
|
|
+ case EQ -> new Equals(source, left, right, zoneId);
|
|
|
+ case NULLEQ -> new NullEquals(source, left, right, zoneId);
|
|
|
+ case NEQ -> new NotEquals(source, left, right, zoneId);
|
|
|
+ case GT -> new GreaterThan(source, left, right, zoneId);
|
|
|
+ case GTE -> new GreaterThanOrEqual(source, left, right, zoneId);
|
|
|
+ case LT -> new LessThan(source, left, right, zoneId);
|
|
|
+ case LTE -> new LessThanOrEqual(source, left, right, zoneId);
|
|
|
};
|
|
|
}
|
|
|
|
|
|
static void writeBinComparison(PlanStreamOutput out, BinaryComparison binaryComparison) throws IOException {
|
|
|
+ out.writeSource(binaryComparison.source());
|
|
|
out.writeEnum(binaryComparison.function());
|
|
|
out.writeExpression(binaryComparison.left());
|
|
|
out.writeExpression(binaryComparison.right());
|
|
@@ -1008,10 +1046,11 @@ public final class PlanNamedTypes {
|
|
|
// -- InComparison
|
|
|
|
|
|
static In readInComparison(PlanStreamInput in) throws IOException {
|
|
|
- return new In(Source.EMPTY, in.readExpression(), in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)));
|
|
|
+ return new In(in.readSource(), in.readExpression(), in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)));
|
|
|
}
|
|
|
|
|
|
static void writeInComparison(PlanStreamOutput out, In in) throws IOException {
|
|
|
+ out.writeSource(in.source());
|
|
|
out.writeExpression(in.value());
|
|
|
out.writeCollection(in.list(), writerFromPlanWriter(PlanStreamOutput::writeExpression));
|
|
|
}
|
|
@@ -1019,19 +1058,21 @@ public final class PlanNamedTypes {
|
|
|
// -- RegexMatch
|
|
|
|
|
|
static WildcardLike readWildcardLike(PlanStreamInput in, String name) throws IOException {
|
|
|
- return new WildcardLike(Source.EMPTY, in.readExpression(), new WildcardPattern(in.readString()));
|
|
|
+ return new WildcardLike(in.readSource(), in.readExpression(), new WildcardPattern(in.readString()));
|
|
|
}
|
|
|
|
|
|
static void writeWildcardLike(PlanStreamOutput out, WildcardLike like) throws IOException {
|
|
|
+ out.writeSource(like.source());
|
|
|
out.writeExpression(like.field());
|
|
|
out.writeString(like.pattern().pattern());
|
|
|
}
|
|
|
|
|
|
static RLike readRLike(PlanStreamInput in, String name) throws IOException {
|
|
|
- return new RLike(Source.EMPTY, in.readExpression(), new RLikePattern(in.readString()));
|
|
|
+ return new RLike(in.readSource(), in.readExpression(), new RLikePattern(in.readString()));
|
|
|
}
|
|
|
|
|
|
static void writeRLike(PlanStreamOutput out, RLike like) throws IOException {
|
|
|
+ out.writeSource(like.source());
|
|
|
out.writeExpression(like.field());
|
|
|
out.writeString(like.pattern().asJavaRegex());
|
|
|
}
|
|
@@ -1044,12 +1085,14 @@ public final class PlanNamedTypes {
|
|
|
);
|
|
|
|
|
|
static BinaryLogic readBinaryLogic(PlanStreamInput in, String name) throws IOException {
|
|
|
+ var source = in.readSource();
|
|
|
var left = in.readExpression();
|
|
|
var right = in.readExpression();
|
|
|
- return BINARY_LOGIC_CTRS.get(name).apply(Source.EMPTY, left, right);
|
|
|
+ return BINARY_LOGIC_CTRS.get(name).apply(source, left, right);
|
|
|
}
|
|
|
|
|
|
static void writeBinaryLogic(PlanStreamOutput out, BinaryLogic binaryLogic) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(binaryLogic.left());
|
|
|
out.writeExpression(binaryLogic.right());
|
|
|
}
|
|
@@ -1097,10 +1140,11 @@ public final class PlanNamedTypes {
|
|
|
if (ctr == null) {
|
|
|
throw new IOException("Constructor for ESQLUnaryScalar not found for name:" + name);
|
|
|
}
|
|
|
- return ctr.apply(Source.EMPTY, in.readExpression());
|
|
|
+ return ctr.apply(in.readSource(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeESQLUnaryScalar(PlanStreamOutput out, UnaryScalarFunction function) throws IOException {
|
|
|
+ out.writeSource(function.source());
|
|
|
out.writeExpression(function.field());
|
|
|
}
|
|
|
|
|
@@ -1115,10 +1159,12 @@ public final class PlanNamedTypes {
|
|
|
if (ctr == null) {
|
|
|
throw new IOException("Constructor not found:" + name);
|
|
|
}
|
|
|
- return ctr.apply(Source.EMPTY);
|
|
|
+ return ctr.apply(in.readSource());
|
|
|
}
|
|
|
|
|
|
- static void writeNoArgScalar(PlanStreamOutput out, ScalarFunction function) {}
|
|
|
+ static void writeNoArgScalar(PlanStreamOutput out, ScalarFunction function) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
+ }
|
|
|
|
|
|
static final Map<
|
|
|
String,
|
|
@@ -1135,30 +1181,33 @@ public final class PlanNamedTypes {
|
|
|
if (ctr == null) {
|
|
|
throw new IOException("Constructor for QLUnaryScalar not found for name:" + name);
|
|
|
}
|
|
|
- return ctr.apply(Source.EMPTY, in.readExpression());
|
|
|
+ return ctr.apply(in.readSource(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeQLUnaryScalar(PlanStreamOutput out, org.elasticsearch.xpack.ql.expression.function.scalar.UnaryScalarFunction function)
|
|
|
throws IOException {
|
|
|
+ out.writeSource(function.source());
|
|
|
out.writeExpression(function.field());
|
|
|
}
|
|
|
|
|
|
// -- ScalarFunction
|
|
|
|
|
|
static Atan2 readAtan2(PlanStreamInput in) throws IOException {
|
|
|
- return new Atan2(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Atan2(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeAtan2(PlanStreamOutput out, Atan2 atan2) throws IOException {
|
|
|
+ out.writeSource(atan2.source());
|
|
|
out.writeExpression(atan2.y());
|
|
|
out.writeExpression(atan2.x());
|
|
|
}
|
|
|
|
|
|
static AutoBucket readAutoBucket(PlanStreamInput in) throws IOException {
|
|
|
- return new AutoBucket(Source.EMPTY, in.readExpression(), in.readExpression(), in.readExpression(), in.readExpression());
|
|
|
+ return new AutoBucket(in.readSource(), in.readExpression(), in.readExpression(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeAutoBucket(PlanStreamOutput out, AutoBucket bucket) throws IOException {
|
|
|
+ out.writeSource(bucket.source());
|
|
|
out.writeExpression(bucket.field());
|
|
|
out.writeExpression(bucket.buckets());
|
|
|
out.writeExpression(bucket.from());
|
|
@@ -1175,10 +1224,11 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static ScalarFunction readVarag(PlanStreamInput in, String name) throws IOException {
|
|
|
return VARARG_CTORS.get(name)
|
|
|
- .apply(Source.EMPTY, in.readExpression(), in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)));
|
|
|
+ .apply(in.readSource(), in.readExpression(), in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression)));
|
|
|
}
|
|
|
|
|
|
static void writeVararg(PlanStreamOutput out, ScalarFunction vararg) throws IOException {
|
|
|
+ out.writeSource(vararg.source());
|
|
|
out.writeExpression(vararg.children().get(0));
|
|
|
out.writeCollection(
|
|
|
vararg.children().subList(1, vararg.children().size()),
|
|
@@ -1187,21 +1237,23 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static CountDistinct readCountDistinct(PlanStreamInput in) throws IOException {
|
|
|
- return new CountDistinct(Source.EMPTY, in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
+ return new CountDistinct(in.readSource(), in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
}
|
|
|
|
|
|
static void writeCountDistinct(PlanStreamOutput out, CountDistinct countDistinct) throws IOException {
|
|
|
List<Expression> fields = countDistinct.children();
|
|
|
assert fields.size() == 1 || fields.size() == 2;
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(fields.get(0));
|
|
|
out.writeOptionalWriteable(fields.size() == 2 ? o -> out.writeExpression(fields.get(1)) : null);
|
|
|
}
|
|
|
|
|
|
static DateExtract readDateExtract(PlanStreamInput in) throws IOException {
|
|
|
- return new DateExtract(Source.EMPTY, in.readExpression(), in.readExpression(), in.configuration());
|
|
|
+ return new DateExtract(in.readSource(), in.readExpression(), in.readExpression(), in.configuration());
|
|
|
}
|
|
|
|
|
|
static void writeDateExtract(PlanStreamOutput out, DateExtract function) throws IOException {
|
|
|
+ out.writeSource(function.source());
|
|
|
List<Expression> fields = function.children();
|
|
|
assert fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1209,10 +1261,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static DateFormat readDateFormat(PlanStreamInput in) throws IOException {
|
|
|
- return new DateFormat(Source.EMPTY, in.readExpression(), in.readOptionalNamed(Expression.class), in.configuration());
|
|
|
+ return new DateFormat(in.readSource(), in.readExpression(), in.readOptionalNamed(Expression.class), in.configuration());
|
|
|
}
|
|
|
|
|
|
static void writeDateFormat(PlanStreamOutput out, DateFormat dateFormat) throws IOException {
|
|
|
+ out.writeSource(dateFormat.source());
|
|
|
List<Expression> fields = dateFormat.children();
|
|
|
assert fields.size() == 1 || fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1220,10 +1273,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static DateParse readDateTimeParse(PlanStreamInput in) throws IOException {
|
|
|
- return new DateParse(Source.EMPTY, in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
+ return new DateParse(in.readSource(), in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
}
|
|
|
|
|
|
static void writeDateTimeParse(PlanStreamOutput out, DateParse function) throws IOException {
|
|
|
+ out.writeSource(function.source());
|
|
|
List<Expression> fields = function.children();
|
|
|
assert fields.size() == 1 || fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1231,10 +1285,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static DateTrunc readDateTrunc(PlanStreamInput in) throws IOException {
|
|
|
- return new DateTrunc(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new DateTrunc(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeDateTrunc(PlanStreamOutput out, DateTrunc dateTrunc) throws IOException {
|
|
|
+ out.writeSource(dateTrunc.source());
|
|
|
List<Expression> fields = dateTrunc.children();
|
|
|
assert fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1242,45 +1297,51 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Now readNow(PlanStreamInput in) throws IOException {
|
|
|
- return new Now(Source.EMPTY, in.configuration());
|
|
|
+ return new Now(in.readSource(), in.configuration());
|
|
|
}
|
|
|
|
|
|
- static void writeNow(PlanStreamOutput out, Now function) {}
|
|
|
+ static void writeNow(PlanStreamOutput out, Now function) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
+ }
|
|
|
|
|
|
static Round readRound(PlanStreamInput in) throws IOException {
|
|
|
- return new Round(Source.EMPTY, in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
+ return new Round(in.readSource(), in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
}
|
|
|
|
|
|
static void writeRound(PlanStreamOutput out, Round round) throws IOException {
|
|
|
+ out.writeSource(round.source());
|
|
|
out.writeExpression(round.field());
|
|
|
out.writeOptionalExpression(round.decimals());
|
|
|
}
|
|
|
|
|
|
static Pow readPow(PlanStreamInput in) throws IOException {
|
|
|
- return new Pow(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Pow(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writePow(PlanStreamOutput out, Pow pow) throws IOException {
|
|
|
+ out.writeSource(pow.source());
|
|
|
out.writeExpression(pow.base());
|
|
|
out.writeExpression(pow.exponent());
|
|
|
}
|
|
|
|
|
|
static Percentile readPercentile(PlanStreamInput in) throws IOException {
|
|
|
- return new Percentile(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Percentile(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writePercentile(PlanStreamOutput out, Percentile percentile) throws IOException {
|
|
|
List<Expression> fields = percentile.children();
|
|
|
assert fields.size() == 2 : "percentile() aggregation must have two arguments";
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(fields.get(0));
|
|
|
out.writeExpression(fields.get(1));
|
|
|
}
|
|
|
|
|
|
static StartsWith readStartsWith(PlanStreamInput in) throws IOException {
|
|
|
- return new StartsWith(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new StartsWith(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeStartsWith(PlanStreamOutput out, StartsWith startsWith) throws IOException {
|
|
|
+ out.writeSource(startsWith.source());
|
|
|
List<Expression> fields = startsWith.children();
|
|
|
assert fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1288,21 +1349,23 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static EndsWith readEndsWith(PlanStreamInput in) throws IOException {
|
|
|
- return new EndsWith(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new EndsWith(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeEndsWith(PlanStreamOutput out, EndsWith endsWith) throws IOException {
|
|
|
List<Expression> fields = endsWith.children();
|
|
|
assert fields.size() == 2;
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(fields.get(0));
|
|
|
out.writeExpression(fields.get(1));
|
|
|
}
|
|
|
|
|
|
static Substring readSubstring(PlanStreamInput in) throws IOException {
|
|
|
- return new Substring(Source.EMPTY, in.readExpression(), in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
+ return new Substring(in.readSource(), in.readExpression(), in.readExpression(), in.readOptionalNamed(Expression.class));
|
|
|
}
|
|
|
|
|
|
static void writeSubstring(PlanStreamOutput out, Substring substring) throws IOException {
|
|
|
+ out.writeSource(substring.source());
|
|
|
List<Expression> fields = substring.children();
|
|
|
assert fields.size() == 2 || fields.size() == 3;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1323,10 +1386,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Left readLeft(PlanStreamInput in) throws IOException {
|
|
|
- return new Left(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Left(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeLeft(PlanStreamOutput out, Left left) throws IOException {
|
|
|
+ out.writeSource(left.source());
|
|
|
List<Expression> fields = left.children();
|
|
|
assert fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1334,10 +1398,11 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Right readRight(PlanStreamInput in) throws IOException {
|
|
|
- return new Right(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Right(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeRight(PlanStreamOutput out, Right right) throws IOException {
|
|
|
+ out.writeSource(right.source());
|
|
|
List<Expression> fields = right.children();
|
|
|
assert fields.size() == 2;
|
|
|
out.writeExpression(fields.get(0));
|
|
@@ -1345,23 +1410,25 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static Split readSplit(PlanStreamInput in) throws IOException {
|
|
|
- return new Split(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new Split(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeSplit(PlanStreamOutput out, Split split) throws IOException {
|
|
|
+ out.writeSource(split.source());
|
|
|
out.writeExpression(split.left());
|
|
|
out.writeExpression(split.right());
|
|
|
}
|
|
|
|
|
|
static CIDRMatch readCIDRMatch(PlanStreamInput in) throws IOException {
|
|
|
return new CIDRMatch(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readExpression(),
|
|
|
in.readCollectionAsList(readerFromPlanReader(PlanStreamInput::readExpression))
|
|
|
);
|
|
|
}
|
|
|
|
|
|
static void writeCIDRMatch(PlanStreamOutput out, CIDRMatch cidrMatch) throws IOException {
|
|
|
+ out.writeSource(cidrMatch.source());
|
|
|
List<Expression> children = cidrMatch.children();
|
|
|
assert children.size() > 1;
|
|
|
out.writeExpression(children.get(0));
|
|
@@ -1379,12 +1446,14 @@ public final class PlanNamedTypes {
|
|
|
);
|
|
|
|
|
|
static ArithmeticOperation readArithmeticOperation(PlanStreamInput in, String name) throws IOException {
|
|
|
+ var source = in.readSource();
|
|
|
var left = in.readExpression();
|
|
|
var right = in.readExpression();
|
|
|
- return ARITHMETIC_CTRS.get(name).apply(Source.EMPTY, left, right);
|
|
|
+ return ARITHMETIC_CTRS.get(name).apply(source, left, right);
|
|
|
}
|
|
|
|
|
|
static void writeArithmeticOperation(PlanStreamOutput out, ArithmeticOperation arithmeticOperation) throws IOException {
|
|
|
+ out.writeSource(arithmeticOperation.source());
|
|
|
out.writeExpression(arithmeticOperation.left());
|
|
|
out.writeExpression(arithmeticOperation.right());
|
|
|
}
|
|
@@ -1401,10 +1470,11 @@ public final class PlanNamedTypes {
|
|
|
);
|
|
|
|
|
|
static AggregateFunction readAggFunction(PlanStreamInput in, String name) throws IOException {
|
|
|
- return AGG_CTRS.get(name).apply(Source.EMPTY, in.readExpression());
|
|
|
+ return AGG_CTRS.get(name).apply(in.readSource(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeAggFunction(PlanStreamOutput out, AggregateFunction aggregateFunction) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(aggregateFunction.field());
|
|
|
}
|
|
|
|
|
@@ -1420,18 +1490,20 @@ public final class PlanNamedTypes {
|
|
|
);
|
|
|
|
|
|
static AbstractMultivalueFunction readMvFunction(PlanStreamInput in, String name) throws IOException {
|
|
|
- return MV_CTRS.get(name).apply(Source.EMPTY, in.readExpression());
|
|
|
+ return MV_CTRS.get(name).apply(in.readSource(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeMvFunction(PlanStreamOutput out, AbstractMultivalueFunction fn) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(fn.field());
|
|
|
}
|
|
|
|
|
|
static MvConcat readMvConcat(PlanStreamInput in) throws IOException {
|
|
|
- return new MvConcat(Source.EMPTY, in.readExpression(), in.readExpression());
|
|
|
+ return new MvConcat(in.readSource(), in.readExpression(), in.readExpression());
|
|
|
}
|
|
|
|
|
|
static void writeMvConcat(PlanStreamOutput out, MvConcat fn) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(fn.left());
|
|
|
out.writeExpression(fn.right());
|
|
|
}
|
|
@@ -1440,7 +1512,7 @@ public final class PlanNamedTypes {
|
|
|
|
|
|
static Alias readAlias(PlanStreamInput in) throws IOException {
|
|
|
return new Alias(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readString(),
|
|
|
in.readOptionalString(),
|
|
|
in.readNamed(Expression.class),
|
|
@@ -1450,6 +1522,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeAlias(PlanStreamOutput out, Alias alias) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeString(alias.name());
|
|
|
out.writeOptionalString(alias.qualifier());
|
|
|
out.writeExpression(alias.child());
|
|
@@ -1460,17 +1533,18 @@ public final class PlanNamedTypes {
|
|
|
// -- Expressions (other)
|
|
|
|
|
|
static Literal readLiteral(PlanStreamInput in) throws IOException {
|
|
|
- return new Literal(Source.EMPTY, in.readGenericValue(), in.dataTypeFromTypeName(in.readString()));
|
|
|
+ return new Literal(in.readSource(), in.readGenericValue(), in.dataTypeFromTypeName(in.readString()));
|
|
|
}
|
|
|
|
|
|
static void writeLiteral(PlanStreamOutput out, Literal literal) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeGenericValue(literal.value());
|
|
|
out.writeString(literal.dataType().typeName());
|
|
|
}
|
|
|
|
|
|
static Order readOrder(PlanStreamInput in) throws IOException {
|
|
|
return new org.elasticsearch.xpack.esql.expression.Order(
|
|
|
- Source.EMPTY,
|
|
|
+ in.readSource(),
|
|
|
in.readNamed(Expression.class),
|
|
|
in.readEnum(Order.OrderDirection.class),
|
|
|
in.readEnum(Order.NullsPosition.class)
|
|
@@ -1478,6 +1552,7 @@ public final class PlanNamedTypes {
|
|
|
}
|
|
|
|
|
|
static void writeOrder(PlanStreamOutput out, Order order) throws IOException {
|
|
|
+ out.writeNoSource();
|
|
|
out.writeExpression(order.child());
|
|
|
out.writeEnum(order.direction());
|
|
|
out.writeEnum(order.nullsPosition());
|