Skip to content

Commit 22469ce

Browse files
committed
test + example update
1 parent ce18375 commit 22469ce

File tree

2 files changed

+13
-1
lines changed
  • x-pack/plugin/esql
    • qa/testFixtures/src/main/resources
    • src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/math

2 files changed

+13
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/math.csv-spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,12 +1713,16 @@ magnitude:double | sign:double | result:double
17131713
;
17141714

17151715
copySignOfPositiveToNegative
1716+
// tag::copySign-PosToNeg[]
17161717
ROW magnitude = 5.2, sign = -9.0
17171718
| EVAL result = COPY_SIGN(magnitude, sign)
1719+
// end::copySign-PosToNeg[]
17181720
;
17191721

1722+
// tag::copySign-PosToNeg-result[]
17201723
magnitude:double | sign:double | result:double
17211724
5.2 | -9.0 | -5.2
1725+
// end::copySign-PosToNeg-result[]
17221726
;
17231727

17241728
copySignOfNegativeToPositive
@@ -1783,3 +1787,11 @@ ROW magnitude = 9223372036854775808, sign = -11.2
17831787
magnitude:unsigned_long | sign:double | result:double
17841788
9223372036854775808 | -11.2 | -9223372036854775808
17851789
;
1790+
1791+
copySignAsArgument
1792+
ROW result = SIGNUM(COPY_SIGN(24, -11))
1793+
;
1794+
1795+
result:double
1796+
-1
1797+
;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CopySign extends EsqlScalarFunction {
4040
@FunctionInfo(
4141
returnType = { "double" },
4242
description = "Returns the first argument with the sign of the second argument.",
43-
examples = @Example(file = "math", tag = "CopySign")
43+
examples = @Example(file = "math", tag = "copySign-PosToNeg")
4444
)
4545
public CopySign(
4646
Source source,

0 commit comments

Comments
 (0)