Package org.apache.crunch

Examples of org.apache.crunch.CrunchRuntimeException


        // Hacking this for Hadoop1 and Hadoop2
        getConfiguration().set("mapreduce.job.cache.local.files", sparkFiles);
        getConfiguration().set("mapred.cache.localFiles", sparkFiles);
      }
    } catch (IOException e) {
      throw new CrunchRuntimeException(e);
    }
  }
View Full Code Here


        if (v1 != v2 && (v1 != null && !v1.equals(v2))) {
          try {
            w1[index].readFields(new DataInputStream(new ByteArrayInputStream(v1.getBytes())));
            w2[index].readFields(new DataInputStream(new ByteArrayInputStream(v2.getBytes())));
          } catch (IOException e) {
            throw new CrunchRuntimeException(e);
          }
          if (w1[index] instanceof WritableComparable && w2[index] instanceof WritableComparable) {
            int cmp = ((WritableComparable) w1[index]).compareTo((WritableComparable) w2[index]);
            if (cmp != 0) {
              return order * cmp;
 
View Full Code Here

        try {
          Class cls = Class.forName(className);
          w1[i] = WritableFactories.newInstance(cls);
          w2[i] = WritableFactories.newInstance(cls);
        } catch (Exception e) {
          throw new CrunchRuntimeException(e);
        }
        Order order = Order.valueOf(split[1]);
        columnOrders[i] = ColumnOrder.by(i + 1, order);
      }
    }
View Full Code Here

      binaryEncoder.flush();
      binaryDecoder = DecoderFactory.get()
          .binaryDecoder(byteOutStream.toByteArray(), binaryDecoder);
      return datumReader.read(target, binaryDecoder);
    } catch (Exception e) {
      throw new CrunchRuntimeException("Error while deep copying avro value " + source, e);
    }
  }
View Full Code Here

  protected T createNewInstance(Class<T> targetClass) {
    try {
      return targetClass.newInstance();
    } catch (InstantiationException e) {
      throw new CrunchRuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new CrunchRuntimeException(e);
    }
  }
View Full Code Here

    boolean exists = target.handleExisting(writeMode, ((PCollectionImpl) pcollection).getLastModifiedAt(),
        getConfiguration());
    if (exists && writeMode == Target.WriteMode.CHECKPOINT) {
      SourceTarget<?> st = target.asSourceTarget(pcollection.getPType());
      if (st == null) {
        throw new CrunchRuntimeException("Target " + target + " does not support checkpointing");
      } else {
        ((PCollectionImpl) pcollection).materializeAt(st);
      }
      return;
    } else if (writeMode != Target.WriteMode.APPEND && targetInCurrentRun(target)) {
      throw new CrunchRuntimeException("Target " + target + " is already written in current run." +
          " Use WriteMode.APPEND in order to write additional data to it.");
    }
    addOutput((PCollectionImpl<?>) pcollection, target);
  }
View Full Code Here

        if (writableClasses != null) {
          Writable w = WritableFactories.newInstance(writableClasses.get(i));
          try {
            w.readFields(new DataInputStream(new ByteArrayInputStream(values[i].getBytes())));
          } catch (IOException e) {
            throw new CrunchRuntimeException(e);
          }
          buf.append(w.toString());
        } else {
          buf.append(values[i].toString());
        }
View Full Code Here

      try {
        Class<?> keyClass = Class.forName(fields.get(2));
        Class<?> valueClass = Class.forName(fields.get(3));
        out.put(name, new OutputConfig(bundle, keyClass, valueClass));
      } catch (ClassNotFoundException e) {
        throw new CrunchRuntimeException(e);
      }
    }
    return out;
  }
View Full Code Here

  private static <W extends Writable> W create(Class<W> clazz, BytesWritable bytes) {
    W instance = (W) WritableFactories.newInstance(clazz);
    try {
      instance.readFields(new DataInputStream(new ByteArrayInputStream(bytes.getBytes())));
    } catch (IOException e) {
      throw new CrunchRuntimeException(e);
    }
    return instance;
  }
View Full Code Here

  @Override
  public void write(PCollection<?> collection, Target target, Target.WriteMode writeMode) {
    target.handleExisting(writeMode, -1, getConfiguration());
    if (writeMode != Target.WriteMode.APPEND && activeTargets.contains(target)) {
      throw new CrunchRuntimeException("Target " + target
          + " is already written in the current run."
          + " Use WriteMode.APPEND in order to write additional data to it.");
    }
    activeTargets.add(target);
    if (target instanceof PathTarget) {
View Full Code Here

TOP

Related Classes of org.apache.crunch.CrunchRuntimeException

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.