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

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


        final RawStore ms, final Partition part)
    throws InvalidObjectException, AlreadyExistsException, MetaException {
      boolean success = false, madeDir = false;
      Path partLocation = null;
      try {
        Partition old_part = null;
        try {
          old_part = ms.getPartition(part.getDbName(), part
            .getTableName(), part.getValues());
        } catch(NoSuchObjectException e) {
          // this means there is no existing partition
View Full Code Here


    }

    private Partition add_partition_core(final RawStore ms, final Partition part)
    throws InvalidObjectException, AlreadyExistsException, MetaException {
      boolean success = false;
      Partition retPtn = null;
      try{
        ms.openTransaction();
        retPtn = add_partition_core_notxn(ms,part).getKey();
        // we proceed only if we'd actually succeeded anyway, otherwise,
        // we'd have thrown an exception
View Full Code Here

    public Partition add_partition(final Partition part)
        throws InvalidObjectException, AlreadyExistsException, MetaException {
      startTableFunction("add_partition", part.getDbName(), part.getTableName());

      Partition ret = null;
      try {
        ret = executeWithRetry(new Command<Partition>() {
          @Override
          public Partition run(RawStore ms) throws Exception {
            return add_partition_core(ms, part);
View Full Code Here

    throws MetaException, NoSuchObjectException, IOException {

      boolean success = false;
      Path partPath = null;
      Table tbl = null;
      Partition part = null;
      boolean isArchived = false;
      Path archiveParentDir = null;

      try {
        ms.openTransaction();
        part = ms.getPartition(db_name, tbl_name, part_vals);

        if (part == null) {
          throw new NoSuchObjectException("Partition doesn't exist. "
              + part_vals);
        }

        isArchived = MetaStoreUtils.isArchived(part);
        if (isArchived) {
          archiveParentDir = MetaStoreUtils.getOriginalLocation(part);
          if (!wh.isWritable(archiveParentDir.getParent())) {
            throw new MetaException("Table partition not deleted since " +
                archiveParentDir.getParent() + " is not writable by " +
                hiveConf.getUser());
          }
        }
        if (!ms.dropPartition(db_name, tbl_name, part_vals)) {
          throw new MetaException("Unable to drop partition");
        }
        success = ms.commitTransaction();
        if ((part.getSd() != null) && (part.getSd().getLocation() != null)) {
          partPath = new Path(part.getSd().getLocation());
          if (!wh.isWritable(partPath.getParent())) {
            throw new MetaException("Table partition not deleted since " +
                partPath.getParent() + " is not writable by " +
                hiveConf.getUser());
          }
View Full Code Here

    public Partition get_partition(final String db_name, final String tbl_name,
        final List<String> part_vals) throws MetaException, NoSuchObjectException {
      startPartitionFunction("get_partition", db_name, tbl_name, part_vals);

      Partition ret = null;
      try {
        ret = executeWithRetry(new Command<Partition>() {
          @Override
          public Partition run(RawStore ms) throws Exception {
            return ms.getPartition(db_name, tbl_name, part_vals);
View Full Code Here

        final String user_name, final List<String> group_names)
        throws MetaException, NoSuchObjectException, TException {
      startPartitionFunction("get_partition_with_auth", db_name, tbl_name,
          part_vals);

      Partition ret = null;
      try {
        ret = executeWithRetry(new Command<Partition>() {
          @Override
          public Partition run(RawStore ms) throws Exception {
            return ms.getPartitionWithAuth(db_name, tbl_name, part_vals,
View Full Code Here

            new_part.getParameters().get(Constants.DDL_TIME) == null ||
            Integer.parseInt(new_part.getParameters().get(Constants.DDL_TIME)) == 0) {
          new_part.putToParameters(Constants.DDL_TIME, Long.toString(System
              .currentTimeMillis() / 1000));
        }
        Partition oldPart = ms.getPartition(db_name, tbl_name, new_part.getValues());
        ms.alterPartition(db_name, tbl_name, new_part);
        for (MetaStoreEventListener listener : listeners) {
          listener.onAlterPartition(new AlterPartitionEvent(oldPart, new_part, true, this));
        }
      } catch (InvalidObjectException e) {
View Full Code Here

      try {
        partVals = getPartValsFromName(ms, db_name, tbl_name, part_name);
      } catch (InvalidObjectException e) {
        throw new NoSuchObjectException(e.getMessage());
      }
      Partition p = ms.getPartition(db_name, tbl_name, partVals);

      if (p == null) {
        throw new NoSuchObjectException(db_name + "." + tbl_name
            + " partition (" + part_name + ") not found");
      }
View Full Code Here

        final String part_name) throws MetaException, NoSuchObjectException, TException {

      startFunction("get_partition_by_name", ": db=" + db_name + " tbl="
          + tbl_name + " part=" + part_name);

      Partition ret = null;

      try {
        ret = executeWithRetry(new Command<Partition>() {
          @Override
          public Partition run(RawStore ms) throws Exception {
View Full Code Here

        final String part_name) throws InvalidObjectException,
        AlreadyExistsException, MetaException, TException {
      startFunction("append_partition_by_name", ": db=" + db_name + " tbl="
          + tbl_name + " part=" + part_name);

      Partition ret = null;
      try {
        ret = executeWithRetry(new Command<Partition>() {
          @Override
          public Partition run(RawStore ms) throws Exception {
            List<String> partVals = getPartValsFromName(ms, db_name, tbl_name, part_name);
View Full Code Here

TOP

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

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.