Search in sources :

Example 1 with FileMetadataHandler

use of org.apache.hadoop.hive.metastore.FileMetadataHandler in project hive by apache.

the class HBaseStore method getFileMetadataByExpr.

@Override
public void getFileMetadataByExpr(List<Long> fileIds, FileMetadataExprType type, byte[] expr, ByteBuffer[] metadatas, ByteBuffer[] results, boolean[] eliminated) throws MetaException {
    FileMetadataHandler fmh = fmHandlers.get(type);
    boolean commit = true;
    try {
        fmh.getFileMetadataByExpr(fileIds, expr, metadatas, results, eliminated);
    } catch (IOException e) {
        LOG.error("Unable to get file metadata by expr", e);
        commit = false;
        throw new MetaException("Error reading file metadata by expr" + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : IOException(java.io.IOException) FileMetadataHandler(org.apache.hadoop.hive.metastore.FileMetadataHandler) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 2 with FileMetadataHandler

use of org.apache.hadoop.hive.metastore.FileMetadataHandler in project hive by apache.

the class HBaseStore method putFileMetadata.

@Override
public void putFileMetadata(List<Long> fileIds, List<ByteBuffer> metadata, FileMetadataExprType type) throws MetaException {
    openTransaction();
    boolean commit = false;
    try {
        ByteBuffer[][] addedVals = null;
        ByteBuffer[] addedCols = null;
        if (type != null) {
            FileMetadataHandler fmh = fmHandlers.get(type);
            addedCols = fmh.createAddedCols();
            if (addedCols != null) {
                addedVals = fmh.createAddedColVals(metadata);
            }
        }
        getHBase().storeFileMetadata(fileIds, metadata, addedCols, addedVals);
        commit = true;
    } catch (IOException | InterruptedException e) {
        LOG.error("Unable to store file metadata", e);
        throw new MetaException("Error storing file metadata " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : IOException(java.io.IOException) ByteBuffer(java.nio.ByteBuffer) FileMetadataHandler(org.apache.hadoop.hive.metastore.FileMetadataHandler) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Aggregations

IOException (java.io.IOException)2 FileMetadataHandler (org.apache.hadoop.hive.metastore.FileMetadataHandler)2 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)2 ByteBuffer (java.nio.ByteBuffer)1