org.apache.pig.backend.executionengine.ExecException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.apache.pig.backend.executionengine.ExecException.<init>()方法的一些代码示例,展示了ExecException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecException.<init>()方法的具体详情如下:
包路径:org.apache.pig.backend.executionengine.ExecException
类名称:ExecException
方法名:<init>

ExecException.<init>介绍

[英]Create a new ExecException with null as the error message.
[中]创建一个新的ExecException,错误消息为null。

代码示例

代码示例来源:origin: apache/hive

@Override
public Tuple getNext() throws IOException {
 try {
  HCatRecord hr = (HCatRecord) (reader.nextKeyValue() ? reader.getCurrentValue() : null);
  Tuple t = PigHCatUtil.transformToTuple(hr, outputSchema);
  // TODO : we were discussing an iter interface, and also a LazyTuple
  // change this when plans for that solidifies.
  return t;
 } catch (ExecException e) {
  int errCode = 6018;
  String errMsg = "Error while reading input";
  throw new ExecException(errMsg, errCode,
   PigException.REMOTE_ENVIRONMENT, e);
 } catch (Exception eOther) {
  int errCode = 6018;
  String errMsg = "Error converting read value to tuple";
  throw new ExecException(errMsg, errCode,
   PigException.REMOTE_ENVIRONMENT, eOther);
 }
}

代码示例来源:origin: apache/phoenix

@Override
public Tuple getNext() throws IOException {
  try {
    if(!reader.nextKeyValue()) {
      return null; 
     }
    final PhoenixRecordWritable record = reader.getCurrentValue();
    if(record == null) {
      return null;
    }
    final Tuple tuple = TypeUtil.transformToTuple(record, schema.getFields());
    return tuple;
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    int errCode = 6018;
    final String errMsg = "Error while reading input";
    throw new ExecException(errMsg, errCode,PigException.REMOTE_ENVIRONMENT, e);
  } 
}

代码示例来源:origin: org.apache.pig/pig

/**
 * TextLoader does not support conversion to Bag
 * @throws IOException if the value cannot be cast.
 */
