Uploaded image for project: 'CarbonData'
  1. CarbonData
  2. CARBONDATA-3342

It throws IllegalArgumentException when using filter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • None
    • None

    Description

        public void testReadWithFilterOfNonTransactional2() throws IOException, InterruptedException {
          String path = "./testWriteFiles";
          FileUtils.deleteDirectory(new File(path));
          DataMapStoreManager.getInstance()
              .clearDataMaps(AbsoluteTableIdentifier.from(path));
          Field[] fields = new Field[2];
          fields[0] = new Field("name", DataTypes.STRING);
          fields[1] = new Field("age", DataTypes.INT);
      
          TestUtil.writeFilesAndVerify(200, new Schema(fields), path);
      
          ColumnExpression columnExpression = new ColumnExpression("age", DataTypes.INT);
      
          EqualToExpression equalToExpression = new EqualToExpression(columnExpression,
              new LiteralExpression("-11", DataTypes.INT));
          CarbonReader reader = CarbonReader
              .builder(path, "_temp")
              .projection(new String[]{"name", "age"})
              .filter(equalToExpression)
              .build();
      
          int i = 0;
          while (reader.hasNext()) {
            Object[] row = (Object[]) reader.readNextRow();
            // Default sort column is applied for dimensions. So, need  to validate accordingly
            assert (((String) row[0]).contains("robot"));
            assert (1 == (int) (row[1]));
            i++;
          }
          Assert.assertEquals(i, 1);
      
          reader.close();
      
          FileUtils.deleteDirectory(new File(path));
        }
      
      

      Exception:

      2019-04-04 18:15:23 INFO  CarbonLRUCache:163 - Removed entry from InMemory lru cache :: /Users/xubo/Desktop/xubo/git/carbondata2/store/sdk/testWriteFiles/63862773138004_batchno0-0-null-63862150454623.carbonindex
      
      java.lang.IllegalArgumentException: no reader
      
      	at org.apache.carbondata.sdk.file.CarbonReader.<init>(CarbonReader.java:60)
      	at org.apache.carbondata.sdk.file.CarbonReaderBuilder.build(CarbonReaderBuilder.java:222)
      	at org.apache.carbondata.sdk.file.CarbonReaderTest.testReadWithFilterOfNonTransactional2(CarbonReaderTest.java:221)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at junit.framework.TestCase.runTest(TestCase.java:176)
      	at junit.framework.TestCase.runBare(TestCase.java:141)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at junit.framework.TestSuite.runTest(TestSuite.java:255)
      	at junit.framework.TestSuite.run(TestSuite.java:250)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      
      
      

      Attachments

        Activity

          People

            xubo245 Bo Xu
            xubo245 Bo Xu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h 50m
                4h 50m