[ 
https://issues.apache.org/jira/browse/DRILL-6426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16481028#comment-16481028
 ] 

ASF GitHub Bot commented on DRILL-6426:
---------------------------------------

asfgit closed pull request #1273: DRILL-6426: Refactor 
TestFunctionsWithTypeExpoQueries test to be independent on limit 0 optimization 
option
URL: https://github.com/apache/drill/pull/1273
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
 
b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
index 88558ae000..d298acc98f 100644
--- 
a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
@@ -22,7 +22,10 @@
 import org.apache.drill.categories.SqlFunctionTest;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.types.Types;
+import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.test.BaseTestQuery;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -32,9 +35,16 @@
 
 @Category(SqlFunctionTest.class)
 public class TestFunctionsWithTypeExpoQueries extends BaseTestQuery {
+
   @BeforeClass
-  public static void setupFiles() {
+  public static void setup() {
     dirTestWatcher.copyResourceToRoot(Paths.get("typeExposure"));
+    alterSession(ExecConstants.EARLY_LIMIT0_OPT_KEY, true);
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    resetSessionOption(ExecConstants.EARLY_LIMIT0_OPT_KEY);
   }
 
   @Test
@@ -44,9 +54,10 @@ public void testConcatWithMoreThanTwoArgs() throws Exception 
{
 
     List<Pair<SchemaPath, TypeProtos.MajorType>> expectedSchema = 
Lists.newArrayList();
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
-            .setMinorType(TypeProtos.MinorType.VARCHAR)
-            .setMode(TypeProtos.DataMode.REQUIRED)
-            .build();
+        .setMinorType(TypeProtos.MinorType.VARCHAR)
+        .setMode(TypeProtos.DataMode.REQUIRED)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
+        .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
     testBuilder()
@@ -95,6 +106,7 @@ public void testLRBTrimOneArg() throws Exception {
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
         .setMinorType(TypeProtos.MinorType.VARCHAR)
         .setMode(TypeProtos.DataMode.REQUIRED)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
         .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
@@ -125,9 +137,10 @@ public void testTrim() throws Exception {
 
     List<Pair<SchemaPath, TypeProtos.MajorType>> expectedSchema = 
Lists.newArrayList();
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
-            .setMinorType(TypeProtos.MinorType.VARCHAR)
-            .setMode(TypeProtos.DataMode.REQUIRED)
-            .build();
+        .setMinorType(TypeProtos.MinorType.VARCHAR)
+        .setMode(TypeProtos.DataMode.REQUIRED)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
+        .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
     testBuilder()
@@ -159,6 +172,7 @@ public void testTrimOneArg() throws Exception {
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
         .setMinorType(TypeProtos.MinorType.VARCHAR)
         .setMode(TypeProtos.DataMode.REQUIRED)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
         .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
@@ -191,6 +205,7 @@ public void testTrimTwoArg() throws Exception {
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
         .setMinorType(TypeProtos.MinorType.VARCHAR)
         .setMode(TypeProtos.DataMode.REQUIRED)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
         .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
@@ -214,12 +229,12 @@ public void testTrimTwoArg() throws Exception {
   }
 
   @Test
-  public void tesIsNull() throws Exception {
+  public void testIsNull() throws Exception {
     final String query = "select r_name is null as col from 
cp.`tpch/region.parquet` limit 0";
     List<Pair<SchemaPath, TypeProtos.MajorType>> expectedSchema = 
Lists.newArrayList();
     TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
         .setMinorType(TypeProtos.MinorType.BIT)
-        .setMode(TypeProtos.DataMode.REQUIRED)
+        .setMode(TypeProtos.DataMode.OPTIONAL)
         .build();
     expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));
 
@@ -501,6 +516,7 @@ public void testUDFInGroupBy() throws Exception {
     final TypeProtos.MajorType majorType2 = TypeProtos.MajorType.newBuilder()
         .setMinorType(TypeProtos.MinorType.VARCHAR)
         .setMode(TypeProtos.DataMode.OPTIONAL)
+        .setPrecision(Types.MAX_VARCHAR_LENGTH)
         .build();
 
     final TypeProtos.MajorType majorType3 = TypeProtos.MajorType.newBuilder()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Refactor TestFunctionsWithTypeExpoQueries test to be independent on limit 0 
> optimization option
> -----------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6426
>                 URL: https://issues.apache.org/jira/browse/DRILL-6426
>             Project: Apache Drill
>          Issue Type: Task
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>            Priority: Major
>              Labels: ready-to-commit
>             Fix For: 1.14.0
>
>
> TestFunctionsWithTypeExpoQueries depends on limit 0 optimization option. 
> Currently by default it is off and tests pass. If option by default is on, 
> tests fail. Need to refactor tests to ensure they pass disregarding on 
> default option value.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to