本文整理汇总了Java中org.apache.pig.data.DataType.BIGINTEGER属性的典型用法代码示例。如果您正苦于以下问题:Java DataType.BIGINTEGER属性的具体用法?Java DataType.BIGINTEGER怎么用?Java DataType.BIGINTEGER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.pig.data.DataType
的用法示例。
在下文中一共展示了DataType.BIGINTEGER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKettleType
private static String getKettleType( byte type ) {
switch ( type ) {
case DataType.BYTE:
case DataType.BYTEARRAY:
return "Binary";
case DataType.BOOLEAN:
return "Boolean";
case DataType.CHARARRAY:
case DataType.BIGCHARARRAY:
return "String";
case DataType.DATETIME:
return "Timestamp";
case DataType.INTEGER:
case DataType.LONG:
return "Integer";
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
return "BigNumber";
case DataType.FLOAT:
case DataType.DOUBLE:
return "Number";
default:
return "Binary"; // TODO is this right?
}
}
示例2: multiply
protected Number multiply(Number a, Number b, byte dataType) throws ExecException {
switch(dataType) {
case DataType.DOUBLE:
return Double.valueOf((Double) a * (Double) b);
case DataType.INTEGER:
return Integer.valueOf((Integer) a * (Integer) b);
case DataType.LONG:
return Long.valueOf((Long) a * (Long) b);
case DataType.FLOAT:
return Float.valueOf((Float) a * (Float) b);
case DataType.BIGINTEGER:
return ((BigInteger) a).multiply((BigInteger) b);
case DataType.BIGDECIMAL:
return ((BigDecimal) a).multiply((BigDecimal) b);
default:
throw new ExecException("called on unsupported Number class " + DataType.findTypeName(dataType));
}
}
示例3: add
protected Number add(Number a, Number b, byte dataType) throws ExecException {
switch(dataType) {
case DataType.DOUBLE:
return Double.valueOf((Double) a + (Double) b);
case DataType.INTEGER:
return Integer.valueOf((Integer) a + (Integer) b);
case DataType.LONG:
return Long.valueOf((Long) a + (Long) b);
case DataType.FLOAT:
return Float.valueOf((Float) a + (Float) b);
case DataType.BIGINTEGER:
return ((BigInteger) a).add((BigInteger) b);
case DataType.BIGDECIMAL:
return ((BigDecimal) a).add((BigDecimal) b);
default:
throw new ExecException("called on unsupported Number class " + DataType.findTypeName(dataType));
}
}
示例4: getTypedObject
private TypedObject getTypedObject(Object data, FieldDetail detail) throws ExecException {
if (data == null) {
return null;
}
byte type = detail.type;
switch (type) {
case DataType.BOOLEAN:
return TypeSystem.asTypedObject(DataType.toBoolean(data, type));
case DataType.INTEGER:
case DataType.LONG:
return TypeSystem.asTypedObject(DataType.toLong(data, type));
case DataType.FLOAT:
case DataType.DOUBLE:
return TypeSystem.asTypedObject(DataType.toDouble(data, type));
case DataType.DATETIME:
return TypeSystem.asTypedObject(new Timestamp(DataType.toDateTime(data, type).getMillis()));
case DataType.BYTE:
case DataType.BYTEARRAY:
case DataType.CHARARRAY:
return TypeSystem.asTypedObject(DataType.toString(data, type));
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
return TypeSystem.asTypedObject(DataType.toBigDecimal(data, type));
default:
//TUPLE, BAG, MAP, INTERNALMAP, GENERIC_WRITABLECOMPARABLE, ERROR, UNKNOWN, NULL and anything else
return null;
}
}
示例5: negate
private Object negate(Object o) throws ExecException {
byte dt = DataType.findType(o);
Object neg_o = null;
switch(dt) {
case DataType.BIGDECIMAL:
neg_o = ((BigDecimal)o).negate();
break;
case DataType.BIGINTEGER:
neg_o = ((BigInteger)o).negate();
break;
case DataType.FLOAT:
// Fall through.
case DataType.DOUBLE:
neg_o = new Double(-((Number)o).doubleValue());
break;
case DataType.INTEGER:
// Fall through.
case DataType.LONG:
neg_o = new Long(-((Number)o).longValue());
break;
default:
int errCode = 2106;
throw new ExecException("Unknown data type for object: " + o.getClass().getName(), errCode, PigException.BUG);
}
return neg_o;
}
示例6: findTypeFromNullableWritable
public static byte findTypeFromNullableWritable(PigNullableWritable o) throws ExecException {
if (o instanceof NullableBooleanWritable)
return DataType.BOOLEAN;
else if (o instanceof NullableBytesWritable)
return DataType.BYTEARRAY;
else if (o instanceof NullableText)
return DataType.CHARARRAY;
else if (o instanceof NullableFloatWritable)
return DataType.FLOAT;
else if (o instanceof NullableDoubleWritable)
return DataType.DOUBLE;
else if (o instanceof NullableIntWritable)
return DataType.INTEGER;
else if (o instanceof NullableLongWritable)
return DataType.LONG;
else if (o instanceof NullableBigIntegerWritable)
return DataType.BIGINTEGER;
else if (o instanceof NullableBigDecimalWritable)
return DataType.BIGDECIMAL;
else if (o instanceof NullableDateTimeWritable)
return DataType.DATETIME;
else if (o instanceof NullableBag)
return DataType.BAG;
else if (o instanceof NullableTuple)
return DataType.TUPLE;
else {
int errCode = 2044;
String msg = "Cannot find Pig type for " + o.getClass().getName();
throw new ExecException(msg, errCode, PigException.BUG);
}
}
示例7: getNextBoolean
@Override
public Result getNextBoolean() throws ExecException {
Result left, right;
switch (operandType) {
case DataType.BYTEARRAY:
case DataType.DOUBLE:
case DataType.FLOAT:
case DataType.BOOLEAN:
case DataType.INTEGER:
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
case DataType.LONG:
case DataType.DATETIME:
case DataType.CHARARRAY:
case DataType.TUPLE:
case DataType.MAP: {
Result r = accumChild(null, operandType);
if (r != null) {
return r;
}
left = lhs.getNext(operandType);
right = rhs.getNext(operandType);
return doComparison(left, right);
}
default: {
int errCode = 2067;
String msg = this.getClass().getSimpleName() + " does not know how to " +
"handle type: " + DataType.findTypeName(operandType);
throw new ExecException(msg, errCode, PigException.BUG);
}
}
}
示例8: getNextBoolean
@Override
public Result getNextBoolean() throws ExecException {
Result res = null;
switch(operandType) {
case DataType.BYTEARRAY:
case DataType.DOUBLE:
case DataType.INTEGER:
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
case DataType.CHARARRAY:
case DataType.BOOLEAN:
case DataType.LONG:
case DataType.FLOAT:
case DataType.DATETIME:
case DataType.MAP:
case DataType.TUPLE:
case DataType.BAG:
res = expr.getNext(operandType);
if(res.returnStatus == POStatus.STATUS_OK) {
if (res.result == null) {
res.result = true;
} else {
res.result = false;
}
illustratorMarkup(null, res.result, (Boolean) res.result ? 0 : 1);
}
return res;
default: {
int errCode = 2067;
String msg = this.getClass().getSimpleName() + " does not know how to " +
"handle type: " + DataType.findTypeName(operandType);
throw new ExecException(msg, errCode, PigException.BUG);
}
}
}
示例9: objToBytes
@SuppressWarnings("unchecked")
private byte[] objToBytes(Object o, byte type) throws IOException {
LoadStoreCaster caster = (LoadStoreCaster) caster_;
if (o == null) return null;
switch (type) {
case DataType.BYTEARRAY: return ((DataByteArray) o).get();
case DataType.BAG: return caster.toBytes((DataBag) o);
case DataType.CHARARRAY: return caster.toBytes((String) o);
case DataType.DOUBLE: return caster.toBytes((Double) o);
case DataType.FLOAT: return caster.toBytes((Float) o);
case DataType.INTEGER: return caster.toBytes((Integer) o);
case DataType.LONG: return caster.toBytes((Long) o);
case DataType.BIGINTEGER: return caster.toBytes((BigInteger) o);
case DataType.BIGDECIMAL: return caster.toBytes((BigDecimal) o);
case DataType.BOOLEAN: return caster.toBytes((Boolean) o);
case DataType.DATETIME: return caster.toBytes((DateTime) o);
// The type conversion here is unchecked.
// Relying on DataType.findType to do the right thing.
case DataType.MAP: return caster.toBytes((Map<String, Object>) o);
case DataType.NULL: return null;
case DataType.TUPLE: return caster.toBytes((Tuple) o);
case DataType.ERROR: throw new IOException("Unable to determine type of " + o.getClass());
default: throw new IOException("Unable to find a converter for tuple field " + o);
}
}
示例10: getNextBoolean
@Override
public Result getNextBoolean() throws ExecException {
Result left, right;
switch (operandType) {
case DataType.BYTEARRAY:
case DataType.DOUBLE:
case DataType.FLOAT:
case DataType.INTEGER:
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
case DataType.LONG:
case DataType.DATETIME:
case DataType.CHARARRAY: {
Result r = accumChild(null, operandType);
if (r != null) {
return r;
}
left = lhs.getNext(operandType);
right = rhs.getNext(operandType);
return doComparison(left, right);
}
default: {
int errCode = 2067;
String msg = this.getClass().getSimpleName() + " does not know how to " +
"handle type: " + DataType.findTypeName(operandType);
throw new ExecException(msg, errCode, PigException.BUG);
}
}
}
示例11: getNextBoolean
@Override
public Result getNextBoolean() throws ExecException {
Result left, right;
switch (operandType) {
case DataType.BYTEARRAY:
case DataType.DOUBLE:
case DataType.FLOAT:
case DataType.INTEGER:
case DataType.LONG:
case DataType.BIGINTEGER:
case DataType.BIGDECIMAL:
case DataType.DATETIME:
case DataType.CHARARRAY: {
Result r = accumChild(null, operandType);
if (r != null) {
return r;
}
left = lhs.getNext(operandType);
right = rhs.getNext(operandType);
return doComparison(left, right);
}
default: {
int errCode = 2067;
String msg = this.getClass().getSimpleName() + " does not know how to " +
"handle type: " + DataType.findTypeName(operandType);
throw new ExecException(msg, errCode, PigException.BUG);
}
}
}
示例12: generateData
Object generateData(byte type, String data) {
switch (type) {
case DataType.BOOLEAN:
if (data.equalsIgnoreCase("true")) {
return Boolean.TRUE;
} else if (data.equalsIgnoreCase("false")) {
return Boolean.FALSE;
} else {
return null;
}
case DataType.BYTEARRAY:
return new DataByteArray(data.getBytes());
case DataType.DOUBLE:
return Double.valueOf(data);
case DataType.FLOAT:
return Float.valueOf(data);
case DataType.INTEGER:
return Integer.valueOf(data);
case DataType.LONG:
return Long.valueOf(data);
case DataType.BIGINTEGER:
return new BigInteger(data);
case DataType.BIGDECIMAL:
return new BigDecimal(data);
case DataType.DATETIME:
return new DateTime(data);
case DataType.CHARARRAY:
return data;
default:
return null;
}
}
示例13: mod
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));
}
}
示例14: deserialize
private Object deserialize(FieldSchema fs, byte[] bytes, int startIndex, int endIndex) throws IOException {
//If null, return null;
if (WritableComparator.compareBytes(
bytes, startIndex, DELIMS.getNull().length,
DELIMS.getNull(), 0, DELIMS.getNull().length) == 0) {
return null;
}
if (fs.type == DataType.BAG) {
return deserializeBag(fs, bytes, startIndex + 3, endIndex - 2);
} else if (fs.type == DataType.TUPLE) {
return deserializeTuple(fs, bytes, startIndex + 3, endIndex - 2);
} else if (fs.type == DataType.MAP) {
return deserializeMap(bytes, startIndex + 3, endIndex - 2);
}
if (fs.type == DataType.CHARARRAY) {
return extractString(bytes, startIndex, endIndex, true);
} else if (fs.type == DataType.BYTEARRAY) {
return new DataByteArray(bytes, startIndex, endIndex+1);
}
//Can we do this faster?
String val = extractString(bytes, startIndex, endIndex, false);
if (fs.type == DataType.LONG) {
return Long.valueOf(val);
} else if (fs.type == DataType.INTEGER) {
return Integer.valueOf(val);
} else if (fs.type == DataType.FLOAT) {
return Float.valueOf(val);
} else if (fs.type == DataType.DOUBLE) {
return Double.valueOf(val);
} else if (fs.type == DataType.BOOLEAN) {
return Boolean.valueOf(val);
} else if (fs.type == DataType.DATETIME) {
return ToDate.extractDateTime(val);
} else if (fs.type == DataType.BIGINTEGER) {
return new BigInteger(val);
} else if (fs.type == DataType.BIGDECIMAL) {
return new BigDecimal(val);
} else {
throw new ExecException("Can't deserialize type: " + DataType.findTypeName(fs.type));
}
}
示例15: visit
@Override
public void visit(ModExpression binOp) throws FrontendException {
LogicalExpression lhs = binOp.getLhs() ;
LogicalExpression rhs = binOp.getRhs() ;
byte lhsType = lhs.getType() ;
byte rhsType = rhs.getType() ;
boolean error = false;
if (lhsType == DataType.INTEGER) {
if (rhsType == DataType.INTEGER) {
//do nothing
} else if (rhsType == DataType.LONG || rhsType == DataType.BIGINTEGER) {
insertCast(binOp, rhsType, binOp.getLhs());
} else {
error = true;
}
} else if (lhsType == DataType.LONG) {
if (rhsType == DataType.INTEGER) {
insertCast(binOp, lhsType, binOp.getRhs());
} else if (rhsType == DataType.BIGINTEGER) {
insertCast(binOp, rhsType, binOp.getLhs());
} else if (rhsType == DataType.LONG) {
//do nothing
} else {
error = true;
}
} else if (lhsType == DataType.BIGINTEGER) {
if (rhsType == DataType.INTEGER || rhsType == DataType.LONG) {
insertCast(binOp, lhsType, binOp.getRhs());
} else if (rhsType == DataType.BIGINTEGER) {
//do nothing
} else {
error = true;
}
} else if (lhsType == DataType.BYTEARRAY) {
if (rhsType == DataType.INTEGER || rhsType == DataType.LONG || rhsType == DataType.BIGINTEGER) {
insertCast(binOp, rhsType, binOp.getLhs());
} else {
error = true;
}
} else {
error = true;
}
if (error) {
int errCode = 1039;
String msg = generateIncompatibleTypesMessage(binOp);
msgCollector.collect(msg, MessageType.Error);
throw new TypeCheckerException(binOp, msg, errCode, PigException.INPUT) ;
}
}