wuchong commented on a change in pull request #9099:
[FLINK-13237][table-planner-blink] Add expression table api test to blink
URL: https://github.com/apache/flink/pull/9099#discussion_r309594125
##########
File path:
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/expressions/ScalarFunctionsTest.scala
##########
@@ -1198,583 +1498,992 @@ class ScalarFunctionsTest extends
ScalarTypesTestBase {
@Test
def testDivide(): Unit = {
- testSqlApi(
+ testAllApis(
+ 1514356320000L / 60000.0, // the `/` is Scala operator, not Flink
TableApi operator
+ "1514356320000L / 60000",
"1514356320000 / 60000",
"2.5239272E7")
- // DIV return decimal
- testSqlApi(
- "DIV(1514356320000, 60000)",
- "25239272")
-
- testSqlApi(
+ testAllApis(
+ 'f7 / 2,
+ "f7 / 2",
"f7 / 2",
"1.5")
// f34 => Decimal(19,0)
// 6 => Integer => Decimal(10,0)
// Decimal(19,0) / Decimal(10,0) => Decimal(30,11)
- testSqlApi(
+ testAllApis(
+ 'f34 / 6,
+ "f34 / 6",
"f34 / 6",
"252392720000.00000000000")
// Decimal(19,0) / Decimal(19,0) => Decimal(39,20) => Decimal(38,19)
- testSqlApi(
+ testAllApis(
+ 'f34 / 'f34,
+ "f34 / f34",
"f34 / f34",
"1.0000000000000000000")
}
@Test
def testMod(): Unit = {
- testSqlApi(
+ testAllApis(
+ 1514356320000L % 60000,
+ "1514356320000L % 60000",
"mod(1514356320000,60000)",
"0")
- testSqlApi(
+ testAllApis(
+ 'f34.mod('f34),
+ "f34.mod(f34)",
"mod(f34,f34)",
"0")
- testSqlApi(
+ testAllApis(
+ 'f34.mod(6),
+ "f34.mod(6)",
"mod(f34,6)",
"0")
- testSqlApi(
+ testAllApis(
+ 'f4.mod('f7),
+ "f4.mod(f7)",
"MOD(f4, f7)",
"2")
- testSqlApi(
+ testAllApis(
+ 'f4.mod(3),
+ "mod(f4, 3)",
"MOD(f4, 3)",
"2")
- testSqlApi(
+ testAllApis(
+ 'f4 % 3,
+ "mod(44, 3)",
"MOD(44, 3)",
"2")
}
@Test
def testExp(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.exp(),
+ "f2.exp()",
"EXP(f2)",
math.exp(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.exp(),
+ "f3.exp()",
"EXP(f3)",
math.exp(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.exp(),
+ "f4.exp()",
"EXP(f4)",
math.exp(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.exp(),
+ "f5.exp()",
"EXP(f5)",
math.exp(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.exp(),
+ "f6.exp()",
"EXP(f6)",
math.exp(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f7.exp(),
+ "exp(f7)",
"EXP(f7)",
math.exp(3).toString)
- testSqlApi(
+ testAllApis(
+ 3.exp(),
+ "exp(3)",
"EXP(3)",
math.exp(3).toString)
}
@Test
def testLog10(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.log10(),
+ "f2.log10()",
"LOG10(f2)",
math.log10(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.log10(),
+ "f3.log10()",
"LOG10(f3)",
math.log10(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.log10(),
+ "f4.log10()",
"LOG10(f4)",
math.log10(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.log10(),
+ "f5.log10()",
"LOG10(f5)",
math.log10(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.log10(),
+ "f6.log10()",
"LOG10(f6)",
math.log10(4.6).toString)
}
@Test
def testPower(): Unit = {
// f7: int , f4: long, f6: double
- testSqlApi(
+ testAllApis(
+ 'f2.power('f7),
+ "f2.power(f7)",
"POWER(f2, f7)",
math.pow(42.toByte, 3).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.power('f6),
+ "f3.power(f6)",
"POWER(f3, f6)",
math.pow(43.toShort, 4.6D).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.power('f5),
+ "f4.power(f5)",
"POWER(f4, f5)",
math.pow(44.toLong, 4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.power('f5),
+ "f4.power(f5)",
"POWER(f4, f5)",
math.pow(44.toLong, 4.5.toFloat).toString)
// f5: float
- testSqlApi(
+ testAllApis('f5.power('f5),
+ "f5.power(f5)",
"power(f5, f5)",
math.pow(4.5F, 4.5F).toString)
- testSqlApi(
+ testAllApis('f5.power('f6),
+ "f5.power(f6)",
"power(f5, f6)",
math.pow(4.5F, 4.6D).toString)
- testSqlApi(
+ testAllApis('f5.power('f7),
+ "f5.power(f7)",
"power(f5, f7)",
math.pow(4.5F, 3).toString)
- testSqlApi(
+ testAllApis('f5.power('f4),
+ "f5.power(f4)",
"power(f5, f4)",
math.pow(4.5F, 44L).toString)
// f22: bigDecimal
// TODO delete casting in SQL when CALCITE-1467 is fixed
- testSqlApi(
+ testAllApis(
+ 'f22.cast(DataTypes.DOUBLE).power('f5),
+ "f22.cast(DOUBLE).power(f5)",
"power(CAST(f22 AS DOUBLE), f5)",
math.pow(2, 4.5F).toString)
- testSqlApi(
+ testAllApis(
+ 'f22.cast(DataTypes.DOUBLE).power('f6),
+ "f22.cast(DOUBLE).power(f6)",
"power(CAST(f22 AS DOUBLE), f6)",
math.pow(2, 4.6D).toString)
- testSqlApi(
+ testAllApis(
+ 'f22.cast(DataTypes.DOUBLE).power('f7),
+ "f22.cast(DOUBLE).power(f7)",
"power(CAST(f22 AS DOUBLE), f7)",
math.pow(2, 3).toString)
- testSqlApi(
+ testAllApis(
+ 'f22.cast(DataTypes.DOUBLE).power('f4),
+ "f22.cast(DOUBLE).power(f4)",
"power(CAST(f22 AS DOUBLE), f4)",
math.pow(2, 44L).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.power('f22.cast(DataTypes.DOUBLE)),
+ "f6.power(f22.cast(DOUBLE))",
"power(f6, f22)",
math.pow(4.6D, 2).toString)
}
@Test
def testSqrt(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f6.sqrt(),
+ "f6.sqrt",
"SQRT(f6)",
math.sqrt(4.6D).toString)
- testSqlApi(
+ testAllApis(
+ 'f7.sqrt(),
+ "f7.sqrt",
"SQRT(f7)",
math.sqrt(3).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.sqrt(),
+ "f4.sqrt",
"SQRT(f4)",
math.sqrt(44L).toString)
- testSqlApi(
+ testAllApis(
+ 'f22.cast(DataTypes.DOUBLE).sqrt(),
+ "f22.cast(DOUBLE).sqrt",
"SQRT(CAST(f22 AS DOUBLE))",
math.sqrt(2.0).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.sqrt(),
+ "f5.sqrt",
"SQRT(f5)",
math.pow(4.5F, 0.5).toString)
- testSqlApi(
+ testAllApis(
+ 25.sqrt(),
+ "25.sqrt()",
"SQRT(25)",
"5.0")
- testSqlApi(
- // TODO fix FLINK-4621
- "POWER(CAST(2.2 AS DOUBLE), CAST(0.5 AS DOUBLE))",
+ testAllApis(
+ 2.2.sqrt(),
+ "2.2.sqrt()",
+ "POWER(CAST(2.2 AS DOUBLE), CAST(0.5 AS DOUBLE))", // TODO fix FLINK-4621
math.sqrt(2.2).toString)
}
+ @Test
+ def testCosh(): Unit = {
+ testAllApis(
+ 0.cosh(),
+ "0.cosh()",
+ "COSH(0)",
+ math.cosh(0).toString
+ )
+
+ testAllApis(
+ -1.cosh(),
+ "-1.cosh()",
+ "COSH(-1)",
+ math.cosh(-1).toString
+ )
+
+ testAllApis(
+ 'f4.cosh(),
+ "f4.cosh",
+ "COSH(f4)",
+ math.cosh(44L).toString)
+
+ testAllApis(
+ 'f6.cosh(),
+ "f6.cosh",
+ "COSH(f6)",
+ math.cosh(4.6D).toString)
+
+ testAllApis(
+ 'f7.cosh(),
+ "f7.cosh",
+ "COSH(f7)",
+ math.cosh(3).toString)
+
+ testAllApis(
+ 'f22.cosh(),
+ "f22.cosh",
+ "COSH(f22)",
+ math.cosh(2.0).toString)
+ }
+
@Test
def testLn(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.ln(),
+ "f2.ln()",
"LN(f2)",
math.log(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.ln(),
+ "f3.ln()",
"LN(f3)",
math.log(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.ln(),
+ "f4.ln()",
"LN(f4)",
math.log(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.ln(),
+ "f5.ln()",
"LN(f5)",
math.log(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.ln(),
+ "f6.ln()",
"LN(f6)",
math.log(4.6).toString)
}
@Test
def testAbs(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.abs(),
+ "f2.abs()",
"ABS(f2)",
"42")
- testSqlApi(
+ testAllApis(
+ 'f3.abs(),
+ "f3.abs()",
"ABS(f3)",
"43")
- testSqlApi(
+ testAllApis(
+ 'f4.abs(),
+ "f4.abs()",
"ABS(f4)",
"44")
- testSqlApi(
+ testAllApis(
+ 'f5.abs(),
+ "f5.abs()",
"ABS(f5)",
"4.5")
- testSqlApi(
+ testAllApis(
+ 'f6.abs(),
+ "f6.abs()",
"ABS(f6)",
"4.6")
- testSqlApi(
+ testAllApis(
+ 'f9.abs(),
+ "f9.abs()",
"ABS(f9)",
"42")
- testSqlApi(
+ testAllApis(
+ 'f10.abs(),
+ "f10.abs()",
"ABS(f10)",
"43")
- testSqlApi(
+ testAllApis(
+ 'f11.abs(),
+ "f11.abs()",
"ABS(f11)",
"44")
- testSqlApi(
+ testAllApis(
+ 'f12.abs(),
+ "f12.abs()",
"ABS(f12)",
"4.5")
- testSqlApi(
+ testAllApis(
+ 'f13.abs(),
+ "f13.abs()",
"ABS(f13)",
"4.6")
- testSqlApi(
+ testAllApis(
+ 'f15.abs(),
+ "f15.abs()",
"ABS(f15)",
"1231.1231231321321321111")
}
@Test
def testArithmeticFloorCeil(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f5.floor(),
+ "f5.floor()",
"FLOOR(f5)",
"4.0")
- testSqlApi(
+ testAllApis(
+ 'f5.ceil(),
+ "f5.ceil()",
"CEIL(f5)",
"5.0")
- testSqlApi(
+ testAllApis(
+ 'f3.floor(),
+ "f3.floor()",
"FLOOR(f3)",
"43")
- testSqlApi(
+ testAllApis(
+ 'f3.ceil(),
+ "f3.ceil()",
"CEIL(f3)",
"43")
- testSqlApi(
+ testAllApis(
+ 'f15.floor(),
+ "f15.floor()",
"FLOOR(f15)",
"-1232")
- testSqlApi(
+ testAllApis(
+ 'f15.ceil(),
+ "f15.ceil()",
"CEIL(f15)",
"-1231")
}
@Test
def testSin(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.sin(),
+ "f2.sin()",
"SIN(f2)",
math.sin(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.sin(),
+ "f3.sin()",
"SIN(f3)",
math.sin(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.sin(),
+ "f4.sin()",
"SIN(f4)",
math.sin(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.sin(),
+ "f5.sin()",
"SIN(f5)",
math.sin(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.sin(),
+ "f6.sin()",
"SIN(f6)",
math.sin(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.sin(),
+ "sin(f15)",
"SIN(f15)",
math.sin(-1231.1231231321321321111).toString)
}
@Test
def testCos(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.cos(),
+ "f2.cos()",
"COS(f2)",
math.cos(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.cos(),
+ "f3.cos()",
"COS(f3)",
math.cos(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.cos(),
+ "f4.cos()",
"COS(f4)",
math.cos(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.cos(),
+ "f5.cos()",
"COS(f5)",
math.cos(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.cos(),
+ "f6.cos()",
"COS(f6)",
math.cos(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.cos(),
+ "cos(f15)",
"COS(f15)",
math.cos(-1231.1231231321321321111).toString)
}
+ @Test
+ def testSinh(): Unit = {
+ testAllApis(
+ 0.sinh(),
+ "0.sinh()",
+ "SINH(0)",
+ math.sinh(0).toString)
+
+ testAllApis(
+ -1.sinh(),
+ "-1.sinh()",
+ "SINH(-1)",
+ math.sinh(-1).toString)
+
+ testAllApis(
+ 'f4.sinh(),
+ "f4.sinh",
+ "SINH(f4)",
+ math.sinh(44L).toString)
+
+ testAllApis(
+ 'f6.sinh(),
+ "f6.sinh",
+ "SINH(f6)",
+ math.sinh(4.6D).toString)
+
+ testAllApis(
+ 'f7.sinh(),
+ "f7.sinh",
+ "SINH(f7)",
+ math.sinh(3).toString)
+
+ testAllApis(
+ 'f22.sinh(),
+ "f22.sinh",
+ "SINH(f22)",
+ math.sinh(2.0).toString)
+ }
+
@Test
def testTan(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.tan(),
+ "f2.tan()",
"TAN(f2)",
math.tan(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.tan(),
+ "f3.tan()",
"TAN(f3)",
math.tan(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.tan(),
+ "f4.tan()",
"TAN(f4)",
math.tan(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.tan(),
+ "f5.tan()",
"TAN(f5)",
math.tan(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.tan(),
+ "f6.tan()",
"TAN(f6)",
math.tan(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.tan(),
+ "tan(f15)",
"TAN(f15)",
math.tan(-1231.1231231321321321111).toString)
}
+ @Test
+ def testTanh(): Unit = {
+ testAllApis(
+ 0.tanh(),
+ "0.tanh()",
+ "TANH(0)",
+ math.tanh(0).toString)
+
+ testAllApis(
+ -1.tanh(),
+ "-1.tanh()",
+ "TANH(-1)",
+ math.tanh(-1).toString)
+
+ testAllApis(
+ 'f4.tanh(),
+ "f4.tanh",
+ "TANH(f4)",
+ math.tanh(44L).toString)
+
+ testAllApis(
+ 'f6.tanh(),
+ "f6.tanh",
+ "TANH(f6)",
+ math.tanh(4.6D).toString)
+
+ testAllApis(
+ 'f7.tanh(),
+ "f7.tanh",
+ "TANH(f7)",
+ math.tanh(3).toString)
+
+ testAllApis(
+ 'f22.tanh(),
+ "f22.tanh",
+ "TANH(f22)",
+ math.tanh(2.0).toString)
+ }
+
@Test
def testCot(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.cot(),
+ "f2.cot()",
"COT(f2)",
(1.0d / math.tan(42.toByte)).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.cot(),
+ "f3.cot()",
"COT(f3)",
(1.0d / math.tan(43.toShort)).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.cot(),
+ "f4.cot()",
"COT(f4)",
(1.0d / math.tan(44.toLong)).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.cot(),
+ "f5.cot()",
"COT(f5)",
(1.0d / math.tan(4.5.toFloat)).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.cot(),
+ "f6.cot()",
"COT(f6)",
(1.0d / math.tan(4.6)).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.cot(),
+ "cot(f15)",
"COT(f15)",
(1.0d / math.tan(-1231.1231231321321321111)).toString)
}
@Test
def testAsin(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f25.asin(),
+ "f25.asin()",
"ASIN(f25)",
math.asin(0.42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f26.asin(),
+ "f26.asin()",
"ASIN(f26)",
math.asin(0.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f27.asin(),
+ "f27.asin()",
"ASIN(f27)",
math.asin(0.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f28.asin(),
+ "f28.asin()",
"ASIN(f28)",
math.asin(0.45.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f29.asin(),
+ "f29.asin()",
"ASIN(f29)",
math.asin(0.46).toString)
- testSqlApi(
+ testAllApis(
+ 'f30.asin(),
+ "f30.asin()",
"ASIN(f30)",
math.asin(1).toString)
- testSqlApi(
+ testAllApis(
+ 'f31.asin(),
+ "f31.asin()",
"ASIN(f31)",
math.asin(-0.1231231321321321111).toString)
}
@Test
def testAcos(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f25.acos(),
+ "f25.acos()",
"ACOS(f25)",
math.acos(0.42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f26.acos(),
+ "f26.acos()",
"ACOS(f26)",
math.acos(0.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f27.acos(),
+ "f27.acos()",
"ACOS(f27)",
math.acos(0.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f28.acos(),
+ "f28.acos()",
"ACOS(f28)",
math.acos(0.45.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f29.acos(),
+ "f29.acos()",
"ACOS(f29)",
math.acos(0.46).toString)
- testSqlApi(
+ testAllApis(
+ 'f30.acos(),
+ "f30.acos()",
"ACOS(f30)",
math.acos(1).toString)
- testSqlApi(
+ testAllApis(
+ 'f31.acos(),
+ "f31.acos()",
"ACOS(f31)",
math.acos(-0.1231231321321321111).toString)
}
@Test
def testAtan(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f25.atan(),
+ "f25.atan()",
"ATAN(f25)",
math.atan(0.42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f26.atan(),
+ "f26.atan()",
"ATAN(f26)",
math.atan(0.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f27.atan(),
+ "f27.atan()",
"ATAN(f27)",
math.atan(0.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f28.atan(),
+ "f28.atan()",
"ATAN(f28)",
math.atan(0.45.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f29.atan(),
+ "f29.atan()",
"ATAN(f29)",
math.atan(0.46).toString)
- testSqlApi(
+ testAllApis(
+ 'f30.atan(),
+ "f30.atan()",
"ATAN(f30)",
math.atan(1).toString)
- testSqlApi(
+ testAllApis(
+ 'f31.atan(),
+ "f31.atan()",
"ATAN(f31)",
math.atan(-0.1231231321321321111).toString)
}
+ @Test
+ def testAtan2(): Unit = {
+ testAllApis(
+ atan2('f25, 'f26),
+ "atan2(f25, f26)",
+ "ATAN2(f25, f26)",
+ math.atan2(0.42.toByte, 0.toByte).toString)
+
+ testAllApis(
+ atan2('f26, 'f25),
+ "atan2(f26, f25)",
+ "ATAN2(f26, f25)",
+ math.atan2(0.toShort, 0.toShort).toString)
+
+ testAllApis(
+ atan2('f27, 'f27),
+ "atan2(f27, f27)",
+ "ATAN2(f27, f27)",
+ math.atan2(0.toLong, 0.toLong).toString)
+
+ testAllApis(
+ atan2('f28, 'f28),
+ "atan2(f28, f28)",
+ "ATAN2(f28, f28)",
+ math.atan2(0.45.toFloat, 0.45.toFloat).toString)
+
+ testAllApis(
+ atan2('f29, 'f29),
+ "atan2(f29, f29)",
+ "ATAN2(f29, f29)",
+ math.atan2(0.46, 0.46).toString)
+
+ testAllApis(
+ atan2('f30, 'f30),
+ "atan2(f30, f30)",
+ "ATAN2(f30, f30)",
+ math.atan2(1, 1).toString)
+
+ testAllApis(
+ atan2('f31, 'f31),
+ "atan2(f31, f31)",
+ "ATAN2(f31, f31)",
+ math.atan2(-0.1231231321321321111, -0.1231231321321321111).toString)
+ }
+
@Test
def testDegrees(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.degrees(),
+ "f2.degrees()",
"DEGREES(f2)",
math.toDegrees(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.degrees(),
+ "f3.degrees()",
"DEGREES(f3)",
math.toDegrees(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.degrees(),
+ "f4.degrees()",
"DEGREES(f4)",
math.toDegrees(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.degrees(),
+ "f5.degrees()",
"DEGREES(f5)",
math.toDegrees(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.degrees(),
+ "f6.degrees()",
"DEGREES(f6)",
math.toDegrees(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.degrees(),
+ "degrees(f15)",
"DEGREES(f15)",
math.toDegrees(-1231.1231231321321321111).toString)
}
@Test
def testRadians(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f2.radians(),
+ "f2.radians()",
"RADIANS(f2)",
math.toRadians(42.toByte).toString)
- testSqlApi(
+ testAllApis(
+ 'f3.radians(),
+ "f3.radians()",
"RADIANS(f3)",
math.toRadians(43.toShort).toString)
- testSqlApi(
+ testAllApis(
+ 'f4.radians(),
+ "f4.radians()",
"RADIANS(f4)",
math.toRadians(44.toLong).toString)
- testSqlApi(
+ testAllApis(
+ 'f5.radians(),
+ "f5.radians()",
"RADIANS(f5)",
math.toRadians(4.5.toFloat).toString)
- testSqlApi(
+ testAllApis(
+ 'f6.radians(),
+ "f6.radians()",
"RADIANS(f6)",
math.toRadians(4.6).toString)
- testSqlApi(
+ testAllApis(
+ 'f15.radians(),
+ "radians(f15)",
"RADIANS(f15)",
math.toRadians(-1231.1231231321321321111).toString)
}
@Test
def testSign(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f4.sign(),
+ "f4.sign()",
"SIGN(f4)",
1.toString)
- testSqlApi(
+ testAllApis(
+ 'f6.sign(),
+ "f6.sign()",
"SIGN(f6)",
1.0.toString)
- testSqlApi(
+ testAllApis(
+ 'f15.sign(),
+ "sign(f15)",
"SIGN(f15)",
"-1.0000000000000000000") // calcite: SIGN(Decimal(p,s)) => Decimal(p,s)
}
@Test
def testRound(): Unit = {
- testSqlApi(
+ testAllApis(
+ 'f29.round('f30),
+ "f29.round(f30)",
"ROUND(f29, f30)",
0.5.toString)
- testSqlApi(
- "ROUND(f31, f7)",
- "-0.123")
+ // Now not support round decimal with non-literal
Review comment:
Is it a bug in blink or we don't support it yet? Do we need to fix this
before 1.9?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services