Examples of VarcharTypeParams


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

      returnHelper = new GenericUDFUtils.StringHelper(returnType);
      switch (returnType) {
        case STRING:
          return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
        case VARCHAR:
          VarcharTypeParams varcharParams = new VarcharTypeParams();
          varcharParams.setLength(returnLength);
          return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
              PrimitiveObjectInspectorUtils.getTypeEntryFromTypeSpecs(returnType, varcharParams));
        default:
          throw new UDFArgumentException("Unexpected CONCAT return type of " + returnType);
      }
View Full Code Here

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

    if (node.getChildCount() != 1) {
      throw new SemanticException("Bad params for type " + typeName);
    }

    try {
      VarcharTypeParams typeParams = new VarcharTypeParams();
      String lengthStr = node.getChild(0).getText();
      Integer length = Integer.valueOf(lengthStr);
      typeParams.setLength(length.intValue());
      typeParams.validateParams();
      return typeParams;
    } catch (SerDeException err) {
      throw new SemanticException(err);
    }
  }
View Full Code Here

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

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

    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

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

    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

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

      } 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

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

          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

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

    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

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

  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

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

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