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

    https://github.com/apache/carbondata/pull/2654#discussion_r214049002
  
    --- Diff: 
processing/src/main/java/org/apache/carbondata/processing/util/CarbonDataProcessorUtil.java
 ---
    @@ -450,6 +450,114 @@ public static boolean isHeaderValid(String tableName, 
String[] csvHeader,
         return type;
       }
     
    +  /**
    +   * Get the no dictionary data types on the table
    +   *
    +   * @param databaseName
    +   * @param tableName
    +   * @return
    +   */
    +  public static DataType[] getNoDicDataTypes(String databaseName, String 
tableName) {
    +    CarbonTable carbonTable = 
CarbonMetadata.getInstance().getCarbonTable(databaseName, tableName);
    +    List<CarbonDimension> dimensions = 
carbonTable.getDimensionByTableName(tableName);
    +    int noDicCount = 0;
    +    for (int i = 0; i < dimensions.size(); i++) {
    +      if (!dimensions.get(i).hasEncoding(Encoding.DICTIONARY)) {
    +        noDicCount++;
    +      }
    +    }
    +    DataType[] type = new DataType[noDicCount];
    +    noDicCount = 0;
    +    for (int i = 0; i < dimensions.size(); i++) {
    +      if (!dimensions.get(i).hasEncoding(Encoding.DICTIONARY)) {
    +        type[noDicCount++] = dimensions.get(i).getDataType();
    +      }
    +    }
    --- End diff --
    
    The below for loop can be removed and the filling of data type can be done 
in single iteration by taking an arraylist and while sending back you can 
convert back to array


---

Reply via email to