|
@@ -8,11 +8,12 @@ package org.elasticsearch.xpack.sql.expression.function.scalar;
|
|
|
import org.elasticsearch.xpack.sql.expression.Attribute;
|
|
import org.elasticsearch.xpack.sql.expression.Attribute;
|
|
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
|
|
import org.elasticsearch.xpack.sql.expression.ExpressionId;
|
|
import org.elasticsearch.xpack.sql.expression.ExpressionId;
|
|
|
|
|
+import org.elasticsearch.xpack.sql.expression.Nullability;
|
|
|
import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute;
|
|
import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute;
|
|
|
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
|
|
import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe;
|
|
|
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
|
|
import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate;
|
|
|
-import org.elasticsearch.xpack.sql.tree.Source;
|
|
|
|
|
import org.elasticsearch.xpack.sql.tree.NodeInfo;
|
|
import org.elasticsearch.xpack.sql.tree.NodeInfo;
|
|
|
|
|
+import org.elasticsearch.xpack.sql.tree.Source;
|
|
|
import org.elasticsearch.xpack.sql.type.DataType;
|
|
import org.elasticsearch.xpack.sql.type.DataType;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
@@ -25,13 +26,13 @@ public class ScalarFunctionAttribute extends FunctionAttribute {
|
|
|
|
|
|
|
|
ScalarFunctionAttribute(Source source, String name, DataType dataType, ExpressionId id,
|
|
ScalarFunctionAttribute(Source source, String name, DataType dataType, ExpressionId id,
|
|
|
String functionId, ScriptTemplate script, Expression orderBy, Pipe processorDef) {
|
|
String functionId, ScriptTemplate script, Expression orderBy, Pipe processorDef) {
|
|
|
- this(source, name, dataType, null, true, id, false, functionId, script, orderBy, processorDef);
|
|
|
|
|
|
|
+ this(source, name, dataType, null, Nullability.TRUE, id, false, functionId, script, orderBy, processorDef);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public ScalarFunctionAttribute(Source source, 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(source, name, dataType, qualifier, nullable, id, synthetic, functionId);
|
|
|
|
|
|
|
+ Nullability nullability, ExpressionId id, boolean synthetic, String functionId, ScriptTemplate script,
|
|
|
|
|
+ Expression orderBy, Pipe pipe) {
|
|
|
|
|
+ super(source, name, dataType, qualifier, nullability, id, synthetic, functionId);
|
|
|
|
|
|
|
|
this.script = script;
|
|
this.script = script;
|
|
|
this.orderBy = orderBy;
|
|
this.orderBy = orderBy;
|
|
@@ -60,14 +61,15 @@ public class ScalarFunctionAttribute extends FunctionAttribute {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected Expression canonicalize() {
|
|
protected Expression canonicalize() {
|
|
|
- return new ScalarFunctionAttribute(source(), "<none>", dataType(), null, true, id(), false,
|
|
|
|
|
|
|
+ return new ScalarFunctionAttribute(source(), "<none>", dataType(), null, Nullability.TRUE, id(), false,
|
|
|
functionId(), script, orderBy, pipe);
|
|
functionId(), script, orderBy, pipe);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- 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);
|
|
|
|
|
|
|
+ protected Attribute clone(Source source, String name, String qualifier, Nullability nullability,
|
|
|
|
|
+ ExpressionId id, boolean synthetic) {
|
|
|
|
|
+ return new ScalarFunctionAttribute(source, name, dataType(), qualifier, nullability,
|
|
|
|
|
+ id, synthetic, functionId(), script, orderBy, pipe);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -90,4 +92,4 @@ public class ScalarFunctionAttribute extends FunctionAttribute {
|
|
|
protected String label() {
|
|
protected String label() {
|
|
|
return "s->" + functionId();
|
|
return "s->" + functionId();
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|