public DataBag bytesToBag(byte[] b, ResourceFieldSchema schema) throws IOException {
  int errCode = 2109;
  String msg = "TextLoader does not support conversion to Bag.";
  throw new ExecException(msg, errCode, PigException.BUG);
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(Double d) throws IOException {
  int errCode = 2109;
  String msg = "TextLoader does not support conversion from Double.";
  throw new ExecException(msg, errCode, PigException.BUG);
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(Float f) throws IOException {
  int errCode = 2109;
  String msg = "TextLoader does not support conversion from Float.";
  throw new ExecException(msg, errCode, PigException.BUG);
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(Long l) throws IOException {
  int errCode = 2109;
  String msg = "TextLoader does not support conversion from Long.";
  throw new ExecException(msg, errCode, PigException.BUG);
}

代码示例来源:origin: org.apache.pig/pig

/**
 * NOT IMPLEMENTED
 */
@Override
public Tuple bytesToTuple(byte[] b, ResourceFieldSchema fieldSchema) throws IOException {
  throw new ExecException("Can't generate a Tuple from byte[]");
}

代码示例来源:origin: org.apache.pig/pig

private Tuple getAggResultTuple(Object result) throws ExecException {
  try {
    return (Tuple) result;
  } catch (ClassCastException ex) {
    throw new ExecException("Intermediate Algebraic "
        + "functions must implement EvalFunc<Tuple>");
  }
}

代码示例来源:origin: org.apache.pig/pig

/**
 * Not implemented!
 */
@Override
public BigDecimal bytesToBigDecimal(byte[] b) throws IOException {
  throw new ExecException("Can't generate a BigInteger from byte[]");
}

代码示例来源:origin: org.apache.pig/pig

private void freeMemory() throws ExecException {
  if (rawInputMap != null && !rawInputMap.isEmpty()) {
    throw new ExecException("Illegal state. Trying to free up partial aggregation maps when they are not empty");
  }
  // Free up the maps for garbage collection
  rawInputMap = null;
  processedInputMap = null;
}

代码示例来源:origin: org.apache.pig/pig

public static byte findTypeFromClassName(String className) throws ExecException {
  if (classToTypeMap.containsKey(className)) {
    return classToTypeMap.get(className);
  } else {
    throw new ExecException("Unable to map " + className + " to known types." + Arrays.toString(classToTypeMap.keySet().toArray()));
  }
}

代码示例来源:origin: org.apache.pig/pig

@Override
  public Long exec(Tuple input) throws IOException {
    try {
      return sum(input);
    } catch (Exception ee) {
      int errCode = 2106;
      String msg = "Error while computing count in " + this.getClass().getSimpleName();
      throw new ExecException(msg, errCode, PigException.BUG, ee);
    }
  }
}

代码示例来源:origin: org.apache.pig/pig

@Override
  public BigDecimal exec(Tuple input) throws IOException {
    try {
      return doTupleWork(input, this);
    } catch (ExecException ee) {
      throw ee;
    } catch (Exception e) {
      int errCode = 2106;
      throw new ExecException("Error executing function on BigDecimal", errCode, PigException.BUG, e);
    }
  }
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(DateTime dt) throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(baos);
  try {
    DataReaderWriter.writeDatum(dos, dt);
  } catch (Exception ee) {
    int errCode = 2105;
    String msg = "Error while converting datetime to bytes.";
    throw new ExecException(msg, errCode, PigException.BUG, ee);
  }
  return baos.toByteArray();
}

代码示例来源:origin: org.apache.pig/pig

protected Number mod(Number a, Number b, byte dataType) throws ExecException {
  switch(dataType) {
  case DataType.INTEGER:
    return Integer.valueOf((Integer) a % (Integer) b);
  case DataType.LONG:
    return Long.valueOf((Long) a % (Long) b);
  case DataType.BIGINTEGER:
    return ((BigInteger)a).mod((BigInteger)b);
  default:
    throw new ExecException("called on unsupported Number class " + DataType.findTypeName(dataType));
  }
}

代码示例来源:origin: org.apache.pig/pig

@Override
  public Float exec(Tuple input) throws IOException {
    try {
      return doTupleWork(input, this);
    } catch (ExecException ee) {
      throw ee;
    } catch (Exception e) {
      int errCode = 2106;
      throw new ExecException("Error executing function on Floats", errCode, PigException.BUG, e);
    }
  }
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(Double d) throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(baos);
  try {
    DataReaderWriter.writeDatum(dos, d);
  } catch (Exception ee) {
    int errCode = 2105;
    String msg = "Error while converting double to bytes.";
    throw new ExecException(msg, errCode, PigException.BUG, ee);
  }
  return baos.toByteArray();
}

代码示例来源:origin: org.apache.pig/pig

public byte[] toBytes(Float f) throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(baos);
  try {
    DataReaderWriter.writeDatum(dos, f);
  } catch (Exception ee) {
    int errCode = 2105;
    String msg = "Error while converting float to bytes.";
    throw new ExecException(msg, errCode, PigException.BUG, ee);
  }
  return baos.toByteArray();
}

代码示例来源:origin: org.apache.pig/pig

@Override
  public Tuple exec(Tuple input) throws IOException {
    try {
      return tfact.newTuple(doTupleWork(input, this));
    } catch (ExecException ee) {
      throw ee;
    } catch (Exception e) {
      int errCode = 2106;
      throw new ExecException("Error executing function on Doubles", errCode, PigException.BUG, e);
    }
  }
}

代码示例来源:origin: org.apache.pig/pig

@Override
  public Tuple exec(Tuple input) throws IOException {
    try {
      return tfact.newTuple(doTupleWork(input, this));
    } catch (ExecException ee) {
      throw ee;
    } catch (Exception e) {
      int errCode = 2106;
      throw new ExecException("Error executing function on BigDecimal", errCode, PigException.BUG, e);
    }
  }
}

相关文章

微信公众号

最新文章

更多