Github user vvysotskyi commented on a diff in the pull request: https://github.com/apache/drill/pull/1230#discussion_r184110535 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java --- @@ -132,4 +148,200 @@ public void testIsNumeric() throws Throwable{ final Object [] expected = new Object[] {1, 1, 1, 0}; runTest(expected, "functions/testIsNumericFunction.json"); } + + @Test + public void testLog10WithDouble() throws Throwable { + String json = "{" + + "\"positive_infinity\" : Infinity," + + "\"negative_infinity\" : -Infinity," + + "\"nan\" : NaN," + + "\"num1\": 0.0," + + "\"num2\": 0.1," + + "\"num3\": 1.0," + + "\"num4\": 1.5," + + "\"num5\": -1.5," + + "\"num6\": 10.0" + + "}"; + String query = "select " + + "log10(positive_infinity) as pos_inf, " + + "log10(negative_infinity) as neg_inf, " + + "log10(nan) as nan, " + + "log10(num1) as num1, " + + "log10(num2) as num2, " + + "log10(num3) as num3, " + + "log10(num4) as num4, " + + "log10(num5) as num5, " + + "log10(num6) as num6 " + + "" + + "from dfs.`data.json`"; + File file = new File(dirTestWatcher.getRootDir(), "data.json"); + try { + FileUtils.writeStringToFile(file, json); + test("alter session set `%s` = true", ExecConstants.JSON_READ_NUMBERS_AS_DOUBLE); + test("alter session set `%s` = true", ExecConstants.JSON_READER_NAN_INF_NUMBERS); + testBuilder() + .sqlQuery(query) + .ordered() + .baselineColumns("pos_inf", "neg_inf", "nan", "num1", "num2", "num3", "num4", "num5", "num6") + .baselineValues(Double.POSITIVE_INFINITY, Double.NaN, Double.NaN, Double.NEGATIVE_INFINITY, + -1.0d, 0d, 0.17609125905568124d, Double.NaN, 1.0d) + .build() + .run(); + } finally { + test("alter session set `%s` = false", ExecConstants.JSON_READ_NUMBERS_AS_DOUBLE); --- End diff -- For the case when default value of the option is changed, disabling it after the tests may cause problems for other tests. Correct behaviour is to reset the value of the option. May be used method `resetSessionOption`
---