Skip to content

Commit

Permalink
One more
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Aug 25, 2023
1 parent 73f5331 commit a7cbdbb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/reference/esql/functions/abs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[[esql-abs]]
=== `ABS`
[.text-center]
image::signature/abs.svg[]

Returns the absolute value.

[source,esql]
Expand All @@ -8,3 +11,7 @@ FROM employees
| KEEP first_name, last_name, height
| EVAL abs_height = ABS(0.0 - height)
----

Supported types:

include::types/abs.asciidoc[]
2 changes: 1 addition & 1 deletion docs/reference/esql/functions/signature/abs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/reference/esql/functions/types/abs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[%header.monospaced.styled,format=dsv,separator=|]
|===
arg1 | result
n | result
double | double
integer | integer
long | long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ showFunctions
show functions;

name:keyword | synopsis:keyword
abs |abs(arg1)
abs |abs(n)
acos |acos(arg1)
asin |asin(arg1)
atan |atan(arg1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.compute.operator.EvalOperator;
import org.elasticsearch.xpack.esql.EsqlUnsupportedOperationException;
import org.elasticsearch.xpack.esql.evaluator.mapper.EvaluatorMapper;
import org.elasticsearch.xpack.esql.expression.function.Named;
import org.elasticsearch.xpack.esql.expression.function.scalar.UnaryScalarFunction;
import org.elasticsearch.xpack.ql.expression.Expression;
import org.elasticsearch.xpack.ql.tree.NodeInfo;
Expand All @@ -22,8 +23,8 @@
import java.util.function.Supplier;

public class Abs extends UnaryScalarFunction implements EvaluatorMapper {
public Abs(Source source, Expression field) {
super(source, field);
public Abs(Source source, @Named("n") Expression n) {
super(source, n);
}

@Override
Expand Down

0 comments on commit a7cbdbb

Please sign in to comment.