Examples of HiveChar


Examples of org.apache.hadoop.hive.common.type.HiveChar

  }

  public void testSet() throws Exception {
    HiveCharWritable hcw1 = new HiveCharWritable();

    HiveChar hc1 = new HiveChar("abcd", 8);
    hcw1.set(hc1);
    assertEquals("abcd    ", hcw1.toString());

    hcw1.set(hc1, 10);
    assertEquals("abcd      ", hcw1.toString());
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  @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),
    };
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  public void testBuilderComplexTypes() throws Exception {
    SearchArgument sarg =
        SearchArgument.FACTORY.newBuilder()
            .startAnd()
              .lessThan("x", new DateWritable(10))
              .lessThanEquals("y", new HiveChar("hi", 10))
              .equals("z", HiveDecimal.create("1.0"))
            .end()
            .build();
    assertEquals("leaf-0 = (LESS_THAN x 1970-01-11)\n" +
        "leaf-1 = (LESS_THAN_EQUALS y hi)\n" +
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  @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),
    };
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  @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),
    };
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  @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),
    };
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

      return null;
    }

    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();
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

    return getWritableWithParams(writable);
  }

  private HiveChar getPrimitiveWithParams(HiveCharWritable val) {
    HiveChar hv = new HiveChar();
    hv.setValue(val.getHiveChar(), getMaxLength());
    return hv;
  }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

    public Object convert(Object input) {
      switch (inputOI.getPrimitiveCategory()) {
      case BOOLEAN:
        return outputOI.set(hc,
            ((BooleanObjectInspector) inputOI).get(input) ?
                new HiveChar("TRUE", -1) : new HiveChar("FALSE", -1));
      default:
        return outputOI.set(hc, PrimitiveObjectInspectorUtils.getHiveChar(input, inputOI));
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveChar

  public HiveChar getPrimitiveJavaObject(Object o) {
    if (o == null) {
      return null;
    }
    HiveChar value = (HiveChar) o;
    if (BaseCharUtils.doesPrimitiveMatchTypeParams(value, (CharTypeInfo) typeInfo)) {
      return value;
    }
    // value needs to be converted to match type params
    return getPrimitiveWithParams(value);
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.