Examples of HiveCharWritable


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

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

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

        assertThat(inspector.copyObject(option), is((Object) option));
        assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
        assertThat(inspector.copyObject(null), is(nullValue()));
        assertThat(inspector.getPrimitiveJavaObject(option), is(value));
        assertThat(inspector.getPrimitiveJavaObject(null), is(nullValue()));
        assertThat(inspector.getPrimitiveWritableObject(option), is(new HiveCharWritable(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.HiveCharWritable

      this.maxLength = maxLength;
    }

    @Override
    Object next(Object previous) throws IOException {
      HiveCharWritable result = null;
      if (previous == null) {
        result = new HiveCharWritable();
      } else {
        result = (HiveCharWritable) 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 char length
      result.enforceMaxLength(maxLength);
      return result;
    }
View Full Code Here

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

      for (int i = 0; i < sz; i++) {
        list.add(readDatum(in));
      }
      return list;
    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:
View Full Code Here

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

    case DataType.NULL:
      //for NULL we just write out the type
      return;
    case DataType.CHAR:
      new HiveCharWritable((HiveChar)val).write(out);
      return;
    case DataType.VARCHAR:
      new HiveVarcharWritable((HiveVarchar)val).write(out);
      return;
    case DataType.DECIMAL:
View Full Code Here

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

      writeEscaped(out, t.getBytes(), 0, t.getLength(), escaped, escapeChar,
          needsEscape);
      break;
    }
    case CHAR: {
      HiveCharWritable hc = ((HiveCharObjectInspector) oi).getPrimitiveWritableObject(o);
      Text t = hc.getPaddedValue();
      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.HiveCharWritable

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

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

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

    return getWritableWithParams(writable);
View Full Code Here

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

    hv.setValue(val.getHiveChar(), getMaxLength());
    return hv;
  }

  private HiveCharWritable getWritableWithParams(HiveCharWritable val) {
    HiveCharWritable newValue = new HiveCharWritable();
    newValue.set(val, getMaxLength());
    return newValue;
  }
View Full Code Here

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

  public Object copyObject(Object o) {
    if (o == null) {
      return null;
    }
    HiveCharWritable writable = (HiveCharWritable) o;
    if (doesWritableMatchTypeParams((HiveCharWritable) o)) {
      return new HiveCharWritable(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.