|
15 | 15 | import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException; |
16 | 16 | import org.elasticsearch.xpack.esql.core.expression.Expression; |
17 | 17 | import org.elasticsearch.xpack.esql.core.expression.Expressions; |
18 | | -import org.elasticsearch.xpack.esql.core.expression.TypeResolutions; |
19 | 18 | import org.elasticsearch.xpack.esql.core.tree.NodeInfo; |
20 | 19 | import org.elasticsearch.xpack.esql.core.tree.Source; |
21 | 20 | import org.elasticsearch.xpack.esql.core.type.DataType; |
@@ -129,24 +128,24 @@ public TypeResolution resolveType() { |
129 | 128 | return new TypeResolution("Sign must be a numeric type"); |
130 | 129 | } |
131 | 130 | dataType = EsqlDataTypeConverter.commonType(magnitude.dataType(), sign.dataType()); |
132 | | -// TypeResolution resolution = TypeResolutions.isType( |
133 | | -// magnitude, |
134 | | -// t -> t == commonType, |
135 | | -// sourceText(), |
136 | | -// TypeResolutions.ParamOrdinal.fromIndex(1), |
137 | | -// magnitude.dataType().typeName() |
138 | | -// ); |
139 | | -// if (resolution.unresolved()) { |
140 | | -// throw new EsqlIllegalArgumentException( |
141 | | -// "Magnitude [{}] is not compatible with sign [{}] for function [{}] - common type is [{}]", |
142 | | -// magnitude.dataType(), |
143 | | -// sign.dataType(), |
144 | | -// NAME |
145 | | -// ,commonType |
146 | | -// ); |
147 | | -//// return resolution; |
148 | | -// } |
149 | | -// dataType = commonType; |
| 131 | + // TypeResolution resolution = TypeResolutions.isType( |
| 132 | + // magnitude, |
| 133 | + // t -> t == commonType, |
| 134 | + // sourceText(), |
| 135 | + // TypeResolutions.ParamOrdinal.fromIndex(1), |
| 136 | + // magnitude.dataType().typeName() |
| 137 | + // ); |
| 138 | + // if (resolution.unresolved()) { |
| 139 | + // throw new EsqlIllegalArgumentException( |
| 140 | + // "Magnitude [{}] is not compatible with sign [{}] for function [{}] - common type is [{}]", |
| 141 | + // magnitude.dataType(), |
| 142 | + // sign.dataType(), |
| 143 | + // NAME |
| 144 | + // ,commonType |
| 145 | + // ); |
| 146 | + //// return resolution; |
| 147 | + // } |
| 148 | + // dataType = commonType; |
150 | 149 | return TypeResolution.TYPE_RESOLVED; |
151 | 150 | } |
152 | 151 |
|
@@ -184,6 +183,7 @@ static long processLong(long magnitude, long sign) { |
184 | 183 | return Math.abs(magnitude); |
185 | 184 | } |
186 | 185 | } |
| 186 | + |
187 | 187 | @Evaluator(extraName = "Integer") |
188 | 188 | static int processInteger(int magnitude, int sign) { |
189 | 189 | if (sign < 0) { |
|
0 commit comments