Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7358

Text reader returns nothing for count queries over empty files

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.16.0
    • Fix Version/s: 1.17.0
    • Component/s: None
    • Labels:

      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:

      @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();
      }
      
      @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();
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Paul.Rogers Paul Rogers
                Reporter:
                arina Arina Ielchiieva
                Reviewer:
                Arina Ielchiieva
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: