content: package com.airbnb.reair.hive.hooks;
  
  /**
   * TODO: Migrate to HiveOperation from hive-exec once exchange partition types are added.
   */
  public enum HiveOperation {
    ALTERDATABASE,
    ALTERINDEX_PROPS,
    ALTERINDEX_REBUILD,
    ALTERPARTITION_BUCKETNUM,
    ALTERPARTITION_FILEFORMAT,
    ALTERPARTITION_LOCATION,
    ALTERPARTITION_MERGEFILES,
    ALTERPARTITION_PROTECTMODE,
    ALTERPARTITION_SERDEPROPERTIES,
    ALTERPARTITION_SERIALIZER,
    ALTERTABLE_ADDCOLS,
    ALTERTABLE_ADDPARTS,
    ALTERTABLE_ARCHIVE,
    ALTERTABLE_BUCKETNUM,
    ALTERTABLE_CLUSTER_SORT,
    ALTERTABLE_DROPPARTS,
    ALTERTABLE_EXCHANGEPARTITION,
    ALTERTABLE_FILEFORMAT,
    ALTERTABLE_LOCATION,
    ALTERTABLE_MERGEFILES,
    ALTERTABLE_PROPERTIES,
    ALTERTABLE_PROTECTMODE,
    ALTERTABLE_RENAME,
    ALTERTABLE_RENAMECOL,
    ALTERTABLE_RENAMEPART,
    ALTERTABLE_REPLACECOLS,
    ALTERTABLE_SERDEPROPERTIES,
    ALTERTABLE_SERIALIZER,
    ALTERTABLE_SKEWED,
    ALTERTABLE_TOUCH,
    ALTERTABLE_UNARCHIVE,
    ALTERTBLPART_SKEWED_LOCATION,
    ALTERVIEW_PROPERTIES,
    ALTERVIEW_RENAME,
    ANALYZE_TABLE,
    CREATEDATABASE,
    CREATEFUNCTION,
    CREATEINDEX,
    CREATEMACRO,
    CREATEROLE,
    CREATETABLE,
    CREATETABLE_AS_SELECT,
    CREATEVIEW,
    DESCDATABASE,
    DESCFUNCTION,
    DESCTABLE,
    DROPDATABASE,
    DROPFUNCTION,
    DROPINDEX,
    DROPMACRO,
    DROPROLE,
    DROPTABLE,
    DROPVIEW,
    DROPVIEW_PROPERTIES,
    EXPLAIN,
    EXPORT,
    GRANT_PRIVILEGE,
    GRANT_ROLE,
    IMPORT,
    LOAD,
    LOCKTABLE,
    MSCK,
    QUERY,
    REVOKE_PRIVILEGE,
    REVOKE_ROLE,
    SHOW_CREATETABLE,
    SHOW_TABLESTATUS,
    SHOW_TBLPROPERTIES,
    SHOW_GRANT,
    SHOW_ROLES,
    SHOW_ROLE_GRANT,
    SHOWDATABASES,
    SHOWCOLUMNS,
    SHOWFUNCTIONS,
    SHOWINDEXES,
    SHOWLOCKS,
    SHOWPARTITIONS,
    SHOWTABLES,
    SWITCHDATABASE,
    THRIFT_ADD_PARTITION,
    THRIFT_ALTER_PARTITION,
    THRIFT_ALTER_TABLE,
    THRIFT_CREATE_DATABASE,
    THRIFT_CREATE_TABLE,
    THRIFT_DROP_DATABASE,
    THRIFT_DROP_PARTITION,
    THRIFT_DROP_TABLE,
    TRUNCATETABLE,
    UNLOCKTABLE;
  
    /**
     * Checks to see if the given operation is an operation that was coming from the Hive metastore
     * Thrift server.
     *
     * @param operation the type of operation.
     * @return if the given operation is from the Thrift server
     */
    public static boolean isThriftOperation(HiveOperation operation) {
      if (operation == null) {
        return false;
      }
  
      switch (operation) {
        case THRIFT_ADD_PARTITION:
        case THRIFT_ALTER_PARTITION:
        case THRIFT_ALTER_TABLE:
        case THRIFT_CREATE_DATABASE:
        case THRIFT_CREATE_TABLE:
        case THRIFT_DROP_DATABASE:
        case THRIFT_DROP_PARTITION:
        case THRIFT_DROP_TABLE:
          return true;
        default:
          return false;
      }
    }
  }
  