Package org.apache.hcatalog.common

Examples of org.apache.hcatalog.common.HCatException


        int dynHashCode = dynamicPartValues.hashCode();
        if (!baseDynamicWriters.containsKey(dynHashCode)){
//          LOG.info("Creating new storage driver["+baseDynamicStorageDrivers.size()
//              +"/"+maxDynamicPartitions+ "] for "+dynamicPartValues.toString());
          if ((maxDynamicPartitions != -1) && (baseDynamicStorageDrivers.size() > maxDynamicPartitions)){
            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


        partition.getTPartition().setParameters(table.getParameters());
        partitions.add(partition);
      }
      EximUtil.createExportDump(fs, path, (table), partitions);
    } catch (SemanticException e) {
      throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
    } catch (HiveException e) {
      throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
    } catch (MetaException e) {
      throw new HCatException(ErrorType.ERROR_PUBLISHING_PARTITION, e);
    }
  }
View Full Code Here

//      }
//      doHarCheck(fs,harFile);
//      LOG.info("Nuking " + dir);
      fs.delete(new Path(dir), true);
    } catch (Exception e){
      throw new HCatException("Error creating Har ["+harFile+"] from ["+dir+"]", e);
    }
  }
View Full Code Here

            inputInfo.getFilter(), (short) -1);

        // Default to 100,000 partitions if hive.metastore.maxpartition is not defined
        int maxPart = hiveConf.getInt("hcat.metastore.maxpartitions", 100000);
        if (parts != null && parts.size() > maxPart) {
          throw new HCatException(ErrorType.ERROR_EXCEED_MAXPART, "total number of partitions is " + parts.size());
        }

        // populate partition info
        for (Partition ptn : parts){
          PartInfo partInfo = extractPartInfo(ptn.getSd(),ptn.getParameters());
View Full Code Here

   * @throws IOException the IO exception
   */
  public static OutputJobInfo getJobInfo(JobContext jobContext) throws IOException {
      String jobString = jobContext.getConfiguration().get(HCatConstants.HCAT_KEY_OUTPUT_INFO);
      if( jobString == null ) {
          throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED);
      }

      return (OutputJobInfo) HCatUtil.deserialize(jobString);
  }
View Full Code Here

          if (dynamicPartVals != null){
            // dynamic part vals specified
            List<String> dynamicPartKeys = jobInfo.getTableInfo().getDynamicPartitioningKeys();
            if (dynamicPartVals.size() != dynamicPartKeys.size()){
              throw new HCatException(ErrorType.ERROR_INVALID_PARTITION_VALUES,
                  "Unable to instantiate dynamic partitioning storage driver, mismatch between"
                  + " number of partition values obtained["+dynamicPartVals.size()
                  + "] and number of partition values required["+dynamicPartKeys.size()+"]");
            }
            for (int i = 0; i < dynamicPartKeys.size(); i++){
              partitionValues.put(dynamicPartKeys.get(i), dynamicPartVals.get(i));
            }

            // re-home location, now that we know the rest of the partvals
            Table table = jobInfo.getTable();
           
            List<String> partitionCols = new ArrayList<String>();
            for(FieldSchema schema : table.getPartitionKeys()) {
              partitionCols.add(schema.getName());
            }

            location = driver.getOutputLocation(jobContext,
                table.getSd().getLocation() , partitionCols,
                partitionValues,jobContext.getConfiguration().get(HCatConstants.HCAT_DYNAMIC_PTN_JOBID));
          }

          //Initialize the storage driver
          driver.setSchema(jobContext, jobInfo.getOutputSchema());
          driver.setPartitionValues(jobContext, partitionValues);
          driver.setOutputPath(jobContext, location);
         
//          HCatUtil.logMap(LOG,"Setting outputPath ["+location+"] for ",partitionValues);

          driver.initialize(jobContext, jobInfo.getStorerInfo().getProperties());

          return driver;
      } catch(Exception e) {
        if (e instanceof HCatException){
          throw (HCatException)e;
        }else{
          throw new HCatException(ErrorType.ERROR_INIT_STORAGE_DRIVER, e);
        }
      }
  }
View Full Code Here

        }
    }

    public void append(final HCatFieldSchema hfs) throws HCatException{
      if(hfs == null)
        throw new HCatException("Attempt to append null HCatFieldSchema in HCatSchema.");

      String fieldName = hfs.getName();
      if(fieldPositionMap.containsKey(fieldName))
        throw new HCatException("Attempt to append HCatFieldSchema with already " +
            "existing name: " + fieldName + ".");

      this.fieldSchemas.add(hfs);
      this.fieldNames.add(fieldName);
      this.fieldPositionMap.put(fieldName, this.size()-1);
View Full Code Here

    }

    public void remove(final HCatFieldSchema hcatFieldSchema) throws HCatException {

      if(!fieldSchemas.contains(hcatFieldSchema)){
        throw new HCatException("Attempt to delete a non-existent column from HCat Schema: "+ hcatFieldSchema);
      }

      fieldSchemas.remove(hcatFieldSchema);
      fieldPositionMap.remove(hcatFieldSchema);
      fieldNames.remove(hcatFieldSchema.getName());
View Full Code Here

    }

    private static void assertTypeInCategory(Type type, Category category) throws HCatException {
        Category typeCategory = Category.fromType(type);
        if (typeCategory != category){
            throw new HCatException("Type category mismatch. Expected "+category+" but type "+type+" in category "+typeCategory);
        }
    }
View Full Code Here

    }

    private static void assertTypeNotInCategory(Type type, Category category) throws HCatException {
        Category typeCategory = Category.fromType(type);
        if (typeCategory == category){
            throw new HCatException("Type category mismatch. Expected type "+type+" not in category "+category+" but was so.");
        }
    }
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.