[GitHub] carbondata pull request #2318: [CARBONDATA-2491] Fix the error when reader r...

classic Classic list List threaded Threaded
68 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2318: [CARBONDATA-2491] Fix the error when reader r...

qiuchenjian-2
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2318#discussion_r190151696
 
    --- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
    @@ -177,4 +239,134 @@ public void testWriteAndReadFilesNonTransactional() throws IOException, Interrup
         reader.close();
         FileUtils.deleteDirectory(new File(path));
       }
    +
    +  CarbonProperties carbonProperties;
    +
    +  @Override
    +  public void setUp() {
    +    carbonProperties = CarbonProperties.getInstance();
    +  }
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(CarbonReaderTest.class.getName());
    +
    +  @Test
    +  public void testTimeStampAndBadRecord() throws IOException, InterruptedException {
    +    String timestampFormat = carbonProperties.getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
    +    String badRecordAction = carbonProperties.getProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION,
    +        CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION_DEFAULT);
    +    String badRecordLoc = carbonProperties.getProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,
    +        CarbonCommonConstants.CARBON_BADRECORDS_LOC_DEFAULT_VAL);
    +    String rootPath = new File(this.getClass().getResource("/").getPath()
    +        + "../../").getCanonicalPath();
    +    String storeLocation = rootPath + "/target/";
    +    carbonProperties
    +        .addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC, storeLocation)
    +        .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy-MM-dd hh:mm:ss")
    +        .addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, "REDIRECT");
    +    String path = "./testWriteFiles";
    +    FileUtils.deleteDirectory(new File(path));
    +
    +    Field[] fields = new Field[9];
    +    fields[0] = new Field("stringField", DataTypes.STRING);
    +    fields[1] = new Field("intField", DataTypes.INT);
    +    fields[2] = new Field("shortField", DataTypes.SHORT);
    +    fields[3] = new Field("longField", DataTypes.LONG);
    +    fields[4] = new Field("doubleField", DataTypes.DOUBLE);
    +    fields[5] = new Field("boolField", DataTypes.BOOLEAN);
    +    fields[6] = new Field("dateField", DataTypes.DATE);
    +    fields[7] = new Field("timeField", DataTypes.TIMESTAMP);
    +    fields[8] = new Field("decimalField", DataTypes.createDecimalType(8, 2));
    +
    +    try {
    +      CarbonWriterBuilder builder = CarbonWriter.builder()
    +          .isTransactionalTable(true)
    +          .persistSchemaFile(true)
    +          .outputPath(path);
    +
    +      CarbonWriter writer = builder.buildWriterForCSVInput(new Schema(fields));
    +
    +      for (int i = 0; i < 100; i++) {
    +        String[] row = new String[]{
    +            "robot" + (i % 10),
    +            String.valueOf(i),
    +            String.valueOf(i),
    +            String.valueOf(Long.MAX_VALUE - i),
    +            String.valueOf((double) i / 2),
    +            String.valueOf(true),
    +            "2018-05-12",
    +            "2018-05-12",
    +            "12.345"
    +        };
    +        writer.write(row);
    +        String[] row2 = new String[]{
    +            "robot" + (i % 10),
    +            String.valueOf(i),
    +            String.valueOf(i),
    +            String.valueOf(Long.MAX_VALUE - i),
    +            String.valueOf((double) i / 2),
    +            String.valueOf(true),
    +            "2019-03-02",
    +            "2019-02-12 03:03:34",
    +            "12.345"
    +        };
    +        writer.write(row2);
    +      }
    +      writer.close();
    +    } catch (Exception e) {
    +      e.printStackTrace();
    +      Assert.fail(e.getMessage());
    +    }
    +    LOGGER.audit("Bad record location:" + storeLocation);
    +    File segmentFolder = new File(CarbonTablePath.getSegmentPath(path, "null"));
    +    Assert.assertTrue(segmentFolder.exists());
    +
    +    File[] dataFiles = segmentFolder.listFiles(new FileFilter() {
    +      @Override
    +      public boolean accept(File pathname) {
    +        return pathname.getName().endsWith(CarbonCommonConstants.FACT_FILE_EXT);
    +      }
    +    });
    +    Assert.assertNotNull(dataFiles);
    +    Assert.assertTrue(dataFiles.length > 0);
    +
    +    CarbonReader reader = CarbonReader.builder(path, "_temp")
    +        .projection(new String[]{
    +            "stringField"
    +            , "shortField"
    +            , "intField"
    +            , "longField"
    +            , "doubleField"
    +            , "boolField"
    +            , "dateField"
    +            , "timeField"
    +            , "decimalField"}).build();
    +
    +    int i = 0;
    +    while (reader.hasNext()) {
    --- End diff --
   
    ok, done


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user sounakr commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    @xubo245 Better to allow "*" as input in reader projection. This will help the user to specify all columns. Just like SQL select *.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4902/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6062/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5066/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xubo245 commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    @sounakr Ok, done


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user sounakr commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    LGTM


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6069/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4909/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xubo245 commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    @jackylk @ravipesala Hello, sounakr give LGTM and CI pass. Can you help to check and merge it if there are no problem, please.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2318: [CARBONDATA-2491] Fix the error when reader r...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2318#discussion_r190279377
 
    --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonInputFormat.java ---
    @@ -504,7 +505,24 @@ public QueryModel createQueryModel(InputSplit inputSplit, TaskAttemptContext tas
         String projectionString = getColumnProjection(configuration);
         String[] projectColumns;
         if (projectionString != null) {
    -      projectColumns = projectionString.split(",");
    +      if (projectionString.equalsIgnoreCase("*")) {
    --- End diff --
   
    instead of passing `*`, I think better to add another function to project all columns. You can add `projectAllColumns()`


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5071/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2318: [CARBONDATA-2491] Fix the error when reader r...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2318#discussion_r190444380
 
    --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonInputFormat.java ---
    @@ -504,7 +505,24 @@ public QueryModel createQueryModel(InputSplit inputSplit, TaskAttemptContext tas
         String projectionString = getColumnProjection(configuration);
         String[] projectColumns;
         if (projectionString != null) {
    -      projectColumns = projectionString.split(",");
    +      if (projectionString.equalsIgnoreCase("*")) {
    --- End diff --
   
    ok, I will raise new PR for it.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xubo245 commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    retest this please


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5082/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6084/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6081/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4921/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xubo245 commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    retest this please


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2318: [CARBONDATA-2491] Fix the error when reader read twi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2318
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4925/



---
1234