SQL: Fix POWER doc, add test. (#4953)

This commit is contained in:
Gian Merlino 2017-10-13 14:38:15 -07:00 committed by Fangjin Yang
parent 5cfc7f9ef7
commit f51f346e36
2 changed files with 11 additions and 1 deletions

View File

@ -108,7 +108,7 @@ Numeric functions will return 64 bit integers or 64 bit floats, depending on the
|`FLOOR(expr)`|Floor.|
|`LN(expr)`|Logarithm (base e).|
|`LOG10(expr)`|Logarithm (base 10).|
|`POW(expr, power)`|expr to a power.|
|`POWER(expr, power)`|expr to a power.|
|`SQRT(expr)`|Square root.|
|`TRUNCATE(expr[, digits])`|Truncate expr to a specific number of decimal digits. If digits is negative, then this truncates that many places to the left of the decimal point. Digits defaults to zero if not specified.|
|`TRUNC(expr[, digits])`|Synonym for `TRUNCATE`.|

View File

@ -201,6 +201,16 @@ public class ExpressionsTest
);
}
@Test
public void testPower()
{
testExpression(
rexBuilder.makeCall(SqlStdOperatorTable.POWER, inputRef("a"), integerLiteral(2)),
DruidExpression.fromExpression("pow(\"a\",2)"),
100.0
);
}
@Test
public void testFloor()
{