asfgit closed pull request #1485: DRILL-6759: Make columns array name for csv 
data case insensitive
URL: https://github.com/apache/drill/pull/1485
 
 
   

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/main/java/org/apache/drill/exec/store/easy/text/compliant/RepeatedVarCharOutput.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/RepeatedVarCharOutput.java
index 57e26f2c111..05f077377d3 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/RepeatedVarCharOutput.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/RepeatedVarCharOutput.java
@@ -133,7 +133,7 @@ public RepeatedVarCharOutput(OutputMutator outputMutator, 
Collection<SchemaPath>
         for (SchemaPath path : columns) {
           assert path.getRootSegment().isNamed() : "root segment should be 
named";
           pathStr = path.getRootSegment().getPath();
-          Preconditions.checkArgument(COL_NAME.equals(pathStr) || 
(SchemaPath.DYNAMIC_STAR.equals(pathStr) && path.getRootSegment().getChild() == 
null),
+          Preconditions.checkArgument(COL_NAME.equalsIgnoreCase(pathStr) || 
(SchemaPath.DYNAMIC_STAR.equals(pathStr) && path.getRootSegment().getChild() == 
null),
               String.format("Selected column '%s' must have name 'columns' or 
must be plain '*'", pathStr));
 
           if (path.getRootSegment().getChild() != null) {
diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java
 
b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java
index 8dd122b205a..2b96924d1b6 100644
--- 
a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java
@@ -22,7 +22,8 @@
 import org.apache.drill.test.BaseTestQuery;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.junit.Test;
-import static org.junit.Assert.assertTrue;
+
+import static org.junit.Assert.assertEquals;
 
 public class TestTextColumn extends BaseTestQuery {
   @Test
@@ -41,7 +42,7 @@ public void testDefaultDelimiterColumnSelection() throws 
Exception {
     expectedResultSet.addRow("g, h,\",\"i\",\"j,, \\n k");
 
     TestResultSet actualResultSet = new TestResultSet(actualResults);
-    assertTrue(expectedResultSet.equals(actualResultSet));
+    assertEquals(expectedResultSet, actualResultSet);
   }
 
   @Test
@@ -55,6 +56,22 @@ public void testCsvColumnSelectionCommasInsideQuotes() 
throws Exception {
     expectedResultSet.addRow("g, h,", "i", "j,, \\n k", "l\\\"m");
 
     TestResultSet actualResultSet = new TestResultSet(actualResults);
-    assertTrue(expectedResultSet.equals(actualResultSet));
+    assertEquals(expectedResultSet, actualResultSet);
+  }
+
+  @Test
+  public void testColumnsCaseInsensitive() throws Exception {
+    testBuilder()
+        .sqlQuery("select columns as c from cp.`store/text/data/letters.csv`")
+        .unOrdered()
+        .sqlBaselineQuery("select COLUMNS as c from 
cp.`store/text/data/letters.csv`")
+        .go();
+
+    testBuilder()
+        .sqlQuery("select columns[0], columns[1] from 
cp.`store/text/data/letters.csv`")
+        .unOrdered()
+        .sqlBaselineQuery("select COLUMNS[0], CoLuMnS[1] from 
cp.`store/text/data/letters.csv`")
+        .go();
   }
+
 }


 

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to