@Override
  protected void analyzeCommand(TableName tableName, Map<String, String> partitionSpec, ASTNode command)
      throws SemanticException {
    Table table = getTable(tableName, true);
    if (CollectionUtils.isEmpty(table.getBucketCols())) {
      throw new SemanticException(ErrorMsg.ALTER_BUCKETNUM_NONBUCKETIZED_TBL.getMsg());
    }

    validateAlterTableType(table, AlterTableType.INTO_BUCKETS, false);
    inputs.add(new ReadEntity(table));

    int numberOfBuckets = Integer.parseInt(command.getChild(0).getText());
    AlterTableIntoBucketsDesc desc = new AlterTableIntoBucketsDesc(tableName, partitionSpec, numberOfBuckets);
    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));

    setAcidDdlDesc(getTable(tableName), desc);
  }
Analyzer for set bucket number commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/cluster/AlterTableIntoBucketsAnalyzer.java