[ https://issues.apache.org/jira/browse/DRILL-6759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641785#comment-16641785 ]
ASF GitHub Bot commented on DRILL-6759: --------------------------------------- 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: us...@infra.apache.org > CSV 'columns' array is incorrectly case sensitive > ------------------------------------------------- > > Key: DRILL-6759 > URL: https://issues.apache.org/jira/browse/DRILL-6759 > Project: Apache Drill > Issue Type: Bug > Affects Versions: 1.14.0 > Reporter: Paul Rogers > Assignee: Arina Ielchiieva > Priority: Minor > Labels: ready-to-commit > Fix For: 1.15.0 > > > Perform the following query on a CSV file without column headers: > {noformat} > SELECT columns[0] FROM `yourFile.csv` > {noformat} > In Drill, column names are supposed to be case insensitive. So, let's try > upper case: > {noformat} > SELECT COLUMNS[0] FROM `yourFile.csv`; > Error: DATA_READ ERROR: Selected column 'COLUMNS' must have name 'columns' or > must be plain '*' > {noformat} > Expected {{`columns`}} to be case insensitive like other CSV columns and SQL > keywords. -- This message was sent by Atlassian JIRA (v7.6.3#76005)