You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Arina Ielchiieva (Jira)" <ji...@apache.org> on 2019/08/22 16:40:00 UTC

[jira] [Updated] (DRILL-7358) Text reader returns nothing for count queries over empty files

     [ https://issues.apache.org/jira/browse/DRILL-7358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arina Ielchiieva updated DRILL-7358:
------------------------------------
    Description: 
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}


  was:
If we do count over empty CSV files (with or without headers), there is not 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}



> 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.2#803003)