Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2651#discussion_r212582796
  
    --- Diff: 
store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java 
---
    @@ -272,6 +272,56 @@ public CarbonWriterBuilder withLoadOptions(Map<String, 
String> options) {
         return this;
       }
     
    +  /**
    +   * To support the table properties for sdk writer
    +   *
    +   * @param options key,value pair of create table properties.
    +   * supported keys values are
    +   * a. blocksize -- [1-2048] values in MB. Default value is 1024
    +   * b. blockletsize -- values in MB. Default value is 64 MB
    +   * c. localDictionaryThreshold -- positive value, default is 10000
    +   * d. enableLocalDictionary -- true / false. Default is false
    +   * e. sortcolumns -- comma separated column. "c1,c2". Default all 
dimensions are sorted.
    +   *
    +   * @return updated CarbonWriterBuilder
    +   */
    +  public CarbonWriterBuilder withTableProperties(Map<String, String> 
options) {
    +    Objects.requireNonNull(options, "Table properties should not be null");
    +    //validate the options.
    +    if (options.size() > 5) {
    +      throw new IllegalArgumentException("Supports only 5 options now. "
    +          + "Refer method header or documentation");
    +    }
    +
    +    for (String option: options.keySet()) {
    +      if (!option.equalsIgnoreCase("blocksize") &&
    +          !option.equalsIgnoreCase("blockletsize") &&
    +          !option.equalsIgnoreCase("localDictionaryThreshold") &&
    +          !option.equalsIgnoreCase("enableLocalDictionary") &&
    +          !option.equalsIgnoreCase("sortcolumns")) {
    +        throw new IllegalArgumentException("Unsupported options. "
    --- End diff --
    
    Better to put all the allowed options in a set and then each property u can 
check using Set.Contains API which will be faster and a cleaner code


---

Reply via email to