Examples of HiveCharWritable


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

  @Test
  public void testChar() throws HiveException {
    GenericUDFFloor udf = new GenericUDFFloor();

    HiveChar vc = new HiveChar("32300.004747", 12);
    HiveCharWritable input = new HiveCharWritable(vc);
    CharTypeInfo inputTypeInfo = TypeInfoFactory.getCharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
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

      switch (type) {
        case STRING:
          returnValue = new Text();
          break;
        case CHAR:
          returnValue = new HiveCharWritable();
          break;
        case VARCHAR:
          returnValue = new HiveVarcharWritable();
          break;
        default:
View Full Code Here

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

  @Test
  public void testChar() throws HiveException {
    GenericUDFOPNegative udf = new GenericUDFOPNegative();

    HiveChar vc = new HiveChar("32300.004747", 12);
    HiveCharWritable input = new HiveCharWritable(vc);
    CharTypeInfo inputTypeInfo = TypeInfoFactory.getCharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

  @Test
  public void testChar() throws HiveException {
    GenericUDFCeil udf = new GenericUDFCeil();

    HiveChar vc = new HiveChar("-32300.004747", 12);
    HiveCharWritable input = new HiveCharWritable(vc);
    CharTypeInfo inputTypeInfo = TypeInfoFactory.getCharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

  @Test
  public void testChar() throws HiveException {
    GenericUDFOPPositive udf = new GenericUDFOPPositive();

    HiveChar vc = new HiveChar("32300.004747", 12);
    HiveCharWritable input = new HiveCharWritable(vc);
    CharTypeInfo inputTypeInfo = TypeInfoFactory.getCharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

          return s1 == null ? (s2 == null ? 0 : -1) : (s2 == null ? 1 : s1
              .compareTo(s2));
        }
      }
      case CHAR: {
        HiveCharWritable t1 = ((HiveCharObjectInspector)poi1).getPrimitiveWritableObject(o1);
        HiveCharWritable t2 = ((HiveCharObjectInspector)poi2).getPrimitiveWritableObject(o2);
        return t1.compareTo(t2);
      }
      case VARCHAR: {
        HiveVarcharWritable t1 = ((HiveVarcharObjectInspector)poi1).getPrimitiveWritableObject(o1);
        HiveVarcharWritable t2 = ((HiveVarcharObjectInspector)poi2).getPrimitiveWritableObject(o2);
View Full Code Here

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

    if (o instanceof Text) {
      String str = ((Text)o).toString();
      return new HiveChar(str, ((CharTypeInfo)typeInfo).getLength());
    }

    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

      return null;
    }

    if (o instanceof Text) {
      String str = ((Text)o).toString();
      HiveCharWritable hcw = new HiveCharWritable();
      hcw.set(str, ((CharTypeInfo)typeInfo).getLength());
      return hcw;
    }

    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
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.