Package org.apache.hadoop.hive.serde2.typeinfo

Examples of org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeParams


        if (isFunction) {
          ASTNode funcNameNode = (ASTNode)expr.getChild(0);
          switch (funcNameNode.getType()) {
            case HiveParser.TOK_VARCHAR:
              // Add type params
              VarcharTypeParams varcharTypeParams = new VarcharTypeParams();
              varcharTypeParams.length = Integer.valueOf((funcNameNode.getChild(0).getText()));
              if (genericUDF != null) {
                ((SettableUDF)genericUDF).setParams(varcharTypeParams);
              }
              break;
View Full Code Here


    switch (typeCategory) {
      case VARCHAR:
        int maxLength = getCommonLength(
            TypeInfoUtils.getCharacterLengthForType(a),
            TypeInfoUtils.getCharacterLengthForType(b));
        VarcharTypeParams varcharParams = new VarcharTypeParams();
        varcharParams.setLength(maxLength);
        // Generate type name so that we can retrieve the TypeInfo for that type.
        String typeName = PrimitiveObjectInspectorUtils
            .getTypeEntryFromTypeSpecs(typeCategory, varcharParams).toString();
        return TypeInfoFactory.getPrimitiveTypeInfo(typeName);
View Full Code Here

    switch (token) {
    case HiveParser.TOK_VARCHAR:
      PrimitiveCategory primitiveCategory = PrimitiveCategory.VARCHAR;
      typeName = TokenToTypeName.get(token);
      VarcharTypeParams varcharParams = ParseUtils.getVarcharParams(typeName, node);
      typeName = PrimitiveObjectInspectorUtils.getTypeEntryFromTypeSpecs(
          primitiveCategory, varcharParams).toString();
      break;
    default:
      typeName = TokenToTypeName.get(token);
View Full Code Here

      } else if (typeName.equals(serdeConstants.DECIMAL_TYPE_NAME)) {
        columnOIs.add(PrimitiveObjectInspectorFactory.javaHiveDecimalObjectInspector);
      else if (typeInfo instanceof PrimitiveTypeInfo
          &&
          ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory() == PrimitiveCategory.VARCHAR) {
        VarcharTypeParams varcharParams = (VarcharTypeParams)
            ParameterizedPrimitiveTypeUtils.getTypeParamsFromTypeInfo(typeInfo);
        columnOIs.add(PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
            (PrimitiveTypeInfo) typeInfo));
      } else {
         throw new SerDeException(getClass().getName()
View Full Code Here

          bd = new HiveDecimal(t);
          row.set(c, bd);
        } else if (typeInfo instanceof PrimitiveTypeInfo
            &&
            ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory() == PrimitiveCategory.VARCHAR) {
          VarcharTypeParams varcharParams = (VarcharTypeParams)
              ParameterizedPrimitiveTypeUtils.getTypeParamsFromTypeInfo(typeInfo);
          HiveVarchar hv = new HiveVarchar(t, varcharParams != null ? varcharParams.length : -1);
          row.set(c, hv);
        }
      } catch (RuntimeException e) {
View Full Code Here

    this.value = value;

    // If we have been provided with type params, then use them.
    // Otherwise determine character length and update type params/typeinfo accordingly.
    if (typeParams == null) {
      typeParams = new VarcharTypeParams();
      typeParams.length = this.value.getCharacterLength();
    }
    setTypeParams(typeParams);
    this.typeEntry = PrimitiveObjectInspectorUtils.getTypeEntryFromTypeSpecs(
        PrimitiveCategory.VARCHAR,
View Full Code Here

  protected int maxLength = -1;

  public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) {
    super(oi);
    VarcharTypeParams typeParams = (VarcharTypeParams)oi.getTypeParams();
    if (typeParams == null) {
      throw new RuntimeException("varchar type used without type params");
    }
    maxLength = typeParams.getLength();
    data = new HiveVarcharWritable();
  }
View Full Code Here

    }
    return v;
  }

  static int getVarcharMaxLength(TypeInfo type) {
    VarcharTypeParams typeParams = (VarcharTypeParams) ((PrimitiveTypeInfo) type).getTypeParams();
    if (typeParams != null ) {
      return typeParams.length;
    }
    return -1;
  }
View Full Code Here

  protected int maxLength = -1;

  LazyBinaryHiveVarchar(WritableHiveVarcharObjectInspector oi) {
    super(oi);
    // Check for params
    VarcharTypeParams typeParams = (VarcharTypeParams)oi.getTypeParams();
    if (typeParams == null) {
      throw new RuntimeException("varchar type used without type params");
    }
    maxLength = typeParams.length;
    data = new HiveVarcharWritable();
View Full Code Here

    public HiveVarcharConverter(PrimitiveObjectInspector inputOI,
        SettableHiveVarcharObjectInspector outputOI) {
      this.inputOI = inputOI;
      this.outputOI = outputOI;
      VarcharTypeParams typeParams = (VarcharTypeParams) outputOI.getTypeParams();

      // unfortunately we seem to get instances of varchar object inspectors without params
      // when an old-style UDF has an evaluate() method with varchar arguments.
      // 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.
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeParams

Copyright © 2018 www.massapicom. 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.