1.30.19和2.00.7版本ops模块提供了以下函数:
/* * * @ brief Force delete the recovering partition. * @ param * dbPath is the absolute path of the folder where the database is stored * tableName is the name of dfs table, required if chunkGranularity is TABLE * @ return NULL * @ sample usage dropRecoveringPartitions("dfs://compoDB") */ def dropRecoveringPartitions(dbPath , tableName=""){ db=database(dbPath) if(db.schema().chunkGranularity=="TABLE"){ if (isNull(tableName) or tableName=="") throw "Please input the table name" } dbName = substr(dbPath, 5) partitions = exec substr(file, strlen(dbName)) from rpc(getControllerAlias(), getClusterChunksStatus) where like(file, dbName + "%"), state != "COMPLETE" if(db.schema().chunkGranularity=="TABLE") dropPartition(db, partitions, tableName, true) else dropPartition(db, partitions, , true) }