Examples of HiveVarcharWritable


Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

        assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
        assertThat(inspector.copyObject(null), is(nullValue()));
        // Note: HiveVarchar.equals(Object) is not defined, but equals(HiveVarchar) is defined
        assertThat(inspector.getPrimitiveJavaObject(option).equals(value), is(true));
        assertThat(inspector.getPrimitiveJavaObject(null), is(nullValue()));
        assertThat(inspector.getPrimitiveWritableObject(option), is(new HiveVarcharWritable(value)));
        assertThat(inspector.getPrimitiveWritableObject(null), is(nullValue()));

        ValueDriver driver = serde.getDriver(inspector);
        StringOption copy = new StringOption();
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

    public HiveVarcharWritable getPrimitiveWritableObject(Object o) {
        StringOption object = (StringOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        HiveVarcharWritable writable = new HiveVarcharWritable();
        writable.getTextValue().set(object.get());
        return writable;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

      this.maxLength = maxLength;
    }

    @Override
    Object next(Object previous) throws IOException {
      HiveVarcharWritable result = null;
      if (previous == null) {
        result = new HiveVarcharWritable();
      } else {
        result = (HiveVarcharWritable) previous;
      }
      // Use the string reader implementation to populate the internal Text value
      Object textVal = super.next(result.getTextValue());
      if (textVal == null) {
        return null;
      }
      // result should now hold the value that was read in.
      // enforce varchar length
      result.enforceMaxLength(maxLength);
      return result;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

    HiveVarchar varchar = new HiveVarchar("Hello World", 32);
    Map<Text, OrcStruct> map = new HashMap<Text, OrcStruct>();
    OrcStruct value = OrcUtils.createOrcStruct(mapValueTypeInfo, new Text("age"), new IntWritable(24));
    map.put(new Text("Bob"), value);
    OrcStruct s = OrcUtils.createOrcStruct(typeInfo, new IntWritable(1024), new Text("Alice"),
        null, new HiveVarcharWritable(varchar), map);
    OrcWritable w = new OrcWritable();
    w.set(s);
   
    testInputOutputFn(ptype, s, w);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

      this.maxLength = maxLength;
    }

    @Override
    Object next(Object previous) throws IOException {
      HiveVarcharWritable result = null;
      if (previous == null) {
        result = new HiveVarcharWritable();
      } else {
        result = (HiveVarcharWritable) previous;
      }
      // Use the string reader implementation to populate the internal Text value
      Object textVal = super.next(result.getTextValue());
      if (textVal == null) {
        return null;
      }
      // result should now hold the value that was read in.
      // enforce varchar length
      result.enforceMaxLength(maxLength);
      return result;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

    case DataType.CHAR:
      HiveCharWritable hcw = new HiveCharWritable();
      hcw.readFields(in);
      return hcw.getHiveChar();
    case DataType.VARCHAR:
      HiveVarcharWritable hvw = new HiveVarcharWritable();
      hvw.readFields(in);
      return hvw.getHiveVarchar();
    case DataType.DECIMAL:
      HiveDecimalWritable hdw = new HiveDecimalWritable();
      hdw.readFields(in);
      return hdw.getHiveDecimal();
    case DataType.DATE:
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

      return;
    case DataType.CHAR:
      new HiveCharWritable((HiveChar)val).write(out);
      return;
    case DataType.VARCHAR:
      new HiveVarcharWritable((HiveVarchar)val).write(out);
      return;
    case DataType.DECIMAL:
      new HiveDecimalWritable((HiveDecimal)val).write(out);
      return;
    case DataType.DATE:
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

      writeEscaped(out, t.getBytes(), 0, t.getLength(), escaped, escapeChar,
          needsEscape);
      break;
    }
    case VARCHAR: {
      HiveVarcharWritable hc = ((HiveVarcharObjectInspector)oi).getPrimitiveWritableObject(o);
      Text t = hc.getTextValue();
      writeEscaped(out, t.getBytes(), 0, t.getLength(), escaped, escapeChar,
          needsEscape);
      break;
    }
    case BINARY: {
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

    // check input object's length, if it doesn't match
    // then output a new primitive with the correct params.
    if (o == null) {
      return null;
    }
    HiveVarcharWritable writable = ((HiveVarcharWritable)o);
    if (doesWritableMatchTypeParams(writable)) {
      return writable.getHiveVarchar();
    }
    return getPrimitiveWithParams(writable);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.io.HiveVarcharWritable

    // check input object's length, if it doesn't match
    // then output new writable with correct params.
    if (o == null) {
      return null;
    }
    HiveVarcharWritable writable = ((HiveVarcharWritable)o);
    if (doesWritableMatchTypeParams((HiveVarcharWritable)o)) {
      return writable;
    }

    return getWritableWithParams(writable);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.