public static List<String> validateBucketColumns(StorageDescriptor sd) {
    List<String> bucketColumnNames = null;

    if (CollectionUtils.isNotEmpty(sd.getBucketCols())) {
      bucketColumnNames = sd.getBucketCols().stream().map(String::toLowerCase).collect(Collectors.toList());
      List<String> columnNames = getColumnNames(sd.getCols());
      if (CollectionUtils.isNotEmpty(columnNames))
        bucketColumnNames.removeAll(columnNames);
    }
    return bucketColumnNames;
  }
Validate bucket columns should belong to table columns.
@param sd StorageDescriptor of given table
@return true if bucket columns are empty or belong to table columns else false
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java