Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.NoSuchObjectException


    MTable mTable = getMTable(mStatsObj.getDbName(), mStatsObj.getTableName());
    boolean foundCol = false;

    if (mTable == null) {
      throw new
        NoSuchObjectException("Table " + tableName +
        " for which stats gathering is requested doesn't exist.");
    }

    MPartition mPartition =
                 getMPartition(mStatsObj.getDbName(), mStatsObj.getTableName(), partVal);

    if (mPartition == null) {
      throw new
        NoSuchObjectException("Partition " + partName +
        " for which stats gathering is requested doesn't exist");
    }

    MStorageDescriptor mSDS = mPartition.getSd();
    List<MFieldSchema> colList = mSDS.getCD().getCols();

    for(MFieldSchema mCol:colList) {
      if (mCol.getName().equals(mStatsObj.getColName().trim())) {
        foundCol = true;
        break;
      }
    }

    if (!foundCol) {
      throw new
        NoSuchObjectException("Column " + colName +
        " for which stats gathering is requested doesn't exist.");
    }

    MPartitionColumnStatistics oldStatsObj = getMPartitionColumnStatistics(dbName, tableName,
View Full Code Here


      MTableColumnStatistics mStatsObj = null;
      MTable mTable = getMTable(dbName.trim(), tableName.trim());
      boolean foundCol = false;

      if (mTable == null) {
        throw new NoSuchObjectException("Table " + tableName +
        " for which stats is requested doesn't exist.");
      }

      MStorageDescriptor mSDS = mTable.getSd();
      List<MFieldSchema> colList = mSDS.getCD().getCols();

      for(MFieldSchema mCol:colList) {
        if (mCol.getName().equals(colName.trim())) {
          foundCol = true;
          break;
        }
      }

      if (!foundCol) {
        throw new NoSuchObjectException("Column " + colName +
        " for which stats is requested doesn't exist.");
      }

      Query query = pm.newQuery(MTableColumnStatistics.class);
      query.setFilter("table.tableName == t1 && " +
View Full Code Here

  {
    ColumnStatistics statsObj;
    MTableColumnStatistics mStatsObj = getMTableColumnStatistics(dbName, tableName, colName);

    if (mStatsObj == null) {
      throw new NoSuchObjectException("Statistics for dbName=" + dbName + " tableName=" + tableName
        + " columnName=" + colName + " doesn't exist.");
    }

    statsObj = convertToTableColumnStatistics(mStatsObj);
    return statsObj;
View Full Code Here

    ColumnStatistics statsObj;
    MPartitionColumnStatistics mStatsObj =
          getMPartitionColumnStatistics(dbName, tableName, partName, partVal, colName);

    if (mStatsObj == null) {
      throw new NoSuchObjectException("Statistics for dbName=" + dbName + " tableName=" + tableName
          + " partName= " + partName + " columnName=" + colName + " doesn't exist.");
    }
    statsObj = convertToPartColumnStatistics(mStatsObj);
    return statsObj;
  }
View Full Code Here

      openTransaction();
      MTable mTable = getMTable(dbName.trim(), tableName.trim());
      boolean foundCol = false;

      if (mTable == null) {
        throw new NoSuchObjectException("Table "  + tableName +
          " for which stats is requested doesn't exist.");
      }

      MPartition mPartition =
                  getMPartition(dbName, tableName, partVal);

      if (mPartition == null) {
        throw new
          NoSuchObjectException("Partition " + partName +
          " for which stats is requested doesn't exist");
      }

      MStorageDescriptor mSDS = mPartition.getSd();
      List<MFieldSchema> colList = mSDS.getCD().getCols();

      for(MFieldSchema mCol:colList) {
        if (mCol.getName().equals(colName.trim())) {
          foundCol = true;
          break;
        }
      }

      if (!foundCol) {
        throw new NoSuchObjectException("Column " + colName +
        " for which stats is requested doesn't exist.");
      }

      Query query = pm.newQuery(MPartitionColumnStatistics.class);
      query.setFilter("partition.partitionName == t1 && " +
View Full Code Here

      MTable mTable = getMTable(dbName, tableName);
      MPartitionColumnStatistics mStatsObj;
      List<MPartitionColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
          NoSuchObjectException("Table " + tableName +
          "  for which stats deletion is requested doesn't exist");
      }

      MPartition mPartition =
          getMPartition(dbName, tableName, partVals);

      if (mPartition == null) {
        throw new
          NoSuchObjectException("Partition " + partName +
          " for which stats deletion is requested doesn't exist");
      }

      Query query = pm.newQuery(MPartitionColumnStatistics.class);
      String filter;
      String parameters;

      if (colName != null) {
        filter = "partition.partitionName == t1 && dbName == t2 && tableName == t3 && " +
                    "colName == t4";
        parameters = "java.lang.String t1, java.lang.String t2, " +
                        "java.lang.String t3, java.lang.String t4";
      } else {
        filter = "partition.partitionName == t1 && dbName == t2 && tableName == t3";
        parameters = "java.lang.String t1, java.lang.String t2, java.lang.String t3";
      }

      query.setFilter(filter);
      query
        .declareParameters(parameters);

      if (colName != null) {
        query.setUnique(true);
        mStatsObj = (MPartitionColumnStatistics)query.executeWithArray(partName.trim(),
                                                dbName.trim(), tableName.trim(), colName.trim());
        pm.retrieve(mStatsObj);

        if (mStatsObj != null) {
          pm.deletePersistent(mStatsObj);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" +dbName + " table="
              + tableName + " partition=" + partName + " col=" + colName);
        }
      } else {
        mStatsObjColl= (List<MPartitionColumnStatistics>)query.execute(partName.trim(),
                                  dbName.trim(), tableName.trim());
        pm.retrieveAll(mStatsObjColl);

        if (mStatsObjColl != null) {
          pm.deletePersistentAll(mStatsObjColl);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" + dbName +
            " table=" + tableName + " partition" + partName);
        }
      }
      ret = commitTransaction();
    } catch(NoSuchObjectException e) {
View Full Code Here

      MTable mTable = getMTable(dbName, tableName);
      MTableColumnStatistics mStatsObj;
        List<MTableColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
          NoSuchObjectException("Table " + tableName +
          "  for which stats deletion is requested doesn't exist");
      }

      Query query = pm.newQuery(MTableColumnStatistics.class);
      String filter;
      String parameters;

      if (colName != null) {
        filter = "table.tableName == t1 && dbName == t2 && colName == t3";
        parameters = "java.lang.String t1, java.lang.String t2, java.lang.String t3";
      } else {
        filter = "table.tableName == t1 && dbName == t2";
        parameters = "java.lang.String t1, java.lang.String t2";
      }

      query.setFilter(filter);
      query
        .declareParameters(parameters);

      if (colName != null) {
        query.setUnique(true);
        mStatsObj = (MTableColumnStatistics)query.execute(tableName.trim(),
                                                    dbName.trim(), colName.trim());
        pm.retrieve(mStatsObj);

        if (mStatsObj != null) {
          pm.deletePersistent(mStatsObj);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" +dbName + " table="
              + tableName + " col=" + colName);
        }
      } else {
        mStatsObjColl= (List<MTableColumnStatistics>)query.execute(tableName.trim(), dbName.trim());
        pm.retrieveAll(mStatsObjColl);

        if (mStatsObjColl != null) {
          pm.deletePersistentAll(mStatsObjColl);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" + dbName +
            " table=" + tableName);
        }
      }
      ret = commitTransaction();
    } catch(NoSuchObjectException e) {
View Full Code Here

        rollbackTransaction();
      }
    }
    LOG.debug("Done executing updateMasterKey with status : " + committed);
    if (null == masterKey) {
      throw new NoSuchObjectException("No key found with keyId: " + id);
    }
    if (!committed) {
      throw new MetaException("Though key is found, failed to update it. " + id);
    }
  }
View Full Code Here

      if (!committed) {
        rollbackTransaction();
      }
    }
    if (mVerTables.isEmpty()) {
      throw new NoSuchObjectException("No matching version found");
    }
    if (mVerTables.size() > 1) {
      throw new MetaException("Metastore contains multiple versions");
    }
    return mVerTables.get(0);
View Full Code Here

      Type ret = null;
      Exception ex = null;
      try {
        ret = getMS().getType(name);
        if (null == ret) {
          throw new NoSuchObjectException("Type \"" + name + "\" not found.");
        }
      } catch (Exception e) {
        ex = e;
        if (e instanceof MetaException) {
          throw (MetaException) e;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.NoSuchObjectException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.