SQL: Preserve original source for each expression (#36912)

Improve parsing to save the source for each token alongside the location 
 of each Node/Expression for accurate reproducibility of an expression
 name and source

Fix #36894
This commit is contained in:
Costin Leau 2019-01-04 00:57:50 +02:00 committed by GitHub
parent 7686ee7631
commit 40a30c6f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
337 changed files with 1984 additions and 1896 deletions

View File

@ -121,19 +121,19 @@ public class SslConfig {
}
private KeyStore loadKeyStore(String location, char[] pass, String keyStoreType) throws GeneralSecurityException, IOException {
private KeyStore loadKeyStore(String source, char[] pass, String keyStoreType) throws GeneralSecurityException, IOException {
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
Path path = Paths.get(location);
Path path = Paths.get(source);
if (!Files.exists(path)) {
throw new ClientException(
"Expected to find keystore file at [" + location + "] but was unable to. Make sure you have specified a valid URI.");
"Expected to find keystore file at [" + source + "] but was unable to. Make sure you have specified a valid URI.");
}
try (InputStream in = Files.newInputStream(Paths.get(location), StandardOpenOption.READ)) {
try (InputStream in = Files.newInputStream(Paths.get(source), StandardOpenOption.READ)) {
keyStore.load(in, pass);
} catch (Exception ex) {
throw new ClientException("Cannot open keystore [" + location + "] - " + ex.getMessage(), ex);
throw new ClientException("Cannot open keystore [" + source + "] - " + ex.getMessage(), ex);
} finally {
}
@ -174,6 +174,7 @@ public class SslConfig {
&& Objects.equals(truststoreType, other.truststoreType);
}
@Override
public int hashCode() {
return getClass().hashCode();
}

View File

@ -21,8 +21,8 @@ public class AnalysisException extends ClientSqlException {
super(message, args);
Location loc = Location.EMPTY;
if (source != null && source.location() != null) {
loc = source.location();
if (source != null && source.source() != null) {
loc = source.source().source();
}
this.line = loc.getLineNumber();
this.column = loc.getColumnNumber();
@ -32,8 +32,8 @@ public class AnalysisException extends ClientSqlException {
super(message, cause);
Location loc = Location.EMPTY;
if (source != null && source.location() != null) {
loc = source.location();
if (source != null && source.source() != null) {
loc = source.source().source();
}
this.line = loc.getLineNumber();
this.column = loc.getColumnNumber();

View File

@ -173,7 +173,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
// but also if the qualifier might not be quoted and if there's any ambiguity with nested fields
|| Objects.equals(u.name(), attribute.qualifiedName()));
if (match) {
matches.add(attribute.withLocation(u.location()));
matches.add(attribute.withLocation(u.source()));
}
}
}
@ -251,7 +251,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
SubQueryAlias subQueryAlias = subQueries.get(ur.table().index());
if (subQueryAlias != null) {
if (ur.alias() != null) {
return new SubQueryAlias(ur.location(), subQueryAlias, ur.alias());
return new SubQueryAlias(ur.source(), subQueryAlias, ur.alias());
}
return subQueryAlias;
}
@ -282,15 +282,15 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
protected LogicalPlan rule(UnresolvedRelation plan) {
TableIdentifier table = plan.table();
if (indexResolution.isValid() == false) {
return plan.unresolvedMessage().equals(indexResolution.toString()) ? plan : new UnresolvedRelation(plan.location(),
return plan.unresolvedMessage().equals(indexResolution.toString()) ? plan : new UnresolvedRelation(plan.source(),
plan.table(), plan.alias(), indexResolution.toString());
}
assert indexResolution.matches(table.index());
LogicalPlan logicalPlan = new EsRelation(plan.location(), indexResolution.get());
SubQueryAlias sa = new SubQueryAlias(plan.location(), logicalPlan, table.index());
LogicalPlan logicalPlan = new EsRelation(plan.source(), indexResolution.get());
SubQueryAlias sa = new SubQueryAlias(plan.source(), logicalPlan, table.index());
if (plan.alias() != null) {
sa = new SubQueryAlias(plan.location(), sa, plan.alias());
sa = new SubQueryAlias(plan.source(), sa, plan.alias());
}
return sa;
@ -311,13 +311,13 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (plan instanceof Project) {
Project p = (Project) plan;
if (hasStar(p.projections())) {
return new Project(p.location(), p.child(), expandProjections(p.projections(), p.child()));
return new Project(p.source(), p.child(), expandProjections(p.projections(), p.child()));
}
}
else if (plan instanceof Aggregate) {
Aggregate a = (Aggregate) plan;
if (hasStar(a.aggregates())) {
return new Aggregate(a.location(), a.child(), a.groupings(),
return new Aggregate(a.source(), a.child(), a.groupings(),
expandProjections(a.aggregates(), a.child()));
}
// if the grouping is unresolved but the aggs are, use the latter to resolve the former
@ -339,7 +339,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
newGroupings.add(grouping);
}
return changed ? new Aggregate(a.location(), a.child(), newGroupings, a.aggregates()) : a;
return changed ? new Aggregate(a.source(), a.child(), newGroupings, a.aggregates()) : a;
}
}
@ -347,7 +347,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
Join j = (Join) plan;
if (!j.duplicatesResolved()) {
LogicalPlan deduped = dedupRight(j.left(), j.right());
return new Join(j.location(), j.left(), deduped, j.type(), j.condition());
return new Join(j.source(), j.left(), deduped, j.type(), j.condition());
}
}
// try resolving the order expression (the children are resolved as this point)
@ -357,7 +357,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
List<Order> resolvedOrder = o.order().stream()
.map(or -> resolveExpression(or, o.child()))
.collect(toList());
return new OrderBy(o.location(), o.child(), resolvedOrder);
return new OrderBy(o.source(), o.child(), resolvedOrder);
}
}
@ -442,12 +442,12 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
}
if (q.qualifier() != null) {
if (Objects.equals(q.qualifiedName(), fa.qualifiedPath())) {
expanded.add(fa.withLocation(attr.location()));
expanded.add(fa.withLocation(attr.source()));
}
} else {
// use the path only to match non-compound types
if (Objects.equals(q.name(), fa.path())) {
expanded.add(fa.withLocation(attr.location()));
expanded.add(fa.withLocation(attr.source()));
}
}
}
@ -516,7 +516,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (ordinal != null) {
changed = true;
if (ordinal > 0 && ordinal <= max) {
newOrder.add(new Order(order.location(), orderBy.child().output().get(ordinal - 1), order.direction(),
newOrder.add(new Order(order.source(), orderBy.child().output().get(ordinal - 1), order.direction(),
order.nullsPosition()));
}
else {
@ -528,7 +528,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
}
}
return changed ? new OrderBy(orderBy.location(), orderBy.child(), newOrder) : orderBy;
return changed ? new OrderBy(orderBy.source(), orderBy.child(), newOrder) : orderBy;
}
if (plan instanceof Aggregate) {
@ -565,7 +565,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
}
}
return changed ? new Aggregate(agg.location(), agg.child(), newGroupings, aggregates) : agg;
return changed ? new Aggregate(agg.source(), agg.child(), newGroupings, aggregates) : agg;
}
return plan;
@ -629,15 +629,15 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
newOrders.add(order.equals(transformed) ? order : transformed);
}
return o.order().equals(newOrders) ? o : new OrderBy(o.location(), o.child(), newOrders);
return o.order().equals(newOrders) ? o : new OrderBy(o.source(), o.child(), newOrders);
}
// everything worked
return new Project(o.location(), new OrderBy(o.location(), newChild, maybeResolved), o.child().output());
return new Project(o.source(), new OrderBy(o.source(), newChild, maybeResolved), o.child().output());
}
if (!maybeResolved.equals(o.order())) {
return new OrderBy(o.location(), o.child(), maybeResolved);
return new OrderBy(o.source(), o.child(), maybeResolved);
}
}
@ -661,14 +661,14 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
Expression transformed = f.condition().transformUp(ua -> resolveMetadataToMessage(ua, failedAttrs, "filter"),
UnresolvedAttribute.class);
return f.condition().equals(transformed) ? f : new Filter(f.location(), f.child(), transformed);
return f.condition().equals(transformed) ? f : new Filter(f.source(), f.child(), transformed);
}
return new Project(f.location(), new Filter(f.location(), newChild, maybeResolved), f.child().output());
return new Project(f.source(), new Filter(f.source(), newChild, maybeResolved), f.child().output());
}
if (!maybeResolved.equals(f.condition())) {
return new Filter(f.location(), f.child(), maybeResolved);
return new Filter(f.source(), f.child(), maybeResolved);
}
}
@ -696,7 +696,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (plan instanceof Project) {
Project p = (Project) plan;
AttributeSet diff = missing.subtract(p.child().outputSet());
return new Project(p.location(), propagateMissing(p.child(), diff, failed), combine(p.projections(), missing));
return new Project(p.source(), propagateMissing(p.child(), diff, failed), combine(p.projections(), missing));
}
if (plan instanceof Aggregate) {
@ -707,7 +707,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (!Expressions.anyMatch(a.groupings(), m::semanticEquals)) {
if (m instanceof Attribute) {
// pass failure information to help the verifier
m = new UnresolvedAttribute(m.location(), m.name(), m.qualifier(), null, null,
m = new UnresolvedAttribute(m.source(), m.name(), m.qualifier(), null, null,
new AggGroupingFailure(Expressions.names(a.groupings())));
}
failed.add(m);
@ -717,7 +717,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (!failed.isEmpty()) {
return plan;
}
return new Aggregate(a.location(), a.child(), a.groupings(), combine(a.aggregates(), missing));
return new Aggregate(a.source(), a.child(), a.groupings(), combine(a.aggregates(), missing));
}
// LeafPlans are tables and BinaryPlans are joins so pushing can only happen on unary
@ -845,14 +845,14 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (plan instanceof Project) {
Project p = (Project) plan;
if (p.childrenResolved() && hasUnresolvedAliases(p.projections())) {
return new Project(p.location(), p.child(), assignAliases(p.projections()));
return new Project(p.source(), p.child(), assignAliases(p.projections()));
}
return p;
}
if (plan instanceof Aggregate) {
Aggregate a = (Aggregate) plan;
if (a.childrenResolved() && hasUnresolvedAliases(a.aggregates())) {
return new Aggregate(a.location(), a.child(), a.groupings(), assignAliases(a.aggregates()));
return new Aggregate(a.source(), a.child(), a.groupings(), assignAliases(a.aggregates()));
}
return a;
}
@ -879,11 +879,11 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (child instanceof Cast) {
Cast c = (Cast) child;
if (c.field() instanceof NamedExpression) {
return new Alias(c.location(), ((NamedExpression) c.field()).name(), c);
return new Alias(c.source(), ((NamedExpression) c.field()).name(), c);
}
}
//TODO: maybe add something closer to SQL
return new Alias(child.location(), child.toString(), child);
return new Alias(child.source(), child.toString(), child);
}, UnresolvedAlias.class);
newExpr.add(expr.equals(transformed) ? expr : transformed);
}
@ -900,7 +900,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
@Override
protected LogicalPlan rule(Project p) {
if (containsAggregate(p.projections())) {
return new Aggregate(p.location(), p.child(), emptyList(), p.projections());
return new Aggregate(p.source(), p.child(), emptyList(), p.projections());
}
return p;
}
@ -934,8 +934,8 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
// so try resolving the condition in one go through a 'dummy' aggregate
if (!condition.resolved()) {
// that's why try to resolve the condition
Aggregate tryResolvingCondition = new Aggregate(agg.location(), agg.child(), agg.groupings(),
combine(agg.aggregates(), new Alias(f.location(), ".having", condition)));
Aggregate tryResolvingCondition = new Aggregate(agg.source(), agg.child(), agg.groupings(),
combine(agg.aggregates(), new Alias(f.source(), ".having", condition)));
tryResolvingCondition = (Aggregate) analyze(tryResolvingCondition, false);
@ -953,14 +953,14 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
missing = findMissingAggregate(agg, condition);
if (!missing.isEmpty()) {
Aggregate newAgg = new Aggregate(agg.location(), agg.child(), agg.groupings(),
Aggregate newAgg = new Aggregate(agg.source(), agg.child(), agg.groupings(),
combine(agg.aggregates(), missing));
Filter newFilter = new Filter(f.location(), newAgg, condition);
Filter newFilter = new Filter(f.source(), newAgg, condition);
// preserve old output
return new Project(f.location(), newFilter, f.output());
return new Project(f.source(), newFilter, f.output());
}
return new Filter(f.location(), f.child(), condition);
return new Filter(f.source(), f.child(), condition);
}
return plan;
}
@ -1054,8 +1054,8 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (common == null) {
return e;
}
left = l == common ? left : new Cast(left.location(), left, common);
right = r == common ? right : new Cast(right.location(), right, common);
left = l == common ? left : new Cast(left.source(), left, common);
right = r == common ? right : new Cast(right.source(), right, common);
return e.replaceChildren(Arrays.asList(left, right));
}
}
@ -1086,14 +1086,14 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
protected LogicalPlan rule(LogicalPlan plan) {
if (plan instanceof Project) {
Project p = (Project) plan;
return new Project(p.location(), p.child(), cleanExpressions(p.projections()));
return new Project(p.source(), p.child(), cleanExpressions(p.projections()));
}
if (plan instanceof Aggregate) {
Aggregate a = (Aggregate) plan;
// clean group expressions
List<Expression> cleanedGroups = a.groupings().stream().map(CleanAliases::trimAliases).collect(toList());
return new Aggregate(a.location(), a.child(), cleanedGroups, cleanExpressions(a.aggregates()));
return new Aggregate(a.source(), a.child(), cleanedGroups, cleanExpressions(a.aggregates()));
}
return plan.transformExpressionsOnly(e -> {
@ -1111,7 +1111,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
public static Expression trimNonTopLevelAliases(Expression e) {
if (e instanceof Alias) {
Alias a = (Alias) e;
return new Alias(a.location(), a.name(), a.qualifier(), trimAliases(a.child()), a.id());
return new Alias(a.source(), a.name(), a.qualifier(), trimAliases(a.child()), a.id());
}
return trimAliases(e);
}

View File

@ -5,14 +5,14 @@
*/
package org.elasticsearch.xpack.sql.analysis.analyzer;
import java.util.Collection;
import java.util.stream.Collectors;
import org.elasticsearch.xpack.sql.analysis.AnalysisException;
import org.elasticsearch.xpack.sql.analysis.analyzer.Verifier.Failure;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.util.StringUtils;
import java.util.Collection;
import java.util.stream.Collectors;
public class VerificationException extends AnalysisException {
@ -27,7 +27,7 @@ public class VerificationException extends AnalysisException {
public String getMessage() {
return failures.stream()
.map(f -> {
Location l = f.source().location();
Location l = f.source().source().source();
return "line " + l.getLineNumber() + ":" + l.getColumnNumber() + ": " + f.message();
})
.collect(Collectors.joining(StringUtils.NEW_LINE, "Found " + failures.size() + " problem(s)\n", StringUtils.EMPTY));

View File

@ -281,7 +281,7 @@ public class Querier {
// wrap only agg inputs
proc = proc.transformDown(l -> {
BucketExtractor be = createExtractor(l.context(), totalCount);
return new AggExtractorInput(l.location(), l.expression(), l.action(), be);
return new AggExtractorInput(l.source(), l.expression(), l.action(), be);
}, AggPathInput.class);
return new ComputingExtractor(proc.asProcessor());
@ -364,7 +364,7 @@ public class Querier {
throw new SqlIllegalArgumentException("Multi-level nested fields [{}] not supported yet", hitNames);
}
return new HitExtractorInput(l.location(), l.expression(), he);
return new HitExtractorInput(l.source(), l.expression(), he);
}, ReferenceInput.class);
String hitName = null;
if (hitNames.size() == 1) {

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.EsField;
@ -36,20 +36,20 @@ public class Alias extends NamedExpression {
*/
private Attribute lazyAttribute;
public Alias(Location location, String name, Expression child) {
this(location, name, null, child, null);
public Alias(Source source, String name, Expression child) {
this(source, name, null, child, null);
}
public Alias(Location location, String name, String qualifier, Expression child) {
this(location, name, qualifier, child, null);
public Alias(Source source, String name, String qualifier, Expression child) {
this(source, name, qualifier, child, null);
}
public Alias(Location location, String name, String qualifier, Expression child, ExpressionId id) {
this(location, name, qualifier, child, id, false);
public Alias(Source source, String name, String qualifier, Expression child, ExpressionId id) {
this(source, name, qualifier, child, id, false);
}
public Alias(Location location, String name, String qualifier, Expression child, ExpressionId id, boolean synthetic) {
super(location, name, singletonList(child), id, synthetic);
public Alias(Source source, String name, String qualifier, Expression child, ExpressionId id, boolean synthetic) {
super(source, name, singletonList(child), id, synthetic);
this.child = child;
this.qualifier = qualifier;
}
@ -64,7 +64,7 @@ public class Alias extends NamedExpression {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Alias(location(), name(), qualifier, newChildren.get(0), id(), synthetic());
return new Alias(source(), name(), qualifier, newChildren.get(0), id(), synthetic());
}
public Expression child() {
@ -104,17 +104,17 @@ public class Alias extends NamedExpression {
Attribute attr = Expressions.attribute(c);
if (attr != null) {
return attr.clone(location(), name(), qualifier, child.nullable(), id(), synthetic());
return attr.clone(source(), name(), qualifier, child.nullable(), id(), synthetic());
}
else {
// TODO: WE need to fix this fake Field
return new FieldAttribute(location(), null, name(),
return new FieldAttribute(source(), null, name(),
new EsField(name(), child.dataType(), Collections.emptyMap(), true),
qualifier, child.nullable(), id(), synthetic());
}
}
return new UnresolvedAttribute(location(), name(), qualifier);
return new UnresolvedAttribute(source(), name(), qualifier);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.List;
@ -44,16 +44,16 @@ public abstract class Attribute extends NamedExpression {
// can the attr be null - typically used in JOINs
private final boolean nullable;
public Attribute(Location location, String name, String qualifier, ExpressionId id) {
this(location, name, qualifier, true, id);
public Attribute(Source source, String name, String qualifier, ExpressionId id) {
this(source, name, qualifier, true, id);
}
public Attribute(Location location, String name, String qualifier, boolean nullable, ExpressionId id) {
this(location, name, qualifier, nullable, id, false);
public Attribute(Source source, String name, String qualifier, boolean nullable, ExpressionId id) {
this(source, name, qualifier, nullable, id, false);
}
public Attribute(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
super(location, name, emptyList(), id, synthetic);
public Attribute(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
super(source, name, emptyList(), id, synthetic);
this.qualifier = qualifier;
this.nullable = nullable;
}
@ -86,19 +86,19 @@ public abstract class Attribute extends NamedExpression {
return new AttributeSet(this);
}
public Attribute withLocation(Location location) {
return Objects.equals(location(), location) ? this : clone(location, name(), qualifier(), nullable(), id(), synthetic());
public Attribute withLocation(Source source) {
return Objects.equals(source(), source) ? this : clone(source, name(), qualifier(), nullable(), id(), synthetic());
}
public Attribute withQualifier(String qualifier) {
return Objects.equals(qualifier(), qualifier) ? this : clone(location(), name(), qualifier, nullable(), id(), synthetic());
return Objects.equals(qualifier(), qualifier) ? this : clone(source(), name(), qualifier, nullable(), id(), synthetic());
}
public Attribute withNullability(boolean nullable) {
return Objects.equals(nullable(), nullable) ? this : clone(location(), name(), qualifier(), nullable, id(), synthetic());
return Objects.equals(nullable(), nullable) ? this : clone(source(), name(), qualifier(), nullable, id(), synthetic());
}
protected abstract Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id,
protected abstract Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id,
boolean synthetic);
@Override

View File

@ -6,18 +6,18 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
public class Exists extends SubQueryExpression {
public Exists(Location location, LogicalPlan query) {
this(location, query, null);
public Exists(Source source, LogicalPlan query) {
this(source, query, null);
}
public Exists(Location location, LogicalPlan query, ExpressionId id) {
super(location, query, id);
public Exists(Source source, LogicalPlan query, ExpressionId id) {
super(source, query, id);
}
@Override
@ -27,7 +27,7 @@ public class Exists extends SubQueryExpression {
@Override
protected SubQueryExpression clone(LogicalPlan newQuery) {
return new Exists(location(), newQuery);
return new Exists(source(), newQuery);
}
@Override

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
import org.elasticsearch.xpack.sql.capabilities.Resolvable;
import org.elasticsearch.xpack.sql.capabilities.Resolvables;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.Node;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -65,8 +65,8 @@ public abstract class Expression extends Node<Expression> implements Resolvable
private Boolean lazyChildrenResolved = null;
private Expression lazyCanonical = null;
public Expression(Location location, List<Expression> children) {
super(location, children);
public Expression(Source source, List<Expression> children) {
super(source, children);
}
// whether the expression can be evaluated statically (folded) or not

View File

@ -35,7 +35,7 @@ public final class Expressions {
private Expressions() {}
public static NamedExpression wrapAsNamed(Expression exp) {
return exp instanceof NamedExpression ? (NamedExpression) exp : new Alias(exp.location(), exp.nodeName(), exp);
return exp instanceof NamedExpression ? (NamedExpression) exp : new Alias(exp.source(), exp.nodeName(), exp);
}
public static List<Attribute> asAttributes(List<? extends NamedExpression> named) {

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.common.Strings;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.EsField;
@ -29,17 +29,17 @@ public class FieldAttribute extends TypedAttribute {
private final String path;
private final EsField field;
public FieldAttribute(Location location, String name, EsField field) {
this(location, null, name, field);
public FieldAttribute(Source source, String name, EsField field) {
this(source, null, name, field);
}
public FieldAttribute(Location location, FieldAttribute parent, String name, EsField field) {
this(location, parent, name, field, null, true, null, false);
public FieldAttribute(Source source, FieldAttribute parent, String name, EsField field) {
this(source, parent, name, field, null, true, null, false);
}
public FieldAttribute(Location location, FieldAttribute parent, String name, EsField field, String qualifier,
public FieldAttribute(Source source, FieldAttribute parent, String name, EsField field, String qualifier,
boolean nullable, ExpressionId id, boolean synthetic) {
super(location, name, field.getDataType(), qualifier, nullable, id, synthetic);
super(source, name, field.getDataType(), qualifier, nullable, id, synthetic);
this.path = parent != null ? parent.name() : StringUtils.EMPTY;
this.parent = parent;
this.field = field;
@ -93,18 +93,18 @@ public class FieldAttribute extends TypedAttribute {
}
private FieldAttribute innerField(EsField type) {
return new FieldAttribute(location(), this, name() + "." + type.getName(), type, qualifier(), nullable(), id(), synthetic());
return new FieldAttribute(source(), this, name() + "." + type.getName(), type, qualifier(), nullable(), id(), synthetic());
}
@Override
protected Expression canonicalize() {
return new FieldAttribute(location(), null, "<none>", field, null, true, id(), false);
return new FieldAttribute(source(), null, "<none>", field, null, true, id(), false);
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
FieldAttribute qualifiedParent = parent != null ? (FieldAttribute) parent.withQualifier(qualifier) : null;
return new FieldAttribute(location, qualifiedParent, name, field, qualifier, nullable, id, synthetic);
return new FieldAttribute(source, qualifiedParent, name, field, qualifier, nullable, id, synthetic);
}
@Override

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.List;
@ -13,8 +13,8 @@ import static java.util.Collections.emptyList;
public abstract class LeafExpression extends Expression {
protected LeafExpression(Location location) {
super(location, emptyList());
protected LeafExpression(Source source) {
super(source, emptyList());
}
@Override

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
import org.elasticsearch.xpack.sql.expression.gen.script.Params;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.DataTypeConversion;
@ -24,19 +24,19 @@ import static java.util.Collections.emptyList;
*/
public class Literal extends NamedExpression {
public static final Literal TRUE = Literal.of(Location.EMPTY, Boolean.TRUE);
public static final Literal FALSE = Literal.of(Location.EMPTY, Boolean.FALSE);
public static final Literal NULL = Literal.of(Location.EMPTY, null);
public static final Literal TRUE = Literal.of(Source.EMPTY, Boolean.TRUE);
public static final Literal FALSE = Literal.of(Source.EMPTY, Boolean.FALSE);
public static final Literal NULL = Literal.of(Source.EMPTY, null);
private final Object value;
private final DataType dataType;
public Literal(Location location, Object value, DataType dataType) {
this(location, null, value, dataType);
public Literal(Source source, Object value, DataType dataType) {
this(source, null, value, dataType);
}
public Literal(Location location, String name, Object value, DataType dataType) {
super(location, name == null ? String.valueOf(value) : name, emptyList(), null);
public Literal(Source source, String name, Object value, DataType dataType) {
super(source, name == null ? String.valueOf(value) : name, emptyList(), null);
this.dataType = dataType;
this.value = DataTypeConversion.convert(value, dataType);
}
@ -77,7 +77,7 @@ public class Literal extends NamedExpression {
@Override
public Attribute toAttribute() {
return new LiteralAttribute(location(), name(), null, false, id(), false, dataType, this);
return new LiteralAttribute(source(), name(), null, false, id(), false, dataType, this);
}
@Override
@ -98,7 +98,7 @@ public class Literal extends NamedExpression {
@Override
protected Expression canonicalize() {
String s = String.valueOf(value);
return name().equals(s) ? this : Literal.of(location(), value);
return name().equals(s) ? this : Literal.of(source(), value);
}
@Override
@ -129,11 +129,11 @@ public class Literal extends NamedExpression {
/**
* Utility method for creating 'in-line' Literals (out of values instead of expressions).
*/
public static Literal of(Location loc, Object value) {
public static Literal of(Source source, Object value) {
if (value instanceof Literal) {
return (Literal) value;
}
return new Literal(loc, value, DataTypes.fromJava(value));
return new Literal(source, value, DataTypes.fromJava(value));
}
/**
@ -161,11 +161,11 @@ public class Literal extends NamedExpression {
if (name == null) {
name = foldable instanceof NamedExpression ? ((NamedExpression) foldable).name() : String.valueOf(fold);
}
return new Literal(foldable.location(), name, fold, foldable.dataType());
return new Literal(foldable.source(), name, fold, foldable.dataType());
}
public static Literal of(Expression source, Object value) {
String name = source instanceof NamedExpression ? ((NamedExpression) source).name() : String.valueOf(value);
return new Literal(source.location(), name, value, source.dataType());
return new Literal(source.source(), name, value, source.dataType());
}
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -14,9 +14,9 @@ public class LiteralAttribute extends TypedAttribute {
private final Literal literal;
public LiteralAttribute(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic,
public LiteralAttribute(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic,
DataType dataType, Literal literal) {
super(location, name, dataType, qualifier, nullable, id, synthetic);
super(source, name, dataType, qualifier, nullable, id, synthetic);
this.literal = literal;
}
@ -27,9 +27,9 @@ public class LiteralAttribute extends TypedAttribute {
}
@Override
protected LiteralAttribute clone(Location location, String name, String qualifier, boolean nullable,
protected LiteralAttribute clone(Source source, String name, String qualifier, boolean nullable,
ExpressionId id, boolean synthetic) {
return new LiteralAttribute(location, name, qualifier, nullable, id, synthetic, dataType(), literal);
return new LiteralAttribute(source, name, qualifier, nullable, id, synthetic, dataType(), literal);
}
@Override

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.sql.expression.gen.pipeline.AttributeInput;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.ConstantInput;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.List;
import java.util.Objects;
@ -26,12 +26,12 @@ public abstract class NamedExpression extends Expression {
private Pipe lazyPipe = null;
public NamedExpression(Location location, String name, List<Expression> children, ExpressionId id) {
this(location, name, children, id, false);
public NamedExpression(Source source, String name, List<Expression> children, ExpressionId id) {
this(source, name, children, id, false);
}
public NamedExpression(Location location, String name, List<Expression> children, ExpressionId id, boolean synthetic) {
super(location, children);
public NamedExpression(Source source, String name, List<Expression> children, ExpressionId id, boolean synthetic) {
super(source, children);
this.name = name;
this.id = id == null ? new ExpressionId() : id;
this.synthetic = synthetic;
@ -53,14 +53,14 @@ public abstract class NamedExpression extends Expression {
public Pipe asPipe() {
if (lazyPipe == null) {
lazyPipe = foldable() ? new ConstantInput(location(), this, fold()) : makePipe();
lazyPipe = foldable() ? new ConstantInput(source(), this, fold()) : makePipe();
}
return lazyPipe;
}
protected Pipe makePipe() {
return new AttributeInput(location(), this, toAttribute());
return new AttributeInput(source(), this, toAttribute());
}
public abstract ScriptTemplate asScript();

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -28,8 +28,8 @@ public class Order extends Expression {
private final OrderDirection direction;
private final NullsPosition nulls;
public Order(Location location, Expression child, OrderDirection direction, NullsPosition nulls) {
super(location, singletonList(child));
public Order(Source source, Expression child, OrderDirection direction, NullsPosition nulls) {
super(source, singletonList(child));
this.child = child;
this.direction = direction;
this.nulls = nulls == null ? (direction == OrderDirection.DESC ? NullsPosition.FIRST : NullsPosition.LAST) : nulls;
@ -55,7 +55,7 @@ public class Order extends Expression {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Order(location(), newChildren.get(0), direction, nulls);
return new Order(source(), newChildren.get(0), direction, nulls);
}
public Expression child() {

View File

@ -6,18 +6,18 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
public class ScalarSubquery extends SubQueryExpression {
public ScalarSubquery(Location location, LogicalPlan query) {
this(location, query, null);
public ScalarSubquery(Source source, LogicalPlan query) {
this(source, query, null);
}
public ScalarSubquery(Location location, LogicalPlan query, ExpressionId id) {
super(location, query, id);
public ScalarSubquery(Source source, LogicalPlan query, ExpressionId id) {
super(source, query, id);
}
@Override
@ -27,7 +27,7 @@ public class ScalarSubquery extends SubQueryExpression {
@Override
protected ScalarSubquery clone(LogicalPlan newQuery) {
return new ScalarSubquery(location(), newQuery);
return new ScalarSubquery(source(), newQuery);
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.Collections;
import java.util.List;
@ -17,12 +17,12 @@ public abstract class SubQueryExpression extends Expression {
private final LogicalPlan query;
private final ExpressionId id;
public SubQueryExpression(Location location, LogicalPlan query) {
this(location, query, null);
public SubQueryExpression(Source source, LogicalPlan query) {
this(source, query, null);
}
public SubQueryExpression(Location location, LogicalPlan query, ExpressionId id) {
super(location, Collections.emptyList());
public SubQueryExpression(Source source, LogicalPlan query, ExpressionId id) {
super(source, Collections.emptyList());
this.query = query;
this.id = id == null ? new ExpressionId() : id;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.Objects;
@ -14,13 +14,13 @@ public abstract class TypedAttribute extends Attribute {
private final DataType dataType;
protected TypedAttribute(Location location, String name, DataType dataType) {
this(location, name, dataType, null, true, null, false);
protected TypedAttribute(Source source, String name, DataType dataType) {
this(source, name, dataType, null, true, null, false);
}
protected TypedAttribute(Location location, String name, DataType dataType, String qualifier, boolean nullable,
protected TypedAttribute(Source source, String name, DataType dataType, String qualifier, boolean nullable,
ExpressionId id, boolean synthetic) {
super(location, name, qualifier, nullable, id, synthetic);
super(source, name, qualifier, nullable, id, synthetic);
this.dataType = dataType;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.List;
@ -17,8 +17,8 @@ public abstract class UnaryExpression extends Expression {
private final Expression child;
protected UnaryExpression(Location location, Expression child) {
super(location, singletonList(child));
protected UnaryExpression(Source source, Expression child) {
super(source, singletonList(child));
this.child = child;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.capabilities.UnresolvedException;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.Objects;
@ -18,8 +18,8 @@ public class UnresolvedAlias extends UnresolvedNamedExpression {
private final Expression child;
public UnresolvedAlias(Location location, Expression child) {
super(location, singletonList(child));
public UnresolvedAlias(Source source, Expression child) {
super(source, singletonList(child));
this.child = child;
}
@ -33,7 +33,7 @@ public class UnresolvedAlias extends UnresolvedNamedExpression {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new UnresolvedAlias(location(), newChildren.get(0));
return new UnresolvedAlias(source(), newChildren.get(0));
}
public Expression child() {

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.capabilities.Unresolvable;
import org.elasticsearch.xpack.sql.capabilities.UnresolvedException;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.CollectionUtils;
@ -25,21 +25,21 @@ public class UnresolvedAttribute extends Attribute implements Unresolvable {
private final boolean customMessage;
private final Object resolutionMetadata;
public UnresolvedAttribute(Location location, String name) {
this(location, name, null);
public UnresolvedAttribute(Source source, String name) {
this(source, name, null);
}
public UnresolvedAttribute(Location location, String name, String qualifier) {
this(location, name, qualifier, null);
public UnresolvedAttribute(Source source, String name, String qualifier) {
this(source, name, qualifier, null);
}
public UnresolvedAttribute(Location location, String name, String qualifier, String unresolvedMessage) {
this(location, name, qualifier, null, unresolvedMessage, null);
public UnresolvedAttribute(Source source, String name, String qualifier, String unresolvedMessage) {
this(source, name, qualifier, null, unresolvedMessage, null);
}
public UnresolvedAttribute(Location location, String name, String qualifier, ExpressionId id, String unresolvedMessage,
public UnresolvedAttribute(Source source, String name, String qualifier, ExpressionId id, String unresolvedMessage,
Object resolutionMetadata) {
super(location, name, qualifier, id);
super(source, name, qualifier, id);
this.customMessage = unresolvedMessage != null;
this.unresolvedMsg = unresolvedMessage == null ? errorMessage(qualifiedName(), null) : unresolvedMessage;
this.resolutionMetadata = resolutionMetadata;
@ -65,12 +65,12 @@ public class UnresolvedAttribute extends Attribute implements Unresolvable {
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
return this;
}
public UnresolvedAttribute withUnresolvedMessage(String unresolvedMsg) {
return new UnresolvedAttribute(location(), name(), qualifier(), id(), unresolvedMsg, resolutionMetadata());
return new UnresolvedAttribute(source(), name(), qualifier(), id(), unresolvedMsg, resolutionMetadata());
}
@Override

View File

@ -8,15 +8,15 @@ package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.capabilities.Unresolvable;
import org.elasticsearch.xpack.sql.capabilities.UnresolvedException;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.List;
abstract class UnresolvedNamedExpression extends NamedExpression implements Unresolvable {
UnresolvedNamedExpression(Location location, List<Expression> children) {
super(location, "<unresolved>", children, new ExpressionId());
UnresolvedNamedExpression(Source source, List<Expression> children) {
super(source, "<unresolved>", children, new ExpressionId());
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression;
import org.elasticsearch.xpack.sql.capabilities.UnresolvedException;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.Objects;
@ -19,8 +19,8 @@ public class UnresolvedStar extends UnresolvedNamedExpression {
// typically used for nested fields or inner/dotted fields
private final UnresolvedAttribute qualifier;
public UnresolvedStar(Location location, UnresolvedAttribute qualifier) {
super(location, emptyList());
public UnresolvedStar(Source source, UnresolvedAttribute qualifier) {
super(source, emptyList());
this.qualifier = qualifier;
}

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.NamedExpression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.util.StringUtils;
import java.util.List;
@ -23,14 +23,14 @@ public abstract class Function extends NamedExpression {
private final String functionName, name;
protected Function(Location location, List<Expression> children) {
this(location, children, null, false);
protected Function(Source source, List<Expression> children) {
this(source, children, null, false);
}
// TODO: Functions supporting distinct should add a dedicated constructor Location, List<Expression>, boolean
protected Function(Location location, List<Expression> children, ExpressionId id, boolean synthetic) {
protected Function(Source source, List<Expression> children, ExpressionId id, boolean synthetic) {
// cannot detect name yet so override the name
super(location, null, children, id, synthetic);
super(source, null, children, id, synthetic);
functionName = StringUtils.camelCaseToUnderscore(getClass().getSimpleName());
name = functionName() + functionArgs();
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function;
import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.TypedAttribute;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.Objects;
@ -16,9 +16,9 @@ public abstract class FunctionAttribute extends TypedAttribute {
private final String functionId;
protected FunctionAttribute(Location location, String name, DataType dataType, String qualifier, boolean nullable, ExpressionId id,
protected FunctionAttribute(Source source, String name, DataType dataType, String qualifier, boolean nullable, ExpressionId id,
boolean synthetic, String functionId) {
super(location, name, dataType, qualifier, nullable, id, synthetic);
super(source, name, dataType, qualifier, nullable, id, synthetic);
this.functionId = functionId;
}

View File

@ -96,7 +96,7 @@ import org.elasticsearch.xpack.sql.expression.predicate.conditional.NullIf;
import org.elasticsearch.xpack.sql.expression.predicate.operator.arithmetic.Mod;
import org.elasticsearch.xpack.sql.parser.ParsingException;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.Check;
@ -305,15 +305,15 @@ public class FunctionRegistry {
* is not aware of time zone and does not support {@code DISTINCT}.
*/
static <T extends Function> FunctionDefinition def(Class<T> function,
java.util.function.Function<Location, T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
java.util.function.Function<Source, T> ctorRef, String... names) {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (false == children.isEmpty()) {
throw new IllegalArgumentException("expects no arguments");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.apply(location);
return ctorRef.apply(source);
};
return def(function, builder, false, names);
}
@ -326,20 +326,20 @@ public class FunctionRegistry {
@SuppressWarnings("overloads")
static <T extends Function> FunctionDefinition def(Class<T> function,
ConfigurationAwareFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (false == children.isEmpty()) {
throw new IllegalArgumentException("expects no arguments");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, cfg);
return ctorRef.build(source, cfg);
};
return def(function, builder, false, names);
}
interface ConfigurationAwareFunctionBuilder<T> {
T build(Location location, Configuration configuration);
T build(Source source, Configuration configuration);
}
/**
@ -350,7 +350,7 @@ public class FunctionRegistry {
@SuppressWarnings("overloads")
static <T extends Function> FunctionDefinition def(Class<T> function,
UnaryConfigurationAwareFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() > 1) {
throw new IllegalArgumentException("expects exactly one argument");
}
@ -358,13 +358,13 @@ public class FunctionRegistry {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
Expression ex = children.size() == 1 ? children.get(0) : null;
return ctorRef.build(location, ex, cfg);
return ctorRef.build(source, ex, cfg);
};
return def(function, builder, false, names);
}
interface UnaryConfigurationAwareFunctionBuilder<T> {
T build(Location location, Expression exp, Configuration configuration);
T build(Source source, Expression exp, Configuration configuration);
}
@ -374,15 +374,15 @@ public class FunctionRegistry {
*/
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
BiFunction<Location, Expression, T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
BiFunction<Source, Expression, T> ctorRef, String... names) {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() != 1) {
throw new IllegalArgumentException("expects exactly one argument");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.apply(location, children.get(0));
return ctorRef.apply(source, children.get(0));
};
return def(function, builder, false, names);
}
@ -394,17 +394,17 @@ public class FunctionRegistry {
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
MultiFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children);
return ctorRef.build(source, children);
};
return def(function, builder, false, names);
}
interface MultiFunctionBuilder<T> {
T build(Location location, List<Expression> children);
T build(Source source, List<Expression> children);
}
/**
@ -414,17 +414,17 @@ public class FunctionRegistry {
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
DistinctAwareUnaryFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() != 1) {
throw new IllegalArgumentException("expects exactly one argument");
}
return ctorRef.build(location, children.get(0), distinct);
return ctorRef.build(source, children.get(0), distinct);
};
return def(function, builder, false, names);
}
interface DistinctAwareUnaryFunctionBuilder<T> {
T build(Location location, Expression target, boolean distinct);
T build(Source source, Expression target, boolean distinct);
}
/**
@ -434,20 +434,20 @@ public class FunctionRegistry {
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
DatetimeUnaryFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() != 1) {
throw new IllegalArgumentException("expects exactly one argument");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children.get(0), cfg.zoneId());
return ctorRef.build(source, children.get(0), cfg.zoneId());
};
return def(function, builder, true, names);
}
interface DatetimeUnaryFunctionBuilder<T> {
T build(Location location, Expression target, ZoneId zi);
T build(Source source, Expression target, ZoneId zi);
}
/**
@ -456,20 +456,20 @@ public class FunctionRegistry {
*/
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function, DatetimeBinaryFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() != 2) {
throw new IllegalArgumentException("expects exactly two arguments");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children.get(0), children.get(1), cfg.zoneId());
return ctorRef.build(source, children.get(0), children.get(1), cfg.zoneId());
};
return def(function, builder, false, names);
}
interface DatetimeBinaryFunctionBuilder<T> {
T build(Location location, Expression lhs, Expression rhs, ZoneId zi);
T build(Source source, Expression lhs, Expression rhs, ZoneId zi);
}
/**
@ -479,7 +479,7 @@ public class FunctionRegistry {
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
BinaryFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
boolean isBinaryOptionalParamFunction = function.isAssignableFrom(Round.class) || function.isAssignableFrom(Truncate.class);
if (isBinaryOptionalParamFunction && (children.size() > 2 || children.size() < 1)) {
throw new IllegalArgumentException("expects one or two arguments");
@ -490,13 +490,13 @@ public class FunctionRegistry {
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children.get(0), children.size() == 2 ? children.get(1) : null);
return ctorRef.build(source, children.get(0), children.size() == 2 ? children.get(1) : null);
};
return def(function, builder, false, names);
}
interface BinaryFunctionBuilder<T> {
T build(Location location, Expression lhs, Expression rhs);
T build(Source source, Expression lhs, Expression rhs);
}
/**
@ -512,23 +512,22 @@ public class FunctionRegistry {
List<String> aliases = Arrays.asList(names).subList(1, names.length);
FunctionDefinition.Builder realBuilder = (uf, distinct, cfg) -> {
try {
return builder.build(uf.location(), uf.children(), distinct, cfg);
return builder.build(uf.source(), uf.children(), distinct, cfg);
} catch (IllegalArgumentException e) {
throw new ParsingException("error building [" + primaryName + "]: " + e.getMessage(), e,
uf.location().getLineNumber(), uf.location().getColumnNumber());
throw new ParsingException(uf.source(), "error building [" + primaryName + "]: " + e.getMessage(), e);
}
};
return new FunctionDefinition(primaryName, unmodifiableList(aliases), function, datetime, realBuilder);
}
private interface FunctionBuilder {
Function build(Location location, List<Expression> children, boolean distinct, Configuration cfg);
Function build(Source source, List<Expression> children, boolean distinct, Configuration cfg);
}
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
ThreeParametersFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
boolean isLocateFunction = function.isAssignableFrom(Locate.class);
if (isLocateFunction && (children.size() > 3 || children.size() < 2)) {
throw new IllegalArgumentException("expects two or three arguments");
@ -538,32 +537,32 @@ public class FunctionRegistry {
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children.get(0), children.get(1), children.size() == 3 ? children.get(2) : null);
return ctorRef.build(source, children.get(0), children.get(1), children.size() == 3 ? children.get(2) : null);
};
return def(function, builder, false, names);
}
interface ThreeParametersFunctionBuilder<T> {
T build(Location location, Expression source, Expression exp1, Expression exp2);
T build(Source source, Expression src, Expression exp1, Expression exp2);
}
@SuppressWarnings("overloads") // These are ambiguous if you aren't using ctor references but we always do
static <T extends Function> FunctionDefinition def(Class<T> function,
FourParametersFunctionBuilder<T> ctorRef, String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) -> {
FunctionBuilder builder = (source, children, distinct, cfg) -> {
if (children.size() != 4) {
throw new IllegalArgumentException("expects exactly four arguments");
}
if (distinct) {
throw new IllegalArgumentException("does not support DISTINCT yet it was specified");
}
return ctorRef.build(location, children.get(0), children.get(1), children.get(2), children.get(3));
return ctorRef.build(source, children.get(0), children.get(1), children.get(2), children.get(3));
};
return def(function, builder, false, names);
}
interface FourParametersFunctionBuilder<T> {
T build(Location location, Expression source, Expression exp1, Expression exp2, Expression exp3);
T build(Source source, Expression src, Expression exp1, Expression exp2, Expression exp3);
}
/**
@ -576,12 +575,12 @@ public class FunctionRegistry {
private static <T extends Function> FunctionDefinition def(Class<T> function,
CastFunctionBuilder<T> ctorRef,
String... names) {
FunctionBuilder builder = (location, children, distinct, cfg) ->
ctorRef.build(location, children.get(0), children.get(0).dataType());
FunctionBuilder builder = (source, children, distinct, cfg) ->
ctorRef.build(source, children.get(0), children.get(0).dataType());
return def(function, builder, false, names);
}
private interface CastFunctionBuilder<T> {
T build(Location location, Expression expression, DataType dataType);
T build(Source source, Expression expression, DataType dataType);
}
}

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Attribute;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -24,8 +24,8 @@ import static java.util.Collections.emptyList;
* with other function.
*/
public class Score extends Function {
public Score(Location location) {
super(location, emptyList());
public Score(Source source) {
super(source, emptyList());
}
@Override
@ -45,7 +45,7 @@ public class Score extends Function {
@Override
public Attribute toAttribute() {
return new ScoreAttribute(location());
return new ScoreAttribute(source());
}
@Override
@ -54,12 +54,12 @@ public class Score extends Function {
return false;
}
Score other = (Score) obj;
return location().equals(other.location());
return source().equals(other.source());
}
@Override
public int hashCode() {
return location().hashCode();
return source().hashCode();
}
@Override

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.sql.expression.Attribute;
import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.ScorePipe;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -20,16 +20,16 @@ public class ScoreAttribute extends FunctionAttribute {
/**
* Constructor for normal use.
*/
public ScoreAttribute(Location location) {
this(location, "SCORE()", DataType.FLOAT, null, false, null, false);
public ScoreAttribute(Source source) {
this(source, "SCORE()", DataType.FLOAT, null, false, null, false);
}
/**
* Constructor for {@link #clone()}
*/
private ScoreAttribute(Location location, String name, DataType dataType, String qualifier, boolean nullable, ExpressionId id,
private ScoreAttribute(Source source, String name, DataType dataType, String qualifier, boolean nullable, ExpressionId id,
boolean synthetic) {
super(location, name, dataType, qualifier, nullable, id, synthetic, "SCORE");
super(source, name, dataType, qualifier, nullable, id, synthetic, "SCORE");
}
@Override
@ -38,13 +38,13 @@ public class ScoreAttribute extends FunctionAttribute {
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
return new ScoreAttribute(location, name, dataType(), qualifier, nullable, id, synthetic);
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
return new ScoreAttribute(source, name, dataType(), qualifier, nullable, id, synthetic);
}
@Override
protected Pipe makePipe() {
return new ScorePipe(location(), this);
return new ScorePipe(source(), this);
}
@Override

View File

@ -12,7 +12,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Literal;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -40,8 +40,8 @@ public class UnresolvedFunction extends Function implements Unresolvable {
*/
private final boolean analyzed;
public UnresolvedFunction(Location location, String name, ResolutionType resolutionType, List<Expression> children) {
this(location, name, resolutionType, children, false, null);
public UnresolvedFunction(Source source, String name, ResolutionType resolutionType, List<Expression> children) {
this(source, name, resolutionType, children, false, null);
}
/**
@ -49,9 +49,9 @@ public class UnresolvedFunction extends Function implements Unresolvable {
* 'did you mean') instead of the default one.
* @see #withMessage(String)
*/
UnresolvedFunction(Location location, String name, ResolutionType resolutionType, List<Expression> children,
UnresolvedFunction(Source source, String name, ResolutionType resolutionType, List<Expression> children,
boolean analyzed, String unresolvedMessage) {
super(location, children);
super(source, children);
this.name = name;
this.resolutionType = resolutionType;
this.analyzed = analyzed;
@ -66,11 +66,11 @@ public class UnresolvedFunction extends Function implements Unresolvable {
@Override
public Expression replaceChildren(List<Expression> newChildren) {
return new UnresolvedFunction(location(), name, resolutionType, newChildren, analyzed, unresolvedMsg);
return new UnresolvedFunction(source(), name, resolutionType, newChildren, analyzed, unresolvedMsg);
}
public UnresolvedFunction withMessage(String message) {
return new UnresolvedFunction(location(), name(), resolutionType, children(), true, message);
return new UnresolvedFunction(source(), name(), resolutionType, children(), true, message);
}
public UnresolvedFunction preprocessStar() {
@ -191,8 +191,8 @@ public class UnresolvedFunction extends Function implements Unresolvable {
// TODO: might be removed
// dedicated count optimization
if (uf.name.toUpperCase(Locale.ROOT).equals("COUNT")) {
return new UnresolvedFunction(uf.location(), uf.name(), uf.resolutionType,
singletonList(Literal.of(uf.arguments().get(0).location(), Integer.valueOf(1))));
return new UnresolvedFunction(uf.source(), uf.name(), uf.resolutionType,
singletonList(Literal.of(uf.arguments().get(0).source(), Integer.valueOf(1))));
}
return uf;
}

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.function.Function;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.AggNameInput;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.util.CollectionUtils;
import java.util.List;
@ -30,12 +30,12 @@ public abstract class AggregateFunction extends Function {
private AggregateFunctionAttribute lazyAttribute;
protected AggregateFunction(Location location, Expression field) {
this(location, field, emptyList());
protected AggregateFunction(Source source, Expression field) {
this(source, field, emptyList());
}
protected AggregateFunction(Location location, Expression field, List<Expression> parameters) {
super(location, CollectionUtils.combine(singletonList(field), parameters));
protected AggregateFunction(Source source, Expression field, List<Expression> parameters) {
super(source, CollectionUtils.combine(singletonList(field), parameters));
this.field = field;
this.parameters = parameters;
}
@ -52,7 +52,7 @@ public abstract class AggregateFunction extends Function {
public AggregateFunctionAttribute toAttribute() {
if (lazyAttribute == null) {
// this is highly correlated with QueryFolder$FoldAggregate#addFunction (regarding the function name within the querydsl)
lazyAttribute = new AggregateFunctionAttribute(location(), name(), dataType(), id(), functionId(), null);
lazyAttribute = new AggregateFunctionAttribute(source(), name(), dataType(), id(), functionId(), null);
}
return lazyAttribute;
}
@ -60,7 +60,7 @@ public abstract class AggregateFunction extends Function {
@Override
protected Pipe makePipe() {
// unresolved AggNameInput (should always get replaced by the folder)
return new AggNameInput(location(), this, name());
return new AggNameInput(source(), this, name());
}
@Override

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.sql.expression.Attribute;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -19,14 +19,14 @@ public class AggregateFunctionAttribute extends FunctionAttribute {
private final String propertyPath;
AggregateFunctionAttribute(Location location, String name, DataType dataType, ExpressionId id,
AggregateFunctionAttribute(Source source, String name, DataType dataType, ExpressionId id,
String functionId, String propertyPath) {
this(location, name, dataType, null, false, id, false, functionId, propertyPath);
this(source, name, dataType, null, false, id, false, functionId, propertyPath);
}
public AggregateFunctionAttribute(Location location, String name, DataType dataType, String qualifier,
public AggregateFunctionAttribute(Source source, String name, DataType dataType, String qualifier,
boolean nullable, ExpressionId id, boolean synthetic, String functionId, String propertyPath) {
super(location, name, dataType, qualifier, nullable, id, synthetic, functionId);
super(source, name, dataType, qualifier, nullable, id, synthetic, functionId);
this.propertyPath = propertyPath;
}
@ -42,18 +42,18 @@ public class AggregateFunctionAttribute extends FunctionAttribute {
@Override
protected Expression canonicalize() {
return new AggregateFunctionAttribute(location(), "<none>", dataType(), null, true, id(), false, "<none>", null);
return new AggregateFunctionAttribute(source(), "<none>", dataType(), null, true, id(), false, "<none>", null);
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
// this is highly correlated with QueryFolder$FoldAggregate#addFunction (regarding the function name within the querydsl)
// that is the functionId is actually derived from the expression id to easily track it across contexts
return new AggregateFunctionAttribute(location, name, dataType(), qualifier, nullable, id, synthetic, functionId(), propertyPath);
return new AggregateFunctionAttribute(source, name, dataType(), qualifier, nullable, id, synthetic, functionId(), propertyPath);
}
public AggregateFunctionAttribute withFunctionId(String functionId, String propertyPath) {
return new AggregateFunctionAttribute(location(), name(), dataType(), qualifier(), nullable(),
return new AggregateFunctionAttribute(source(), name(), dataType(), qualifier(), nullable(),
id(), synthetic(), functionId, propertyPath);
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -17,8 +17,8 @@ import java.util.List;
*/
public class Avg extends NumericAggregate implements EnclosedAgg {
public Avg(Location location, Expression field) {
super(location, field);
public Avg(Source source, Expression field) {
super(source, field);
}
@Override
@ -31,7 +31,7 @@ public class Avg extends NumericAggregate implements EnclosedAgg {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Avg(location(), newChildren.get(0));
return new Avg(source(), newChildren.get(0));
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.List;
@ -14,11 +14,11 @@ import java.util.List;
// and thus cannot be used directly in SQL and are mainly for internal use
public abstract class CompoundNumericAggregate extends NumericAggregate {
CompoundNumericAggregate(Location location, Expression field, List<Expression> arguments) {
super(location, field, arguments);
CompoundNumericAggregate(Source source, Expression field, List<Expression> arguments) {
super(source, field, arguments);
}
CompoundNumericAggregate(Location location, Expression field) {
super(location, field);
CompoundNumericAggregate(Source source, Expression field) {
super(source, field);
}
}

View File

@ -9,7 +9,7 @@ import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.NamedExpression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -22,8 +22,8 @@ public class Count extends AggregateFunction {
private final boolean distinct;
public Count(Location location, Expression field, boolean distinct) {
super(location, field);
public Count(Source source, Expression field, boolean distinct) {
super(source, field);
this.distinct = distinct;
}
@ -37,7 +37,7 @@ public class Count extends AggregateFunction {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Count(location(), newChildren.get(0), distinct);
return new Count(source(), newChildren.get(0), distinct);
}
public boolean distinct() {
@ -61,6 +61,6 @@ public class Count extends AggregateFunction {
@Override
public AggregateFunctionAttribute toAttribute() {
return new AggregateFunctionAttribute(location(), name(), dataType(), id(), functionId(), "_count");
return new AggregateFunctionAttribute(source(), name(), dataType(), id(), functionId(), "_count");
}
}

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class ExtendedStats extends CompoundNumericAggregate {
public ExtendedStats(Location location, Expression field) {
super(location, field);
public ExtendedStats(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,6 +26,6 @@ public class ExtendedStats extends CompoundNumericAggregate {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new ExtendedStats(location(), newChildren.get(0));
return new ExtendedStats(source(), newChildren.get(0));
}
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.Function;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -22,11 +22,11 @@ public class InnerAggregate extends AggregateFunction {
private final Expression innerKey;
public InnerAggregate(AggregateFunction inner, CompoundNumericAggregate outer) {
this(inner.location(), inner, outer, null);
this(inner.source(), inner, outer, null);
}
public InnerAggregate(Location location, AggregateFunction inner, CompoundNumericAggregate outer, Expression innerKey) {
super(location, outer.field(), outer.arguments());
public InnerAggregate(Source source, AggregateFunction inner, CompoundNumericAggregate outer, Expression innerKey) {
super(source, outer.field(), outer.arguments());
this.inner = inner;
this.outer = outer;
this.innerId = ((EnclosedAgg) inner).innerName();
@ -76,7 +76,7 @@ public class InnerAggregate extends AggregateFunction {
@Override
public AggregateFunctionAttribute toAttribute() {
// this is highly correlated with QueryFolder$FoldAggregate#addFunction (regarding the function name within the querydsl)
return new AggregateFunctionAttribute(location(), name(), dataType(), outer.id(), functionId(),
return new AggregateFunctionAttribute(source(), name(), dataType(), outer.id(), functionId(),
aggMetricValue(functionId(), innerId));
}

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class Kurtosis extends NumericAggregate implements MatrixStatsEnclosed {
public Kurtosis(Location location, Expression field) {
super(location, field);
public Kurtosis(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Kurtosis extends NumericAggregate implements MatrixStatsEnclosed {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Kurtosis(location(), newChildren.get(0));
return new Kurtosis(source(), newChildren.get(0));
}
@Override

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class MatrixStats extends CompoundNumericAggregate {
public MatrixStats(Location location, Expression field) {
super(location, field);
public MatrixStats(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,6 +26,6 @@ public class MatrixStats extends CompoundNumericAggregate {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new MatrixStats(location(), newChildren.get(0));
return new MatrixStats(source(), newChildren.get(0));
}
}

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -19,8 +19,8 @@ import java.util.List;
*/
public class Max extends NumericAggregate implements EnclosedAgg {
public Max(Location location, Expression field) {
super(location, field);
public Max(Source source, Expression field) {
super(source, field);
}
@Override
@ -30,7 +30,7 @@ public class Max extends NumericAggregate implements EnclosedAgg {
@Override
public Max replaceChildren(List<Expression> newChildren) {
return new Max(location(), newChildren.get(0));
return new Max(source(), newChildren.get(0));
}
@Override

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -19,8 +19,8 @@ import java.util.List;
*/
public class Min extends NumericAggregate implements EnclosedAgg {
public Min(Location location, Expression field) {
super(location, field);
public Min(Source source, Expression field) {
super(source, field);
}
@Override
@ -33,7 +33,7 @@ public class Min extends NumericAggregate implements EnclosedAgg {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Min(location(), newChildren.get(0));
return new Min(source(), newChildren.get(0));
}
@Override

View File

@ -8,19 +8,19 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.List;
abstract class NumericAggregate extends AggregateFunction {
NumericAggregate(Location location, Expression field, List<Expression> parameters) {
super(location, field, parameters);
NumericAggregate(Source source, Expression field, List<Expression> parameters) {
super(source, field, parameters);
}
NumericAggregate(Location location, Expression field) {
super(location, field);
NumericAggregate(Source source, Expression field) {
super(source, field);
}
@Override

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.expression.Foldables;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -22,8 +22,8 @@ public class Percentile extends NumericAggregate implements EnclosedAgg {
private final Expression percent;
public Percentile(Location location, Expression field, Expression percent) {
super(location, field, singletonList(percent));
public Percentile(Source source, Expression field, Expression percent) {
super(source, field, singletonList(percent));
this.percent = percent;
}
@ -37,7 +37,7 @@ public class Percentile extends NumericAggregate implements EnclosedAgg {
if (newChildren.size() != 2) {
throw new IllegalArgumentException("expected [2] children but received [" + newChildren.size() + "]");
}
return new Percentile(location(), newChildren.get(0), newChildren.get(1));
return new Percentile(source(), newChildren.get(0), newChildren.get(1));
}
@Override

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.expression.Foldables;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -22,8 +22,8 @@ public class PercentileRank extends AggregateFunction implements EnclosedAgg {
private final Expression value;
public PercentileRank(Location location, Expression field, Expression value) {
super(location, field, singletonList(value));
public PercentileRank(Source source, Expression field, Expression value) {
super(source, field, singletonList(value));
this.value = value;
}
@ -37,7 +37,7 @@ public class PercentileRank extends AggregateFunction implements EnclosedAgg {
if (newChildren.size() != 2) {
throw new IllegalArgumentException("expected [2] children but received [" + newChildren.size() + "]");
}
return new PercentileRank(location(), newChildren.get(0), newChildren.get(1));
return new PercentileRank(source(), newChildren.get(0), newChildren.get(1));
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.List;
@ -14,8 +14,8 @@ public class PercentileRanks extends CompoundNumericAggregate {
private final List<Expression> values;
public PercentileRanks(Location location, Expression field, List<Expression> values) {
super(location, field, values);
public PercentileRanks(Source source, Expression field, List<Expression> values) {
super(source, field, values);
this.values = values;
}
@ -29,7 +29,7 @@ public class PercentileRanks extends CompoundNumericAggregate {
if (newChildren.size() < 2) {
throw new IllegalArgumentException("expected at least [2] children but received [" + newChildren.size() + "]");
}
return new PercentileRanks(location(), newChildren.get(0), newChildren.subList(1, newChildren.size()));
return new PercentileRanks(source(), newChildren.get(0), newChildren.subList(1, newChildren.size()));
}
public List<Expression> values() {

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.expression.function.aggregate;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.List;
@ -14,8 +14,8 @@ public class Percentiles extends CompoundNumericAggregate {
private final List<Expression> percents;
public Percentiles(Location location, Expression field, List<Expression> percents) {
super(location, field, percents);
public Percentiles(Source source, Expression field, List<Expression> percents) {
super(source, field, percents);
this.percents = percents;
}
@ -29,7 +29,7 @@ public class Percentiles extends CompoundNumericAggregate {
if (newChildren.size() < 2) {
throw new IllegalArgumentException("expected more than one child but received [" + newChildren.size() + "]");
}
return new Percentiles(location(), newChildren.get(0), newChildren.subList(1, newChildren.size()));
return new Percentiles(source(), newChildren.get(0), newChildren.subList(1, newChildren.size()));
}
public List<Expression> percents() {

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class Skewness extends NumericAggregate implements MatrixStatsEnclosed {
public Skewness(Location location, Expression field) {
super(location, field);
public Skewness(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Skewness extends NumericAggregate implements MatrixStatsEnclosed {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Skewness(location(), newChildren.get(0));
return new Skewness(source(), newChildren.get(0));
}
@Override

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class Stats extends CompoundNumericAggregate {
public Stats(Location location, Expression field) {
super(location, field);
public Stats(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Stats extends CompoundNumericAggregate {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Stats(location(), newChildren.get(0));
return new Stats(source(), newChildren.get(0));
}
public static boolean isTypeCompatible(Expression e) {

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class StddevPop extends NumericAggregate implements ExtendedStatsEnclosed {
public StddevPop(Location location, Expression field) {
super(location, field);
public StddevPop(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class StddevPop extends NumericAggregate implements ExtendedStatsEnclosed
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new StddevPop(location(), newChildren.get(0));
return new StddevPop(source(), newChildren.get(0));
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -16,8 +16,8 @@ import org.elasticsearch.xpack.sql.type.DataType;
*/
public class Sum extends NumericAggregate implements EnclosedAgg {
public Sum(Location location, Expression field) {
super(location, field);
public Sum(Source source, Expression field) {
super(source, field);
}
@Override
@ -30,7 +30,7 @@ public class Sum extends NumericAggregate implements EnclosedAgg {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new Sum(location(), newChildren.get(0));
return new Sum(source(), newChildren.get(0));
}
@Override

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class SumOfSquares extends NumericAggregate implements ExtendedStatsEnclosed {
public SumOfSquares(Location location, Expression field) {
super(location, field);
public SumOfSquares(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class SumOfSquares extends NumericAggregate implements ExtendedStatsEnclo
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new SumOfSquares(location(), newChildren.get(0));
return new SumOfSquares(source(), newChildren.get(0));
}
@Override

View File

@ -7,13 +7,13 @@ package org.elasticsearch.xpack.sql.expression.function.aggregate;
import java.util.List;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class VarPop extends NumericAggregate implements ExtendedStatsEnclosed {
public VarPop(Location location, Expression field) {
super(location, field);
public VarPop(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class VarPop extends NumericAggregate implements ExtendedStatsEnclosed {
if (newChildren.size() != 1) {
throw new IllegalArgumentException("expected [1] child but received [" + newChildren.size() + "]");
}
return new VarPop(location(), newChildren.get(0));
return new VarPop(source(), newChildren.get(0));
}
@Override

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.function.Function;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.AggNameInput;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.util.CollectionUtils;
import java.util.List;
@ -30,12 +30,12 @@ public abstract class GroupingFunction extends Function {
private GroupingFunctionAttribute lazyAttribute;
protected GroupingFunction(Location location, Expression field) {
this(location, field, emptyList());
protected GroupingFunction(Source source, Expression field) {
this(source, field, emptyList());
}
protected GroupingFunction(Location location, Expression field, List<Expression> parameters) {
super(location, CollectionUtils.combine(singletonList(field), parameters));
protected GroupingFunction(Source source, Expression field, List<Expression> parameters) {
super(source, CollectionUtils.combine(singletonList(field), parameters));
this.field = field;
this.parameters = parameters;
}
@ -52,7 +52,7 @@ public abstract class GroupingFunction extends Function {
public GroupingFunctionAttribute toAttribute() {
if (lazyAttribute == null) {
// this is highly correlated with QueryFolder$FoldAggregate#addFunction (regarding the function name within the querydsl)
lazyAttribute = new GroupingFunctionAttribute(location(), name(), dataType(), id(), functionId());
lazyAttribute = new GroupingFunctionAttribute(source(), name(), dataType(), id(), functionId());
}
return lazyAttribute;
}
@ -70,7 +70,7 @@ public abstract class GroupingFunction extends Function {
@Override
protected Pipe makePipe() {
// unresolved AggNameInput (should always get replaced by the folder)
return new AggNameInput(location(), this, name());
return new AggNameInput(source(), this, name());
}
@Override

View File

@ -9,19 +9,19 @@ import org.elasticsearch.xpack.sql.expression.Attribute;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
public class GroupingFunctionAttribute extends FunctionAttribute {
GroupingFunctionAttribute(Location location, String name, DataType dataType, ExpressionId id, String functionId) {
this(location, name, dataType, null, false, id, false, functionId);
GroupingFunctionAttribute(Source source, String name, DataType dataType, ExpressionId id, String functionId) {
this(source, name, dataType, null, false, id, false, functionId);
}
public GroupingFunctionAttribute(Location location, String name, DataType dataType, String qualifier,
public GroupingFunctionAttribute(Source source, String name, DataType dataType, String qualifier,
boolean nullable, ExpressionId id, boolean synthetic, String functionId) {
super(location, name, dataType, qualifier, nullable, id, synthetic, functionId);
super(source, name, dataType, qualifier, nullable, id, synthetic, functionId);
}
@Override
@ -32,18 +32,18 @@ public class GroupingFunctionAttribute extends FunctionAttribute {
@Override
protected Expression canonicalize() {
return new GroupingFunctionAttribute(location(), "<none>", dataType(), null, true, id(), false, "<none>");
return new GroupingFunctionAttribute(source(), "<none>", dataType(), null, true, id(), false, "<none>");
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
// this is highly correlated with QueryFolder$FoldAggregate#addFunction (regarding the function name within the querydsl)
// that is the functionId is actually derived from the expression id to easily track it across contexts
return new GroupingFunctionAttribute(location, name, dataType(), qualifier, nullable, id, synthetic, functionId());
return new GroupingFunctionAttribute(source, name, dataType(), qualifier, nullable, id, synthetic, functionId());
}
public GroupingFunctionAttribute withFunctionId(String functionId, String propertyPath) {
return new GroupingFunctionAttribute(location(), name(), dataType(), qualifier(), nullable(),
return new GroupingFunctionAttribute(source(), name(), dataType(), qualifier(), nullable(),
id(), synthetic(), functionId);
}

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.expression.Literal;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.DataTypes;
@ -23,8 +23,8 @@ public class Histogram extends GroupingFunction {
private final Literal interval;
private final ZoneId zoneId;
public Histogram(Location location, Expression field, Expression interval, ZoneId zoneId) {
super(location, field);
public Histogram(Source source, Expression field, Expression interval, ZoneId zoneId) {
super(source, field);
this.interval = (Literal) interval;
this.zoneId = zoneId;
}
@ -54,7 +54,7 @@ public class Histogram extends GroupingFunction {
@Override
protected GroupingFunction replaceChild(Expression newChild) {
return new Histogram(location(), newChild, interval, zoneId);
return new Histogram(source(), newChild, interval, zoneId);
}
@Override

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.expression.gen.script.Scripts;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.Arrays;
import java.util.List;
@ -18,8 +18,8 @@ public abstract class BinaryScalarFunction extends ScalarFunction {
private final Expression left, right;
protected BinaryScalarFunction(Location location, Expression left, Expression right) {
super(location, Arrays.asList(left, right));
protected BinaryScalarFunction(Source source, Expression left, Expression right) {
super(source, Arrays.asList(left, right));
this.left = left;
this.right = right;
}

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.DataTypeConversion;
@ -23,8 +23,8 @@ public class Cast extends UnaryScalarFunction {
private final DataType dataType;
public Cast(Location location, Expression field, DataType dataType) {
super(location, field);
public Cast(Source source, Expression field, DataType dataType) {
super(source, field);
this.dataType = dataType;
}
@ -35,7 +35,7 @@ public class Cast extends UnaryScalarFunction {
@Override
protected UnaryScalarFunction replaceChild(Expression newChild) {
return new Cast(location(), newChild, dataType);
return new Cast(source(), newChild, dataType);
}
public DataType from() {

View File

@ -9,7 +9,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -21,8 +21,8 @@ public abstract class ConfigurationFunction extends ScalarFunction {
private final Configuration configuration;
private final DataType dataType;
protected ConfigurationFunction(Location location, Configuration configuration, DataType dataType) {
super(location);
protected ConfigurationFunction(Source source, Configuration configuration, DataType dataType) {
super(source);
this.configuration = configuration;
this.dataType = dataType;
}

View File

@ -7,14 +7,14 @@
package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
public class Database extends ConfigurationFunction {
public Database(Location location, Configuration configuration) {
super(location, configuration, DataType.KEYWORD);
public Database(Source source, Configuration configuration) {
super(source, configuration, DataType.KEYWORD);
}
@Override

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.Function;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptWeaver;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.List;
@ -24,18 +24,18 @@ public abstract class ScalarFunction extends Function implements ScriptWeaver {
private ScalarFunctionAttribute lazyAttribute = null;
protected ScalarFunction(Location location) {
super(location, emptyList());
protected ScalarFunction(Source source) {
super(source, emptyList());
}
protected ScalarFunction(Location location, List<Expression> fields) {
super(location, fields);
protected ScalarFunction(Source source, List<Expression> fields) {
super(source, fields);
}
@Override
public final ScalarFunctionAttribute toAttribute() {
if (lazyAttribute == null) {
lazyAttribute = new ScalarFunctionAttribute(location(), name(), dataType(), id(), functionId(), asScript(), orderBy(),
lazyAttribute = new ScalarFunctionAttribute(source(), name(), dataType(), id(), functionId(), asScript(), orderBy(),
asPipe());
}
return lazyAttribute;

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.ExpressionId;
import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -23,15 +23,15 @@ public class ScalarFunctionAttribute extends FunctionAttribute {
private final Expression orderBy;
private final Pipe pipe;
ScalarFunctionAttribute(Location location, String name, DataType dataType, ExpressionId id,
ScalarFunctionAttribute(Source source, String name, DataType dataType, ExpressionId id,
String functionId, ScriptTemplate script, Expression orderBy, Pipe processorDef) {
this(location, name, dataType, null, true, id, false, functionId, script, orderBy, processorDef);
this(source, name, dataType, null, true, id, false, functionId, script, orderBy, processorDef);
}
public ScalarFunctionAttribute(Location location, String name, DataType dataType, String qualifier,
public ScalarFunctionAttribute(Source source, String name, DataType dataType, String qualifier,
boolean nullable, ExpressionId id, boolean synthetic, String functionId, ScriptTemplate script,
Expression orderBy, Pipe pipe) {
super(location, name, dataType, qualifier, nullable, id, synthetic, functionId);
super(source, name, dataType, qualifier, nullable, id, synthetic, functionId);
this.script = script;
this.orderBy = orderBy;
@ -60,13 +60,13 @@ public class ScalarFunctionAttribute extends FunctionAttribute {
@Override
protected Expression canonicalize() {
return new ScalarFunctionAttribute(location(), "<none>", dataType(), null, true, id(), false,
return new ScalarFunctionAttribute(source(), "<none>", dataType(), null, true, id(), false,
functionId(), script, orderBy, pipe);
}
@Override
protected Attribute clone(Location location, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
return new ScalarFunctionAttribute(location, name, dataType(), qualifier, nullable, id, synthetic,
protected Attribute clone(Source source, String name, String qualifier, boolean nullable, ExpressionId id, boolean synthetic) {
return new ScalarFunctionAttribute(source, name, dataType(), qualifier, nullable, id, synthetic,
functionId(), script, orderBy, pipe);
}

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.UnaryPipe;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.util.List;
@ -21,13 +21,13 @@ public abstract class UnaryScalarFunction extends ScalarFunction {
private final Expression field;
protected UnaryScalarFunction(Location location) {
super(location);
protected UnaryScalarFunction(Source source) {
super(source);
this.field = null;
}
protected UnaryScalarFunction(Location location, Expression field) {
super(location, singletonList(field));
protected UnaryScalarFunction(Source source, Expression field) {
super(source, singletonList(field));
this.field = field;
}
@ -47,7 +47,7 @@ public abstract class UnaryScalarFunction extends ScalarFunction {
@Override
public final Pipe makePipe() {
return new UnaryPipe(location(), this, Expressions.pipe(field()), makeProcessor());
return new UnaryPipe(source(), this, Expressions.pipe(field()), makeProcessor());
}
protected abstract Processor makeProcessor();

View File

@ -7,14 +7,14 @@
package org.elasticsearch.xpack.sql.expression.function.scalar;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
public class User extends ConfigurationFunction {
public User(Location location, Configuration configuration) {
super(location, configuration, DataType.KEYWORD);
public User(Source source, Configuration configuration) {
super(source, configuration, DataType.KEYWORD);
}
@Override

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.expression.function.scalar.UnaryScalarFunction;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.time.ZoneId;
@ -22,8 +22,8 @@ abstract class BaseDateTimeFunction extends UnaryScalarFunction {
private final ZoneId zoneId;
private final String name;
BaseDateTimeFunction(Location location, Expression field, ZoneId zoneId) {
super(location, field);
BaseDateTimeFunction(Source source, Expression field, ZoneId zoneId) {
super(source, field);
this.zoneId = zoneId;
StringBuilder sb = new StringBuilder(super.name());

View File

@ -9,7 +9,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.ConfigurationFunction;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -20,8 +20,8 @@ public class CurrentDateTime extends ConfigurationFunction {
private final Expression precision;
private final ZonedDateTime dateTime;
public CurrentDateTime(Location location, Expression precision, Configuration configuration) {
super(location, configuration, DataType.DATE);
public CurrentDateTime(Source source, Expression precision, Configuration configuration) {
super(source, configuration, DataType.DATE);
this.precision = precision;
int p = precision != null ? ((Number) precision.fold()).intValue() : 0;
this.dateTime = nanoPrecision(configuration().now(), p);

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeP
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ParamsBuilder;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.time.ZoneId;
@ -23,8 +23,8 @@ public abstract class DateTimeFunction extends BaseDateTimeFunction {
private final DateTimeExtractor extractor;
DateTimeFunction(Location location, Expression field, ZoneId zoneId, DateTimeExtractor extractor) {
super(location, field, zoneId);
DateTimeFunction(Source source, Expression field, ZoneId zoneId, DateTimeExtractor extractor) {
super(source, field, zoneId);
this.extractor = extractor;
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public abstract class DateTimeHistogramFunction extends DateTimeFunction {
DateTimeHistogramFunction(Location location, Expression field, ZoneId zoneId, DateTimeExtractor extractor) {
super(location, field, zoneId, extractor);
DateTimeHistogramFunction(Source source, Expression field, ZoneId zoneId, DateTimeExtractor extractor) {
super(source, field, zoneId, extractor);
}
/**

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NamedDateTimeProcessor.NameExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public class DayName extends NamedDateTimeFunction {
public DayName(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, NameExtractor.DAY_NAME);
public DayName(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, NameExtractor.DAY_NAME);
}
@Override
@ -28,6 +28,6 @@ public class DayName extends NamedDateTimeFunction {
@Override
protected DayName replaceChild(Expression newChild) {
return new DayName(location(), newChild, zoneId());
return new DayName(source(), newChild, zoneId());
}
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the day of the month from a datetime.
*/
public class DayOfMonth extends DateTimeFunction {
public DayOfMonth(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.DAY_OF_MONTH);
public DayOfMonth(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.DAY_OF_MONTH);
}
@Override
@ -27,7 +27,7 @@ public class DayOfMonth extends DateTimeFunction {
@Override
protected DayOfMonth replaceChild(Expression newChild) {
return new DayOfMonth(location(), newChild, zoneId());
return new DayOfMonth(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NonIsoDateTimeProcessor.NonIsoDateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public class DayOfWeek extends NonIsoDateTimeFunction {
public DayOfWeek(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, NonIsoDateTimeExtractor.DAY_OF_WEEK);
public DayOfWeek(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, NonIsoDateTimeExtractor.DAY_OF_WEEK);
}
@Override
@ -28,6 +28,6 @@ public class DayOfWeek extends NonIsoDateTimeFunction {
@Override
protected DayOfWeek replaceChild(Expression newChild) {
return new DayOfWeek(location(), newChild, zoneId());
return new DayOfWeek(source(), newChild, zoneId());
}
}

View File

@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.UnaryScalarFunction;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
* Extract the day of the year from a datetime.
*/
public class DayOfYear extends DateTimeFunction {
public DayOfYear(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.DAY_OF_YEAR);
public DayOfYear(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.DAY_OF_YEAR);
}
@Override
@ -28,7 +28,7 @@ public class DayOfYear extends DateTimeFunction {
@Override
protected UnaryScalarFunction replaceChild(Expression newChild) {
return new DayOfYear(location(), newChild, zoneId());
return new DayOfYear(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the hour of the day from a datetime.
*/
public class HourOfDay extends DateTimeFunction {
public HourOfDay(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.HOUR_OF_DAY);
public HourOfDay(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.HOUR_OF_DAY);
}
@Override
@ -27,7 +27,7 @@ public class HourOfDay extends DateTimeFunction {
@Override
protected HourOfDay replaceChild(Expression newChild) {
return new HourOfDay(location(), newChild, zoneId());
return new HourOfDay(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the day of the week (following the ISO standard) from a datetime. 1 is Monday, 2 is Tuesday, etc.
*/
public class IsoDayOfWeek extends DateTimeFunction {
public IsoDayOfWeek(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.ISO_DAY_OF_WEEK);
public IsoDayOfWeek(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.ISO_DAY_OF_WEEK);
}
@Override
@ -27,7 +27,7 @@ public class IsoDayOfWeek extends DateTimeFunction {
@Override
protected IsoDayOfWeek replaceChild(Expression newChild) {
return new IsoDayOfWeek(location(), newChild, zoneId());
return new IsoDayOfWeek(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the week of the year from a datetime following the ISO standard.
*/
public class IsoWeekOfYear extends DateTimeFunction {
public IsoWeekOfYear(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.ISO_WEEK_OF_YEAR);
public IsoWeekOfYear(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.ISO_WEEK_OF_YEAR);
}
@Override
@ -27,7 +27,7 @@ public class IsoWeekOfYear extends DateTimeFunction {
@Override
protected IsoWeekOfYear replaceChild(Expression newChild) {
return new IsoWeekOfYear(location(), newChild, zoneId());
return new IsoWeekOfYear(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public class MinuteOfDay extends DateTimeFunction {
public MinuteOfDay(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.MINUTE_OF_DAY);
public MinuteOfDay(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.MINUTE_OF_DAY);
}
@Override
@ -28,7 +28,7 @@ public class MinuteOfDay extends DateTimeFunction {
@Override
protected MinuteOfDay replaceChild(Expression newChild) {
return new MinuteOfDay(location(), newChild, zoneId());
return new MinuteOfDay(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Exract the minute of the hour from a datetime.
*/
public class MinuteOfHour extends DateTimeFunction {
public MinuteOfHour(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.MINUTE_OF_HOUR);
public MinuteOfHour(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.MINUTE_OF_HOUR);
}
@Override
@ -27,7 +27,7 @@ public class MinuteOfHour extends DateTimeFunction {
@Override
protected MinuteOfHour replaceChild(Expression newChild) {
return new MinuteOfHour(location(), newChild, zoneId());
return new MinuteOfHour(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NamedDateTimeProcessor.NameExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public class MonthName extends NamedDateTimeFunction {
public MonthName(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, NameExtractor.MONTH_NAME);
public MonthName(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, NameExtractor.MONTH_NAME);
}
@Override
@ -28,6 +28,6 @@ public class MonthName extends NamedDateTimeFunction {
@Override
protected MonthName replaceChild(Expression newChild) {
return new MonthName(location(), newChild, zoneId());
return new MonthName(source(), newChild, zoneId());
}
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the month of the year from a datetime.
*/
public class MonthOfYear extends DateTimeFunction {
public MonthOfYear(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.MONTH_OF_YEAR);
public MonthOfYear(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.MONTH_OF_YEAR);
}
@Override
@ -27,7 +27,7 @@ public class MonthOfYear extends DateTimeFunction {
@Override
protected MonthOfYear replaceChild(Expression newChild) {
return new MonthOfYear(location(), newChild, zoneId());
return new MonthOfYear(source(), newChild, zoneId());
}
@Override

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.FieldAttribute;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NamedDateTimeProcessor.NameExtractor;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -28,8 +28,8 @@ abstract class NamedDateTimeFunction extends BaseDateTimeFunction {
private final NameExtractor nameExtractor;
NamedDateTimeFunction(Location location, Expression field, ZoneId zoneId, NameExtractor nameExtractor) {
super(location, field, zoneId);
NamedDateTimeFunction(Source source, Expression field, ZoneId zoneId, NameExtractor nameExtractor) {
super(source, field, zoneId);
this.nameExtractor = nameExtractor;
}

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.FieldAttribute;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NonIsoDateTimeProcessor.NonIsoDateTimeExtractor;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -28,8 +28,8 @@ abstract class NonIsoDateTimeFunction extends BaseDateTimeFunction {
private final NonIsoDateTimeExtractor extractor;
NonIsoDateTimeFunction(Location location, Expression field, ZoneId zoneId, NonIsoDateTimeExtractor extractor) {
super(location, field, zoneId);
NonIsoDateTimeFunction(Source source, Expression field, ZoneId zoneId, NonIsoDateTimeExtractor extractor) {
super(source, field, zoneId);
this.extractor = extractor;
}

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.FieldAttribute;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import org.elasticsearch.xpack.sql.type.DataType;
@ -22,8 +22,8 @@ import static org.elasticsearch.xpack.sql.expression.gen.script.ParamsBuilder.pa
public class Quarter extends BaseDateTimeFunction {
public Quarter(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId);
public Quarter(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId);
}
@Override
@ -48,7 +48,7 @@ public class Quarter extends BaseDateTimeFunction {
@Override
protected Quarter replaceChild(Expression newChild) {
return new Quarter(location(), newChild, zoneId());
return new Quarter(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -16,8 +16,8 @@ import java.time.ZoneId;
* Extract the second of the minute from a datetime.
*/
public class SecondOfMinute extends DateTimeFunction {
public SecondOfMinute(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.SECOND_OF_MINUTE);
public SecondOfMinute(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.SECOND_OF_MINUTE);
}
@Override
@ -27,7 +27,7 @@ public class SecondOfMinute extends DateTimeFunction {
@Override
protected SecondOfMinute replaceChild(Expression newChild) {
return new SecondOfMinute(location(), newChild, zoneId());
return new SecondOfMinute(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.NonIsoDateTimeProcessor.NonIsoDateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -17,8 +17,8 @@ import java.time.ZoneId;
*/
public class WeekOfYear extends NonIsoDateTimeFunction {
public WeekOfYear(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, NonIsoDateTimeExtractor.WEEK_OF_YEAR);
public WeekOfYear(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, NonIsoDateTimeExtractor.WEEK_OF_YEAR);
}
@Override
@ -28,6 +28,6 @@ public class WeekOfYear extends NonIsoDateTimeFunction {
@Override
protected WeekOfYear replaceChild(Expression newChild) {
return new WeekOfYear(location(), newChild, zoneId());
return new WeekOfYear(source(), newChild, zoneId());
}
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo.NodeCtor2;
import java.time.ZoneId;
@ -20,8 +20,8 @@ public class Year extends DateTimeHistogramFunction {
private static long YEAR_IN_MILLIS = TimeUnit.DAYS.toMillis(1) * 365L;
public Year(Location location, Expression field, ZoneId zoneId) {
super(location, field, zoneId, DateTimeExtractor.YEAR);
public Year(Source source, Expression field, ZoneId zoneId) {
super(source, field, zoneId, DateTimeExtractor.YEAR);
}
@Override
@ -31,7 +31,7 @@ public class Year extends DateTimeHistogramFunction {
@Override
protected Year replaceChild(Expression newChild) {
return new Year(location(), newChild, zoneId());
return new Year(source(), newChild, zoneId());
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
@ -16,8 +16,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class ACos extends MathFunction {
public ACos(Location location, Expression field) {
super(location, field);
public ACos(Source source, Expression field) {
super(source, field);
}
@Override
@ -27,7 +27,7 @@ public class ACos extends MathFunction {
@Override
protected ACos replaceChild(Expression newChild) {
return new ACos(location(), newChild);
return new ACos(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class ASin extends MathFunction {
public ASin(Location location, Expression field) {
super(location, field);
public ASin(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class ASin extends MathFunction {
@Override
protected ASin replaceChild(Expression newChild) {
return new ASin(location(), newChild);
return new ASin(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class ATan extends MathFunction {
public ATan(Location location, Expression field) {
super(location, field);
public ATan(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class ATan extends MathFunction {
@Override
protected ATan replaceChild(Expression newChild) {
return new ATan(location(), newChild);
return new ATan(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.BinaryMathProcessor.BinaryMathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -16,8 +16,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
*/
public class ATan2 extends BinaryNumericFunction {
public ATan2(Location location, Expression left, Expression right) {
super(location, left, right, BinaryMathOperation.ATAN2);
public ATan2(Source source, Expression left, Expression right) {
super(source, left, right, BinaryMathOperation.ATAN2);
}
@Override
@ -27,6 +27,6 @@ public class ATan2 extends BinaryNumericFunction {
@Override
protected ATan2 replaceChildren(Expression newLeft, Expression newRight) {
return new ATan2(location(), newLeft, newRight);
return new ATan2(source(), newLeft, newRight);
}
}

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
@ -16,8 +16,8 @@ import org.elasticsearch.xpack.sql.type.DataType;
* function.
*/
public class Abs extends MathFunction {
public Abs(Location location, Expression field) {
super(location, field);
public Abs(Source source, Expression field) {
super(source, field);
}
@Override
@ -27,7 +27,7 @@ public class Abs extends MathFunction {
@Override
protected Abs replaceChild(Expression newChild) {
return new Abs(location(), newChild);
return new Abs(source(), newChild);
}
@Override

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.BinaryMathProcessor.BinaryMathOperation;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.BinaryPipe;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import java.util.Objects;
@ -21,8 +21,8 @@ public class BinaryMathPipe extends BinaryPipe {
private final BinaryMathOperation operation;
public BinaryMathPipe(Location location, Expression expression, Pipe left, Pipe right, BinaryMathOperation operation) {
super(location, expression, left, right);
public BinaryMathPipe(Source source, Expression expression, Pipe left, Pipe right, BinaryMathOperation operation) {
super(source, expression, left, right);
this.operation = operation;
}
@ -37,7 +37,7 @@ public class BinaryMathPipe extends BinaryPipe {
@Override
protected BinaryPipe replaceChildren(Pipe left, Pipe right) {
return new BinaryMathPipe(location(), expression(), left, right, operation);
return new BinaryMathPipe(source(), expression(), left, right, operation);
}
@Override

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.Expressions.ParamOrdinal;
import org.elasticsearch.xpack.sql.expression.function.scalar.BinaryScalarFunction;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.BinaryMathProcessor.BinaryMathOperation;
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.type.DataType;
import java.util.Objects;
@ -20,8 +20,8 @@ public abstract class BinaryNumericFunction extends BinaryScalarFunction {
private final BinaryMathOperation operation;
BinaryNumericFunction(Location location, Expression left, Expression right, BinaryMathOperation operation) {
super(location, left, right);
BinaryNumericFunction(Source source, Expression left, Expression right, BinaryMathOperation operation) {
super(source, left, right);
this.operation = operation;
}
@ -51,7 +51,7 @@ public abstract class BinaryNumericFunction extends BinaryScalarFunction {
@Override
protected Pipe makePipe() {
return new BinaryMathPipe(location(), this, Expressions.pipe(left()), Expressions.pipe(right()), operation);
return new BinaryMathPipe(source(), this, Expressions.pipe(left()), Expressions.pipe(right()), operation);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Cbrt extends MathFunction {
public Cbrt(Location location, Expression field) {
super(location, field);
public Cbrt(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Cbrt extends MathFunction {
@Override
protected Cbrt replaceChild(Expression newChild) {
return new Cbrt(location(), newChild);
return new Cbrt(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.type.DataTypeConversion;
@ -17,8 +17,8 @@ import org.elasticsearch.xpack.sql.type.DataTypeConversion;
* function.
*/
public class Ceil extends MathFunction {
public Ceil(Location location, Expression field) {
super(location, field);
public Ceil(Source source, Expression field) {
super(source, field);
}
@Override
@ -28,7 +28,7 @@ public class Ceil extends MathFunction {
@Override
protected Ceil replaceChild(Expression newChild) {
return new Ceil(location(), newChild);
return new Ceil(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Cos extends MathFunction {
public Cos(Location location, Expression field) {
super(location, field);
public Cos(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Cos extends MathFunction {
@Override
protected Cos replaceChild(Expression newChild) {
return new Cos(location(), newChild);
return new Cos(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Cosh extends MathFunction {
public Cosh(Location location, Expression field) {
super(location, field);
public Cosh(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Cosh extends MathFunction {
@Override
protected Cosh replaceChild(Expression newChild) {
return new Cosh(location(), newChild);
return new Cosh(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Cot extends MathFunction {
public Cot(Location location, Expression field) {
super(location, field);
public Cot(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Cot extends MathFunction {
@Override
protected Cot replaceChild(Expression newChild) {
return new Cot(location(), newChild);
return new Cot(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* to <a href="https://en.wikipedia.org/wiki/Degree_(angle)">degrees</a>.
*/
public class Degrees extends MathFunction {
public Degrees(Location location, Expression field) {
super(location, field);
public Degrees(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Degrees extends MathFunction {
@Override
protected Degrees replaceChild(Expression newChild) {
return new Degrees(location(), newChild);
return new Degrees(source(), newChild);
}
@Override

View File

@ -11,7 +11,7 @@ import org.elasticsearch.xpack.sql.expression.Literal;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.expression.gen.script.Params;
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
import org.elasticsearch.xpack.sql.type.DataType;
import org.elasticsearch.xpack.sql.util.StringUtils;
@ -20,8 +20,8 @@ public class E extends MathFunction {
private static final ScriptTemplate TEMPLATE = new ScriptTemplate("Math.E", Params.EMPTY, DataType.DOUBLE);
public E(Location location) {
super(location, new Literal(location, "E", Math.E, DataType.DOUBLE));
public E(Source source) {
super(source, new Literal(source, "E", Math.E, DataType.DOUBLE));
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Exp extends MathFunction {
public Exp(Location location, Expression field) {
super(location, field);
public Exp(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Exp extends MathFunction {
@Override
protected Exp replaceChild(Expression newChild) {
return new Exp(location(), newChild);
return new Exp(source(), newChild);
}
@Override

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.expression.function.scalar.math;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.function.scalar.math.MathProcessor.MathOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
/**
@ -15,8 +15,8 @@ import org.elasticsearch.xpack.sql.tree.NodeInfo;
* function.
*/
public class Expm1 extends MathFunction {
public Expm1(Location location, Expression field) {
super(location, field);
public Expm1(Source source, Expression field) {
super(source, field);
}
@Override
@ -26,7 +26,7 @@ public class Expm1 extends MathFunction {
@Override
protected Expm1 replaceChild(Expression newChild) {
return new Expm1(location(), newChild);
return new Expm1(source(), newChild);
}
@Override

Some files were not shown because too many files have changed in this diff Show More