Search in sources :

Example 1 with WriteNotificationLogBatchRequest

use of org.apache.hadoop.hive.metastore.api.WriteNotificationLogBatchRequest in project hive by apache.

the class Hive method addWriteNotificationLogInBatch.

private boolean addWriteNotificationLogInBatch(Table tbl, List<WriteNotificationLogRequest> requestList) throws HiveException, MetaException, TException {
    long start = System.currentTimeMillis();
    boolean supported = true;
    WriteNotificationLogBatchRequest rqst = new WriteNotificationLogBatchRequest(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), requestList);
    try {
        get(conf).getSynchronizedMSC().addWriteNotificationLogInBatch(rqst);
    } catch (TApplicationException e) {
        int type = e.getType();
        if (type == TApplicationException.UNKNOWN_METHOD || type == TApplicationException.WRONG_METHOD_NAME) {
            // For older HMS, if the batch API is not supported, fall back to older API.
            LOG.info("addWriteNotificationLogInBatch failed with ", e);
            for (WriteNotificationLogRequest request : requestList) {
                get(conf).getSynchronizedMSC().addWriteNotificationLog(request);
            }
            supported = false;
        }
    }
    long end = System.currentTimeMillis();
    LOG.info("Time taken to add " + requestList.size() + " write notifications: " + ((end - start) / 1000F) + " seconds");
    return supported;
}
Also used : WriteNotificationLogBatchRequest(org.apache.hadoop.hive.metastore.api.WriteNotificationLogBatchRequest) WriteNotificationLogRequest(org.apache.hadoop.hive.metastore.api.WriteNotificationLogRequest) TApplicationException(org.apache.thrift.TApplicationException)

Aggregations

WriteNotificationLogBatchRequest (org.apache.hadoop.hive.metastore.api.WriteNotificationLogBatchRequest)1 WriteNotificationLogRequest (org.apache.hadoop.hive.metastore.api.WriteNotificationLogRequest)1 TApplicationException (org.apache.thrift.TApplicationException)1