diff options
author | Volodymyr Vysotskyi <vvovyk@gmail.com> | 2019-03-10 13:57:03 +0200 |
---|---|---|
committer | Sorabh Hamirwasia <sorabh@apache.org> | 2019-03-14 15:36:11 -0700 |
commit | 5aa38a51d90998234b4ca46434ce225df72addc5 (patch) | |
tree | 46c8777ef8cd139b7f285b8df7cbed7d4cb4cb85 /contrib/storage-hive | |
parent | e7f0bbf1f45b0d39d3796be81207aecd716d6aae (diff) |
DRILL-2326: Fix scalar replacement for the case when static method which does not return values is called
- Fix check for return function value to handle the case when created object is returned without assigning it to the local variable
closes #1687
Diffstat (limited to 'contrib/storage-hive')
-rw-r--r-- | contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java index 43c3e3f9a..86d11f24a 100644 --- a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java +++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java @@ -18,6 +18,7 @@ package org.apache.drill.exec.fn.hive; import java.time.LocalDateTime; +import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.tuple.Pair; @@ -25,10 +26,10 @@ import org.apache.drill.categories.HiveStorageTest; import org.apache.drill.categories.SlowTest; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.compile.ClassCompilerSelector; import org.apache.drill.exec.compile.ClassTransformer; import org.apache.drill.exec.hive.HiveTestBase; -import org.apache.drill.exec.server.options.OptionValue; -import org.apache.drill.test.QueryTestUtil; import org.apache.drill.test.TestBuilder; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -114,33 +115,31 @@ public class TestInbuiltHiveUDFs extends HiveTestBase { .go(); } - @Test //DRILL-4868 + @Test //DRILL-4868 & DRILL-2326 public void testEmbeddedHiveFunctionCall() throws Exception { - // TODO(DRILL-2326) temporary until we fix the scalar replacement bug for this case - final OptionValue srOption = QueryTestUtil.setupScalarReplacementOption(bits[0], ClassTransformer.ScalarReplacementOption.TRY); + String query = + "SELECT convert_from(unhex(key2), 'INT_BE') as intkey \n" + + "FROM cp.`functions/conv/conv.json`"; + + List<String> compilers = Arrays.asList(ClassCompilerSelector.CompilerPolicy.JANINO.name(), + ClassCompilerSelector.CompilerPolicy.JDK.name()); try { - final String[] queries = { - "SELECT convert_from(unhex(key2), 'INT_BE') as intkey \n" + - "FROM cp.`functions/conv/conv.json`", - }; + setSessionOption(ExecConstants.SCALAR_REPLACEMENT_OPTION, ClassTransformer.ScalarReplacementOption.ON.name()); + for (String compilerName : compilers) { + setSessionOption(ClassCompilerSelector.JAVA_COMPILER_OPTION, compilerName); - for (String query: queries) { testBuilder() .sqlQuery(query) - .ordered() + .unOrdered() .baselineColumns("intkey") - .baselineValues(1244739896) - .baselineValues(new Object[] { null }) - .baselineValues(1313814865) - .baselineValues(1852782897) + .baselineValuesForSingleColumn(1244739896, null, 1313814865, 1852782897) .build() .run(); } - } finally { - // restore the system option - QueryTestUtil.restoreScalarReplacementOption(bits[0], srOption.string_val); + resetSessionOption(ExecConstants.SCALAR_REPLACEMENT_OPTION); + resetSessionOption(ClassCompilerSelector.JAVA_COMPILER_OPTION); } } |