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

Text reader returns nothing for count queries over empty files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.16.0
    • 1.17.0
    • None

    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

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

              Dates

                Created:
                Updated:
                Resolved: