[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

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

[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

qiuchenjian-2
GitHub user mohammadshahidkhan opened a pull request:

    https://github.com/apache/carbondata/pull/1718

    [CARBONDATA-1929][Validation]carbon property configuration validation

    Added validation for below parameter:
    carbon.timestamp.format
    carbon.date.format
    carbon.sort.file.write.buffer.size (minValue = 10 KB,  maxValue=10MB, defaultValue =16 KB )
    carbon.sort.intermediate.files.limit (minValue = 2,  maxValue=50, defaultValue =20 )
   
    Be sure to do all of the following checklist to help us incorporate
    your contribution quickly and easily:
   
     - [X] Any interfaces changed?
     NA
     - [X] Any backward compatibility impacted?
     NA
     - [X] Document update required?
    NA
     - [X] Testing done
            Please provide details on
            - Whether new unit test cases have been added or why no new tests are required?
            - How it is tested? Please attach test report.
            - Is it a performance related change? Please attach the performance test report.
            - Any additional information to help reviewers in testing this change.
           Added test case for property validation.
     - [X] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
    NA


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

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

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

    https://github.com/apache/carbondata/pull/1718.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 #1718
   
----
commit 7b484a8b3d9e8190fafaecbf04b771c7a758e293
Author: mohammadshahidkhan <mohdshahidkhan1987@...>
Date:   2017-12-22T11:22:44Z

    [CARBONDATA-1929][Validation]carbon property configuration validation

----


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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

qiuchenjian-2
Github user CarbonDataQA commented on the issue:

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



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    Build Success with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1055/



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

[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

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/1718#discussion_r158573603
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java ---
    @@ -107,36 +108,103 @@ private void validateAndLoadDefaultProperties() {
         validateCarbonCSVReadBufferSizeByte();
         validateHandoffSize();
         validateCombineSmallInputFiles();
    +    // The method validate the validity of configured carbon.timestamp.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
    +    // The method validate the validity of configured carbon.date.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_DATE_FORMAT,
    +        CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT);
    +    validateSortFileWriteBufferSize();
    +    validateSortIntermediateFilesLimit();
       }
     
    -  private void validateCarbonCSVReadBufferSizeByte() {
    -    String csvReadBufferSizeStr =
    -        carbonProperties.getProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE);
    -    if (null != csvReadBufferSizeStr) {
    +  /**
    +   * Sort intermediate file size validation and if not valid then reset to the default value
    +   */
    +  private void validateSortIntermediateFilesLimit() {
    +    validateRange(CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_DEFAULT_VALUE,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_MIN,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_MAX);
    +  }
    +
    +  /**
    +   *
    +   * @param key
    +   * @param defaultValue default value for the given key
    +   * @param minValue Minimum value for the given key
    +   * @param maxValue Max value for the given key
    +   */
    +  private void validateRange(String key, String defaultValue, int minValue, int maxValue) {
    +    String fileBufferSize = carbonProperties
    +        .getProperty(key, defaultValue);
    +    if (null != fileBufferSize) {
           try {
    -        int bufferSize = Integer.parseInt(csvReadBufferSizeStr);
    -        if (bufferSize < CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MIN
    -            || bufferSize > CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MAX) {
    -          LOGGER.warn("The value \"" + csvReadBufferSizeStr + "\" configured for key "
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE
    +        int bufferSize = Integer.parseInt(fileBufferSize);
    +
    +        if (bufferSize < minValue
    +            || bufferSize > maxValue) {
    +          LOGGER.warn("The value \"" + fileBufferSize + "\" configured for key "
    +              + key
                   + "\" is not in range. Valid range is (byte) \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MIN + " to \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MAX + ". Using the default value \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    -          carbonProperties.setProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE,
    -              CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    +              + minValue + " to \""
    +              + maxValue +
    +              ". Using the default value \""
    +              + defaultValue);
    +          carbonProperties.setProperty(key,
    +              defaultValue);
             }
           } catch (NumberFormatException nfe) {
    -        LOGGER.warn("The value \"" + csvReadBufferSizeStr + "\" configured for key "
    -            + CarbonCommonConstants.CSV_READ_BUFFER_SIZE
    +        LOGGER.warn("The value \"" + fileBufferSize + "\" configured for key "
    +            + key
                 + "\" is invalid. Using the default value \""
    -            + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    -        carbonProperties.setProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE,
    -            CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    +            + defaultValue);
    +        carbonProperties.setProperty(key,
    +            defaultValue);
           }
         }
       }
     
    +  /**
    +   * validate carbon.sort.file.write.buffer.size and if not valid then reset to the default value
    +   */
    +  private void validateSortFileWriteBufferSize() {
    +    validateRange(CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_DEFAULT_VALUE,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_MIN,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_MAX);
    +  }
    +
    +  /**
    +   * The method validate the validity of configured carbon.date.format value
    +   * and reset to default value if validation fail
    +   */
    +  private void validateCarbonKey(String key, String defaultValue) {
    --- End diff --
   
    This signature is too generic, should validate carbon.date.format only


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

[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

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/1718#discussion_r158573768
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java ---
    @@ -107,36 +108,103 @@ private void validateAndLoadDefaultProperties() {
         validateCarbonCSVReadBufferSizeByte();
         validateHandoffSize();
         validateCombineSmallInputFiles();
    +    // The method validate the validity of configured carbon.timestamp.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
    +    // The method validate the validity of configured carbon.date.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_DATE_FORMAT,
    --- End diff --
   
    These validation should also be done when addProperty is called


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

[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

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

    https://github.com/apache/carbondata/pull/1718#discussion_r158671210
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java ---
    @@ -107,36 +108,103 @@ private void validateAndLoadDefaultProperties() {
         validateCarbonCSVReadBufferSizeByte();
         validateHandoffSize();
         validateCombineSmallInputFiles();
    +    // The method validate the validity of configured carbon.timestamp.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
    +    // The method validate the validity of configured carbon.date.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_DATE_FORMAT,
    +        CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT);
    +    validateSortFileWriteBufferSize();
    +    validateSortIntermediateFilesLimit();
       }
     
    -  private void validateCarbonCSVReadBufferSizeByte() {
    -    String csvReadBufferSizeStr =
    -        carbonProperties.getProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE);
    -    if (null != csvReadBufferSizeStr) {
    +  /**
    +   * Sort intermediate file size validation and if not valid then reset to the default value
    +   */
    +  private void validateSortIntermediateFilesLimit() {
    +    validateRange(CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_DEFAULT_VALUE,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_MIN,
    +        CarbonCommonConstants.SORT_INTERMEDIATE_FILES_LIMIT_MAX);
    +  }
    +
    +  /**
    +   *
    +   * @param key
    +   * @param defaultValue default value for the given key
    +   * @param minValue Minimum value for the given key
    +   * @param maxValue Max value for the given key
    +   */
    +  private void validateRange(String key, String defaultValue, int minValue, int maxValue) {
    +    String fileBufferSize = carbonProperties
    +        .getProperty(key, defaultValue);
    +    if (null != fileBufferSize) {
           try {
    -        int bufferSize = Integer.parseInt(csvReadBufferSizeStr);
    -        if (bufferSize < CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MIN
    -            || bufferSize > CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MAX) {
    -          LOGGER.warn("The value \"" + csvReadBufferSizeStr + "\" configured for key "
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE
    +        int bufferSize = Integer.parseInt(fileBufferSize);
    +
    +        if (bufferSize < minValue
    +            || bufferSize > maxValue) {
    +          LOGGER.warn("The value \"" + fileBufferSize + "\" configured for key "
    +              + key
                   + "\" is not in range. Valid range is (byte) \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MIN + " to \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_MAX + ". Using the default value \""
    -              + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    -          carbonProperties.setProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE,
    -              CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    +              + minValue + " to \""
    +              + maxValue +
    +              ". Using the default value \""
    +              + defaultValue);
    +          carbonProperties.setProperty(key,
    +              defaultValue);
             }
           } catch (NumberFormatException nfe) {
    -        LOGGER.warn("The value \"" + csvReadBufferSizeStr + "\" configured for key "
    -            + CarbonCommonConstants.CSV_READ_BUFFER_SIZE
    +        LOGGER.warn("The value \"" + fileBufferSize + "\" configured for key "
    +            + key
                 + "\" is invalid. Using the default value \""
    -            + CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    -        carbonProperties.setProperty(CarbonCommonConstants.CSV_READ_BUFFER_SIZE,
    -            CarbonCommonConstants.CSV_READ_BUFFER_SIZE_DEFAULT);
    +            + defaultValue);
    +        carbonProperties.setProperty(key,
    +            defaultValue);
           }
         }
       }
     
    +  /**
    +   * validate carbon.sort.file.write.buffer.size and if not valid then reset to the default value
    +   */
    +  private void validateSortFileWriteBufferSize() {
    +    validateRange(CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_DEFAULT_VALUE,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_MIN,
    +        CarbonCommonConstants.CARBON_SORT_FILE_WRITE_BUFFER_SIZE_MAX);
    +  }
    +
    +  /**
    +   * The method validate the validity of configured carbon.date.format value
    +   * and reset to default value if validation fail
    +   */
    +  private void validateCarbonKey(String key, String defaultValue) {
    --- End diff --
   
    fixed


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

[GitHub] carbondata pull request #1718: [CARBONDATA-1929][Validation]carbon property ...

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

    https://github.com/apache/carbondata/pull/1718#discussion_r158671250
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java ---
    @@ -107,36 +108,103 @@ private void validateAndLoadDefaultProperties() {
         validateCarbonCSVReadBufferSizeByte();
         validateHandoffSize();
         validateCombineSmallInputFiles();
    +    // The method validate the validity of configured carbon.timestamp.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
    +    // The method validate the validity of configured carbon.date.format value
    +    // and reset to default value if validation fail
    +    validateCarbonKey(CarbonCommonConstants.CARBON_DATE_FORMAT,
    --- End diff --
   
    added validation check while addProperty also


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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1105/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2553/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1114/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2558/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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


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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1126/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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


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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

    https://github.com/apache/carbondata/pull/1718
 
    Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1145/



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

[GitHub] carbondata issue #1718: [CARBONDATA-1929][Validation]carbon property configu...

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

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



---
1234