@Override
  protected void doAlteration(Table table, Partition partition) throws HiveException {
    StorageDescriptor sd = getStorageDescriptor(table, partition);
    // validate sort columns and bucket columns
    List<String> columns = Utilities.getColumnNamesFromFieldSchema(table.getCols());
    Utilities.validateColumnNames(columns, desc.getBucketColumns());
    if (desc.getSortColumns() != null) {
      Utilities.validateColumnNames(columns, Utilities.getColumnNamesFromSortCols(desc.getSortColumns()));
    }

    sd.setBucketCols(desc.getBucketColumns());
    sd.setNumBuckets(desc.getNumberBuckets());
    sd.setSortCols(desc.getSortColumns());
  }
Operation process of clustering a table by some column.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/cluster/AlterTableClusteredByOperation.java