Search in sources :

Example 6 with MFunction

use of org.apache.hadoop.hive.metastore.model.MFunction in project hive by apache.

the class ObjectStore method getMFunction.

private MFunction getMFunction(String db, String function) {
    MFunction mfunc = null;
    boolean commited = false;
    Query query = null;
    try {
        openTransaction();
        db = HiveStringUtils.normalizeIdentifier(db);
        function = HiveStringUtils.normalizeIdentifier(function);
        query = pm.newQuery(MFunction.class, "functionName == function && database.name == db");
        query.declareParameters("java.lang.String function, java.lang.String db");
        query.setUnique(true);
        mfunc = (MFunction) query.execute(function, db);
        pm.retrieve(mfunc);
        commited = commitTransaction();
    } finally {
        if (!commited) {
            rollbackTransaction();
        }
        if (query != null) {
            query.closeAll();
        }
    }
    return mfunc;
}
Also used : Query(javax.jdo.Query) MFunction(org.apache.hadoop.hive.metastore.model.MFunction)

Aggregations

MFunction (org.apache.hadoop.hive.metastore.model.MFunction)6 Query (javax.jdo.Query)2 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)1 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)1 MDatabase (org.apache.hadoop.hive.metastore.model.MDatabase)1 MStringList (org.apache.hadoop.hive.metastore.model.MStringList)1