Examples of HiveVarcharWritable


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

          break;
        case CHAR:
          returnValue = new HiveCharWritable();
          break;
        case VARCHAR:
          returnValue = new HiveVarcharWritable();
          break;
        default:
          throw new UDFArgumentException("Unexpected non-string type " + type);
      }
    }
View Full Code Here

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

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

    HiveVarchar vc = new HiveVarchar("32300.004747", 12);
    HiveVarcharWritable input = new HiveVarcharWritable(vc);
    VarcharTypeInfo inputTypeInfo = TypeInfoFactory.getVarcharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

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

    HiveVarchar vc = new HiveVarchar("32300.004747", 12);
    HiveVarcharWritable input = new HiveVarcharWritable(vc);
    VarcharTypeInfo inputTypeInfo = TypeInfoFactory.getVarcharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

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

    HiveVarchar vc = new HiveVarchar("32300.004747", 12);
    HiveVarcharWritable input = new HiveVarcharWritable(vc);
    VarcharTypeInfo inputTypeInfo = TypeInfoFactory.getVarcharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
View Full Code Here

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

  @Test
  public void testVarcharTimesInt() throws HiveException {
    GenericUDFOPMultiply udf = new GenericUDFOPMultiply();

    HiveVarcharWritable left = new HiveVarcharWritable();
    left.set("123");
    IntWritable right = new IntWritable(456);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector,
        PrimitiveObjectInspectorFactory.writableIntObjectInspector
    };
View Full Code Here

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

  private Writable getWritableValue(TypeInfo ti, byte[] value) {
    if (ti.equals(TypeInfoFactory.stringTypeInfo)) {
      return new Text(value);
    } else if (ti.equals(TypeInfoFactory.varcharTypeInfo)) {
      return new HiveVarcharWritable(
          new HiveVarchar(new Text(value).toString(), -1));
    } else if (ti.equals(TypeInfoFactory.binaryTypeInfo)) {
      return new BytesWritable(value);
    }
    return null;
View Full Code Here

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

        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);
        return t1.compareTo(t2);
      }
      case BINARY: {
        BytesWritable bw1 = ((BinaryObjectInspector) poi1).getPrimitiveWritableObject(o1);
        BytesWritable bw2 = ((BinaryObjectInspector) poi2).getPrimitiveWritableObject(o2);
View Full Code Here

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

  private HiveVarchar getPrimitiveWithParams(HiveVarchar val) {
    return new HiveVarchar(val, getMaxLength());
  }

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

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

      // If we disallow varchar in old-style UDFs and only allow GenericUDFs to be defined
      // with varchar arguments, then we might be able to enforce this properly.
      //if (typeParams == null) {
      //  throw new RuntimeException("varchar type used without type params");
      //}
      hc = new HiveVarcharWritable();
    }
View Full Code Here

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

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

    HiveVarcharWritable writable = ((HiveVarcharWritable)o);
    if (doesWritableMatchTypeParams(writable)) {
      return writable.getHiveVarchar();
    }
    return getPrimitiveWithParams(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.