Package org.apache.hcatalog.common

Examples of org.apache.hcatalog.common.HCatException


        }
      } catch(Exception e) {
        if( e instanceof HCatException ) {
          throw (HCatException) e;
        } else {
          throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
        }
      }

      Path src;
      if (dynamicPartitioningUsed){
View Full Code Here


            client.dropPartition(tableInfo.getDatabaseName(),
                    tableInfo.getTableName(), p.getValues());
            }
          } catch(Exception te) {
            //Keep cause as the original exception
            throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
          }
        }

        if( e instanceof HCatException ) {
          throw (HCatException) e;
        } else {
          throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
        }
      } finally {
        if( client != null ) {
          client.close();
        }
View Full Code Here

     * @throws IOException
     */
    static List<String> getPartitionValueList(Table table, Map<String, String> valueMap) throws IOException {

      if( valueMap.size() != table.getPartitionKeys().size() ) {
          throw new HCatException(ErrorType.ERROR_INVALID_PARTITION_VALUES,
              "Table "
              + table.getTableName() + " has " +
              table.getPartitionKeys().size() + " partition keys, got "+
              valueMap.size());
      }

      List<String> values = new ArrayList<String>();

      for(FieldSchema schema : table.getPartitionKeys()) {
        String value = valueMap.get(schema.getName().toLowerCase());

        if( value == null ) {
          throw new HCatException(ErrorType.ERROR_MISSING_PARTITION_KEY,
              "Key " + schema.getName() + " of table " + table.getTableName());
        }

        values.add(value);
      }
View Full Code Here

        Path finalOutputPath = getFinalPath(file, src, dest);

        if (dryRun){
//        LOG.info("Testing if moving ["+file+"] to ["+finalOutputPath+"] would cause a problem");
          if (fs.exists(finalOutputPath)){
            throw new HCatException(ErrorType.ERROR_MOVE_FAILED, "Data already exists in " + finalOutputPath + ", duplicate publish possible.");
          }
        }else{
//        LOG.info("Moving ["+file+"] to ["+finalOutputPath+"]");
          if (!fs.rename(file, finalOutputPath)) {
            if (!fs.delete(finalOutputPath, true)) {
              throw new HCatException(ErrorType.ERROR_MOVE_FAILED, "Failed to delete existing path " + finalOutputPath);
            }
            if (!fs.rename(file, finalOutputPath)) {
              throw new HCatException(ErrorType.ERROR_MOVE_FAILED, "Failed to move output to " + dest);
            }
          }
        }
      } else if(fs.getFileStatus(file).isDir()) {
        FileStatus[] paths = fs.listStatus(file);
View Full Code Here

    private Path getFinalPath(Path file, Path src,
                              Path dest) throws IOException {
      URI taskOutputUri = file.toUri();
      URI relativePath = src.toUri().relativize(taskOutputUri);
      if (taskOutputUri == relativePath) {
        throw new HCatException(ErrorType.ERROR_MOVE_FAILED, "Can not get the relative path: base = " +
            src + " child = " + file);
      }
      if (relativePath.getPath().length() > 0) {
        return new Path(dest, relativePath.getPath());
      } else {
View Full Code Here

          //            +loadPath+"] with depth["+jobInfo.getTable().getPartitionKeysSize()
          //            +"], dynSpec["+dynPathSpec+"]");
        }else{
          if ((maxDynamicPartitions != -1) && (status.length > maxDynamicPartitions)){
            this.partitionsDiscovered = true;
            throw new HCatException(ErrorType.ERROR_TOO_MANY_DYNAMIC_PTNS,
                "Number of dynamic partitions being created "
                    + "exceeds configured max allowable partitions["
                    + maxDynamicPartitions
                    + "], increase parameter ["
                    + HiveConf.ConfVars.DYNAMICPARTITIONMAXPARTS.varname
View Full Code Here

      SerDeInfo serdeInfo = sd.getSerdeInfo();
      serdeInfo.setSerializationLib(serializationLib);
      Configuration conf = job.getConfiguration();
      conf.set(HCatConstants.HCAT_KEY_OUTPUT_INFO, HCatUtil.serialize(jobInfo));
    } catch (IOException e) {
      throw new HCatException(ErrorType.ERROR_SET_OUTPUT, e);
    } catch (MetaException e) {
      throw new HCatException(ErrorType.ERROR_SET_OUTPUT, e);
    }
  }
View Full Code Here

  private static void validateHCatFieldAndTajoSchema(HCatFieldSchema fieldSchema) throws CatalogException {
    try {
      HCatFieldSchema.Type fieldType = fieldSchema.getType();
      switch (fieldType) {
        case ARRAY:
          throw new HCatException("Tajo cannot support array field type.");
        case STRUCT:
          throw new HCatException("Tajo cannot support struct field type.");
        case MAP:
          throw new HCatException("Tajo cannot support map field type.");
      }
    } catch (HCatException e) {
      throw new CatalogException("incompatible hcatalog types when assigning to tajo type. - " +
          "HCatFieldSchema:" + fieldSchema);
    }
View Full Code Here

         * @return An instance of HCatCreateDBDesc
         * @throws HCatException
         */
        public HCatCreateDBDesc build() throws HCatException {
            if (this.dbName == null) {
                throw new HCatException("Database name cannot be null.");
            }
            HCatCreateDBDesc desc = new HCatCreateDBDesc(this.dbName);
            desc.comment = this.innerComment;
            desc.locationUri = this.innerLoc;
            desc.dbProperties = this.innerDBProps;
View Full Code Here

        throws HCatException {
        List<String> dbNames = null;
        try {
            dbNames = hmsClient.getDatabases(pattern);
        } catch (MetaException exp) {
            throw new HCatException("MetaException while listing db names", exp);
        }
        return dbNames;
    }
View Full Code Here

TOP

Related Classes of org.apache.hcatalog.common.HCatException

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.