Examples of VarcharTypeParams


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

            type.setKind(OrcProto.Type.Kind.STRING);
            break;
          case VARCHAR:
            // The varchar length needs to be written to file and should be available
            // from the object inspector
            VarcharTypeParams varcharParams = (VarcharTypeParams)
                ParameterizedPrimitiveTypeUtils.getTypeParamsFromPrimitiveObjectInspector(
                    (PrimitiveObjectInspector) treeWriter.inspector);
            if (varcharParams == null) {
              throw new IllegalArgumentException("No varchar length specified in ORC type");
            }
            type.setKind(Type.Kind.VARCHAR);
            type.setMaximumLength(varcharParams.getLength());
            break;
          case BINARY:
            type.setKind(OrcProto.Type.Kind.BINARY);
            break;
          case TIMESTAMP:
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

            return PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
          case STRING:
            return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
          case VARCHAR:
            // For varchar we need to retrieve the string length from the TypeInfo.
            VarcharTypeParams varcharParams = (VarcharTypeParams)
                ParameterizedPrimitiveTypeUtils.getTypeParamsFromTypeInfo(info);
            if (varcharParams == null) {
              throw new IllegalArgumentException("varchar type used without type params");
            }
            return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
View Full Code Here

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

      case VARCHAR:
        if (!type.hasMaximumLength()) {
          throw new UnsupportedOperationException(
              "Illegal use of varchar type without length in ORC type definition.");
        }
        VarcharTypeParams varcharParams = new VarcharTypeParams();
        varcharParams.setLength(type.getMaximumLength());
        return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
            PrimitiveObjectInspectorUtils.getTypeEntryFromTypeSpecs(
                PrimitiveCategory.VARCHAR, varcharParams));
      case TIMESTAMP:
        return PrimitiveObjectInspectorFactory.javaTimestampObjectInspector;
View Full Code Here

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

    ObjectInspector outputOI = null;
    switch (inputType) {
      case VARCHAR:
        // return type should have same length as the input.
        returnType = inputType;
        VarcharTypeParams varcharParams = new VarcharTypeParams();
        varcharParams.setLength(
            GenericUDFUtils.StringHelper.getFixedStringSizeForType(argumentOI));
        outputOI = PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
            argumentOI);
        break;
      default:
View Full Code Here

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

    public static int getFixedStringSizeForType(PrimitiveObjectInspector poi)
        throws UDFArgumentException {
      // TODO: we can support date, int, .. any types which would have a fixed length value
      switch (poi.getPrimitiveCategory()) {
        case VARCHAR:
          VarcharTypeParams varcharParams = null;
          varcharParams = (VarcharTypeParams) poi.getTypeParams();
          if (varcharParams == null || varcharParams.length < 0) {
            throw new UDFArgumentException("varchar type used without type params");
          }
          return varcharParams.length;
View Full Code Here

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

    ObjectInspector outputOI = null;
    switch (inputType) {
      case VARCHAR:
        // return type should have same length as the input.
        returnType = inputType;
        VarcharTypeParams varcharParams = new VarcharTypeParams();
        varcharParams.setLength(
            GenericUDFUtils.StringHelper.getFixedStringSizeForType(argumentOI));
        outputOI = PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
            argumentOI);
        break;
      default:
View Full Code Here

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

            type.setKind(OrcProto.Type.Kind.STRING);
            break;
          case VARCHAR:
            // The varchar length needs to be written to file and should be available
            // from the object inspector
            VarcharTypeParams varcharParams = (VarcharTypeParams)
                ParameterizedPrimitiveTypeUtils.getTypeParamsFromPrimitiveObjectInspector(
                    (PrimitiveObjectInspector) treeWriter.inspector);
            if (varcharParams == null) {
              throw new IllegalArgumentException("No varchar length specified in ORC type");
            }
            type.setKind(Type.Kind.VARCHAR);
            type.setMaximumLength(varcharParams.getLength());
            break;
          case BINARY:
            type.setKind(OrcProto.Type.Kind.BINARY);
            break;
          case TIMESTAMP:
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.