Examples of HiveChar


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

        CharTypeInfo cti = (CharTypeInfo)hcatFS.getTypeInfo();
        if(charVal.length() > cti.getLength()) {
          handleOutOfRangeValue(pigObj, hcatFS);
          return null;
        }
        return new HiveChar(charVal, cti.getLength());
      case VARCHAR:
        String varcharVal = (String)pigObj;
        VarcharTypeInfo vti = (VarcharTypeInfo)hcatFS.getTypeInfo();
        if(varcharVal.length() > vti.getLength()) {
          handleOutOfRangeValue(pigObj, hcatFS);
View Full Code Here

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

  public static HiveChar getHiveChar(Object o, PrimitiveObjectInspector oi) {
    if (o == null) {
      return null;
    }

    HiveChar result = null;
    switch (oi.getPrimitiveCategory()) {
      case CHAR:
        result = ((HiveCharObjectInspector) oi).getPrimitiveJavaObject(o);
        break;
      default:
        // No char length available, copy whole string value here.
        result = new HiveChar();
        result.setValue(getString(o, oi));
        break;
    }
    return result;
  }
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

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

    }
    return getWritableWithParams((HiveChar) o);
  }

  private HiveChar getPrimitiveWithParams(HiveChar val) {
    HiveChar hc = new HiveChar(val, getMaxLength());
    return hc;
  }
View Full Code Here

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

    hcw.set(val, getMaxLength());
    return hcw;
  }

  public Object set(Object o, HiveChar value) {
    HiveChar setValue = (HiveChar) o;
    setValue.setValue(value, getMaxLength());
    return setValue;
  }
View Full Code Here

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

    setValue.setValue(value, getMaxLength());
    return setValue;
  }

  public Object set(Object o, String value) {
    HiveChar setValue = (HiveChar) o;
    setValue.setValue(value, getMaxLength());
    return setValue;
  }
View Full Code Here

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

    setValue.setValue(value, getMaxLength());
    return setValue;
  }

  public Object create(HiveChar value) {
    HiveChar hc = new HiveChar(value, getMaxLength());
    return hc;
  }
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 ret = ((LazyHiveChar) o).getWritableObject().getHiveChar();
    if (!BaseCharUtils.doesPrimitiveMatchTypeParams(
        ret, (CharTypeInfo)typeInfo)) {
      HiveChar newValue = new HiveChar(ret, ((CharTypeInfo)typeInfo).getLength());
      return newValue;
    }
    return ret;
  }
View Full Code Here

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

import junit.framework.TestCase;
import org.apache.hadoop.hive.common.type.HiveChar;

public class TestHiveCharWritable extends TestCase {
  public void testConstructor() throws Exception {
    HiveCharWritable hcw1 = new HiveCharWritable(new HiveChar("abc", 5));
    assertEquals("abc  ", hcw1.toString());

    HiveCharWritable hcw2 = new HiveCharWritable(hcw1);
    assertEquals("abc  ", hcw2.toString());
  }
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.