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

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

paul-rogers commented on pull request #1867: DRILL-7358: Fix COUNT(*) for empty 
text files
URL: https://github.com/apache/drill/pull/1867
 
 
   Fixes a subtle error when a text file has a header (and so has a
   schema), but is in a COUNT(*) query, so that no columns are
   projected. Ensures that, in this case, an empty schema is
   treated as a valid result set.
   
   Tests: updated CSV tests to include this case.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Text reader returns nothing for count queries over empty files
> --------------------------------------------------------------
>
>                 Key: DRILL-7358
>                 URL: https://issues.apache.org/jira/browse/DRILL-7358
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.16.0
>            Reporter: Arina Ielchiieva
>            Assignee: Paul Rogers
>            Priority: Major
>             Fix For: 1.17.0
>
>
> If we do count over empty CSV files (with or without headers), there is no 
> result.
> Though expecting result is 0.
> Unit tests examples:
> {code}
> @Test
> public void testCount() throws Exception {
>   String fileName = "headersOnly.csv";
>   try (PrintWriter out = new PrintWriter(new FileWriter(new File(testDir, 
> fileName)))) {
>     out.print("a,b,c"); // note: no \n in the end
>   }
>   queryBuilder().sql("SELECT count(1) FROM `dfs.data`.`" + fileName + 
> "`").print();
> }
> {code}
> {code}
> @Test
> public void testCount() throws Exception {
>   String fileName = "empty.csv";
>   File file = new File(testDir, fileName);
>   assertTrue(file.createNewFile());
>   queryBuilder().sql("SELECT count(1) FROM `dfs.data`.`" + fileName + 
> "`").print();
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to