public Text getStrippedValue() { // A lot of these methods could be done more efficiently by operating on the Text value // directly, rather than converting to HiveChar. return new Text(getHiveChar().getStrippedValue()); }
public void set(HiveCharWritable val, int maxLength) { set(val.getHiveChar(), maxLength); }
public void enforceMaxLength(int maxLength) { if (getCharacterLength()!=maxLength) set(getHiveChar(), maxLength); }
@Override public void assignObjectValue(Object val, int destIndex) throws HiveException { if (val == null) { assignNull(destIndex); } else { // We store CHAR type stripped of pads. HiveChar hiveChar; if (val instanceof HiveChar) { hiveChar = (HiveChar) val; } else { hiveChar = ((HiveCharWritable) val).getHiveChar(); } byte[] bytes = hiveChar.getStrippedValue().getBytes(); assignBytes(bytes, 0, bytes.length, destIndex); } } }.init(outputBatch, (BytesColumnVector) destCol);
private HiveChar getPrimitiveWithParams(HiveCharWritable val) { HiveChar hv = new HiveChar(); hv.setValue(val.getHiveChar(), getMaxLength()); return hv; }
@Override public void assignObjectValue(Object val, int destIndex) throws HiveException { if (val == null) { assignNull(destIndex); } else { // We store CHAR type stripped of pads. HiveChar hiveChar; if (val instanceof HiveChar) { hiveChar = (HiveChar) val; } else { hiveChar = ((HiveCharWritable) val).getHiveChar(); } byte[] bytes = hiveChar.getStrippedValue().getBytes(); assignBytes(bytes, 0, bytes.length, destIndex); } } }.init(outputBatch, (BytesColumnVector) destCol);
@Override public HiveChar getPrimitiveJavaObject(Object o) { // check input object's length, if it doesn't match // then output a new primitive with the correct params. if (o == null) { return null; } if ((o instanceof Text) || (o instanceof TimestampWritableV2) || (o instanceof HiveDecimalWritable) || (o instanceof DoubleWritable) || (o instanceof FloatWritable) || (o instanceof LongWritable) || (o instanceof IntWritable) || (o instanceof BooleanWritable)) { String str = o.toString(); return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength()); } HiveCharWritable writable = ((HiveCharWritable) o); if (doesWritableMatchTypeParams(writable)) { return writable.getHiveChar(); } return getPrimitiveWithParams(writable); }
@Override public HiveChar getPrimitiveJavaObject(Object o) { if (o == null) { return null; } HiveChar ret = ((LazyHiveChar) o).getWritableObject().getHiveChar(); if (!BaseCharUtils.doesPrimitiveMatchTypeParams( ret, (CharTypeInfo)typeInfo)) { HiveChar newValue = new HiveChar(ret, ((CharTypeInfo)typeInfo).getLength()); return newValue; } return ret; }
HiveCharWritable hcw = new HiveCharWritable(); hcw.readFields(in); return hcw.getHiveChar(); case DataType.VARCHAR: HiveVarcharWritable hvw = new HiveVarcharWritable();
string = hiveChar.getStrippedValue(); } else if (object instanceof HiveCharWritable) { HiveChar hiveChar = ((HiveCharWritable) object).getHiveChar(); string = hiveChar.getStrippedValue(); } else if (object instanceof HiveVarchar) {
throw new RuntimeException("Expected LazyHiveChar"); HiveChar value = ((LazyHiveChar) primitiveObject).getWritableObject().getHiveChar(); HiveChar expected = ((HiveCharWritable) expectedObject).getHiveChar();
hiveChar = (HiveChar) object; } else { hiveChar = ((HiveCharWritable) object).getHiveChar();
HiveChar expected = ((HiveCharWritable) object).getHiveChar(); if (!hiveChar.equals(expected)) { TestCase.fail("Char field mismatch (expected '" + expected + "' found '" + hiveChar + "')");
hiveChar = (HiveChar) object; } else { hiveChar = ((HiveCharWritable) object).getHiveChar();
HiveChar expected = ((HiveCharWritable) object).getHiveChar(); if (!hiveChar.equals(expected)) { TestCase.fail("Char field mismatch (expected '" + expected + "' found '" + hiveChar + "')");
if (((HiveCharWritable) ele).getHiveChar().getStrippedValue().isEmpty()) { return null;
if (writableCol != null) { bcv.isNull[rowIndex] = false; HiveChar colHiveChar = ((HiveCharWritable) writableCol).getHiveChar(); byte[] bytes = colHiveChar.getStrippedValue().getBytes();
case CHAR: HiveChar value = ((HiveCharWritable) object).getHiveChar(); serializeWrite.writeHiveChar(value);
case CHAR: HiveChar value = ((HiveCharWritable) object).getHiveChar(); serializeWrite.writeHiveChar(value);
assert ((CharTypeInfo) ti).getLength() >= hc.getHiveChar().getCharacterLength();