You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by mohammadshahidkhan <gi...@git.apache.org> on 2016/09/11 21:12:10 UTC

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

GitHub user mohammadshahidkhan opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/148

    [CARBONDATA-233] bad record logger support for non parseable numeric and timestamp type data

    # **Why raise this pr?**
    Currently non parseable numeric data we were storing as null. 
    So the stored data was giving the right picture of the actual data.
    
    # **How to resolve?**
    Instead of changing the wrong data to null we have tell to the user which data is wrong in a log file.
    We will provide an option "bad_records_logger_enable" to be set to enable the bad-record logging while data load. default is false.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mohammadshahidkhan/incubator-carbondata bad_record_logger

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/148.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #148
    
----
commit dc6197f1a443cacd6276aaf7f4b38c30f25768be
Author: mohammadshahidkhan <mo...@gmail.com>
Date:   2016-09-11T21:05:17Z

    [CARBONDATA-233] bad record logger support for non parseable numeric and timestamp data

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/148


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

Posted by manishgupta88 <gi...@git.apache.org>.
Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/148#discussion_r78314030
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/CarbonCSVBasedSeqGenStep.java ---
    @@ -1133,6 +1149,9 @@ else if(isComplexTypeColumn[j]) {
                           .getDirectDictionaryGenerator(details.getColumnType());
                   surrogateKeyForHrrchy[0] =
                       directDictionaryGenerator1.generateDirectSurrogateKey(tuple);
    +              if (badRecordsLoggerEnable && surrogateKeyForHrrchy[0] == 1) {
    +                surrogateKeyForHrrchy[0] = -1;
    --- End diff --
    
    Replace -1 and 1 with proper identifiers from CarbonCommonConstants to give proper meaning and improve code readability


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/148#discussion_r82348806
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/CarbonCSVBasedSeqGenStep.java ---
    @@ -853,8 +873,10 @@ private String getCarbonLocalBaseStoreLocation() {
     
       private Object[] process(Object[] r) throws RuntimeException {
         try {
    +      Object[] actualRow = new Object[r.length];
    +      System.arraycopy(r, 0, actualRow, 0, r.length);
    --- End diff --
    
    Can't we avoid this object[] instance and arraycopy? 
    I guess we can merge `changeNullValueToNullString` and `populateOutputRow` and avoid arraycopy.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/148#discussion_r82341356
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordslogger.java ---
    @@ -89,41 +95,55 @@ public static String hasBadRecord(String key) {
         return badRecordEntry.remove(key);
       }
     
    -  public void addBadRecordsToBilder(Object[] row, int size, String reason, String valueComparer) {
    +  public void addBadRecordsToBuilder(Object[] row, int size, String reason, String valueComparer,
    +      boolean badRecordsLogRedirect, boolean badRecordLoggerEnable) {
         StringBuilder logStrings = new StringBuilder();
    +    size = row.length;
         int count = size;
         for (int i = 0; i < size; i++) {
           if (null == row[i]) {
    -        logStrings.append(row[i]);
    +        char ch = logStrings.length() > 0 ? logStrings.charAt(logStrings.length() - 1) : (char) -1;
    +        if (ch == ',') {
    +          logStrings = logStrings.deleteCharAt(logStrings.lastIndexOf(","));
    +        }
    +        break;
           } else if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(row[i].toString())) {
             logStrings.append(valueComparer);
           } else {
             logStrings.append(row[i]);
           }
           if (count > 1) {
    -        logStrings.append(" , ");
    +        logStrings.append(',');
           }
           count--;
         }
    -
    -    logStrings.append("----->");
    -    if (null != reason) {
    -      if (reason.indexOf(CarbonCommonConstants.MEMBER_DEFAULT_VAL) > -1) {
    -        logStrings.append(reason.replace(CarbonCommonConstants.MEMBER_DEFAULT_VAL, valueComparer));
    -      } else {
    -        logStrings.append(reason);
    -      }
    +    if (badRecordsLogRedirect) {
    +      writeBadRecordsToCSVFile(logStrings);
         }
    +    if( badRecordLoggerEnable ) {
    +      logStrings.append("----->");
    +      if (null != reason) {
    +        if (reason.indexOf(CarbonCommonConstants.MEMBER_DEFAULT_VAL) > -1) {
    +          logStrings
    +              .append(reason.replace(CarbonCommonConstants.MEMBER_DEFAULT_VAL, valueComparer));
    +        } else {
    +          logStrings.append(reason);
    +        }
    +      }
     
    -    writeBadRecordsToFile(logStrings);
    +      writeBadRecordsToFile(logStrings);
    +    } else {
    +      badRecordEntry.put(taskKey, "Partially");
    +    }
       }
     
       /**
        *
        */
       private synchronized void writeBadRecordsToFile(StringBuilder logStrings) {
    -    String filePath = this.storePath + File.separator + this.fileName
    -        + CarbonCommonConstants.FILE_INPROGRESS_STATUS;
    +    String filePath =
    --- End diff --
    
    This line should be moved down under `if` condition


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #148: [CARBONDATA-233] bad record logger s...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/148#discussion_r82339778
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordslogger.java ---
    @@ -89,41 +95,55 @@ public static String hasBadRecord(String key) {
         return badRecordEntry.remove(key);
       }
     
    -  public void addBadRecordsToBilder(Object[] row, int size, String reason, String valueComparer) {
    +  public void addBadRecordsToBuilder(Object[] row, int size, String reason, String valueComparer,
    +      boolean badRecordsLogRedirect, boolean badRecordLoggerEnable) {
         StringBuilder logStrings = new StringBuilder();
    +    size = row.length;
    --- End diff --
    
    better to validate whether we need to log the bad record in the starting of method, and then continue the log string creation logic


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---