Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2826#discussion_r228542847
  
    --- Diff: 
integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala
 ---
    @@ -671,4 +671,20 @@ object CarbonScalaUtil {
         dataType == StringType
       }
     
    +  /**
    +   * Rearrange the column schema with all the sort columns at first. In 
case of ALTER ADD COLUMNS,
    +   * if the newly added column is a sort column it will be at the last. 
But we expects all the
    +   * SORT_COLUMNS always at first
    +   *
    +   * @param columnSchemas
    +   * @return
    +   */
    +  def reArrangeColumnSchema(columnSchemas: mutable.Buffer[ColumnSchema]): 
mutable
    +  .Buffer[ColumnSchema] = {
    --- End diff --
    
    alterTableModel.tableProperties.get("sort_columns") will give size sort 
columns, 
    
    so based on this we can traverse only once and set both sort and non-sort 
columns in buffer, just set sort columns in beginning and non-sort column index 
start from size of sortcolumn.



---

Reply via email to