Skip to content

Commit 8ae1acd

Browse files
committed
Update
1 parent e525493 commit 8ae1acd

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CopySign.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ EvalOperator.ExpressionEvaluator.Factory create(
6161

6262
private DataType dataType;
6363

64-
@FunctionInfo(
65-
description = """
66-
Returns a value with the magnitude of the first argument and the sign of the second argument.
67-
This function is similar to Java's Math.copySign(double magnitude, double sign) which is
68-
similar to `copysign` from [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754).""",
69-
returnType = { "double", "integer", "long" }
70-
)
64+
@FunctionInfo(description = """
65+
Returns a value with the magnitude of the first argument and the sign of the second argument.
66+
This function is similar to Java's Math.copySign(double magnitude, double sign) which is
67+
similar to `copysign` from [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754).""", returnType = { "double", "integer", "long" })
7168
public CopySign(
7269
Source source,
7370
@Param(

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,11 @@ public static List<TypedDataSupplier> getSuppliersForNumericType(DataType type,
358358
throw new IllegalArgumentException("bogus numeric type [" + type + "]");
359359
}
360360

361-
public static List<TypedDataSupplier> getSuppliersForNumericType(DataType type) {
361+
/**
362+
* A {@link List} of the cases for the specified type without any limits.
363+
* See {@link #getSuppliersForNumericType} for cases with limits on numbers.
364+
*/
365+
public static List<TypedDataSupplier> unlimitedSuppliers(DataType type) {
362366
if (type == DataType.INTEGER) {
363367
return intCases(Integer.MIN_VALUE, Integer.MAX_VALUE, true);
364368
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CopySignTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import static org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier.casesCrossProduct;
2828
import static org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier.getCastEvaluator;
29-
import static org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier.getSuppliersForNumericType;
29+
import static org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier.unlimitedSuppliers;
3030
import static org.hamcrest.Matchers.equalTo;
3131

3232
public class CopySignTests extends AbstractScalarFunctionTestCase {
@@ -78,8 +78,8 @@ public static Iterable<Object[]> parameters() {
7878
};
7979
casesCrossProduct(
8080
expected,
81-
getSuppliersForNumericType(lhsType),
82-
getSuppliersForNumericType(rhsType),
81+
unlimitedSuppliers(lhsType),
82+
unlimitedSuppliers(rhsType),
8383
evaluatorToString,
8484
(l, r) -> List.of(),
8585
suppliers,

0 commit comments

Comments
 (0)