org.elasticsearch.xpack.esql.plan.physical.EvalExec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x-pack-esql Show documentation
Show all versions of x-pack-esql Show documentation
The plugin that powers ESQL for Elasticsearch
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.esql.plan.physical;
import org.elasticsearch.xpack.esql.core.expression.Alias;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
import java.util.List;
import java.util.Objects;
import static org.elasticsearch.xpack.esql.expression.NamedExpressions.mergeOutputAttributes;
public class EvalExec extends UnaryExec implements EstimatesRowSize {
private final List fields;
public EvalExec(Source source, PhysicalPlan child, List fields) {
super(source, child);
this.fields = fields;
}
public List fields() {
return fields;
}
@Override
public List output() {
return mergeOutputAttributes(fields, child().output());
}
@Override
public UnaryExec replaceChild(PhysicalPlan newChild) {
return new EvalExec(source(), newChild, fields);
}
@Override
protected NodeInfo extends PhysicalPlan> info() {
return NodeInfo.create(this, EvalExec::new, child(), fields);
}
@Override
public PhysicalPlan estimateRowSize(State state) {
state.add(false, fields);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EvalExec eval = (EvalExec) o;
return child().equals(eval.child()) && Objects.equals(fields, eval.fields);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), fields);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy