code: private void appendClusteringOrder(CQLTranslator translator, List<ColumnInfo> compositeColumns,
              StringBuilder clusterKeyOrderingBuilder, StringBuilder primaryKeyBuilder)
      {
          // to retrieve the order in which cluster key is formed
          String[] primaryKeys = primaryKeyBuilder.toString().split("\\s*,\\s*");
          for (String primaryKey : primaryKeys)
          {
              // to compare the objects without enclosing quotes
              primaryKey = primaryKey.trim().substring(1, primaryKey.trim().length() - 1);
              for (ColumnInfo colInfo : compositeColumns)
              {
  
                  if (primaryKey.equals(colInfo.getColumnName()))
                  {
                      if (colInfo.getOrderBy() != null)
                      {
                          translator.appendColumnName(clusterKeyOrderingBuilder, colInfo.getColumnName());
                          clusterKeyOrderingBuilder.append(translator.SPACE_STRING);
                          clusterKeyOrderingBuilder.append(colInfo.getOrderBy());
                          clusterKeyOrderingBuilder.append(translator.COMMA_STR);
                      }
  
                  }
              }
          }
          if (clusterKeyOrderingBuilder.length() != 0)
          {
              clusterKeyOrderingBuilder.deleteCharAt(clusterKeyOrderingBuilder.toString().lastIndexOf(","));
              clusterKeyOrderingBuilder.append(translator.CLOSE_BRACKET);
          }
  
      }
docs: Append clustering order.
  
  @param translator
  the translator
  @param compositeColumns
  the composite columns
  @param clusterKeyOrderingBuilder
  the cluster key ordering builder
  @param primaryKeyBuilder
  the primary key builder