Package org.apache.hadoop.hive.common.type

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


        } 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) {
         partialMatchedRowsCount++;
         if (!alreadyLoggedPartialMatch) {
View Full Code Here


  public HiveVarchar getPrimitiveJavaObject(Object o) {
    if (o == null) {
      return null;
    }
    HiveVarchar value = (HiveVarchar)o;
    if (ParameterizedPrimitiveTypeUtils.doesPrimitiveMatchTypeParams(
        value, (VarcharTypeParams) typeParams)) {
      return value;
    }
    // value needs to be converted to match the type params (length, etc).
View Full Code Here

    }
    return getWritableWithParams((HiveVarchar)o);
  }

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

    return newValue;
  }

  @Override
  public Object set(Object o, HiveVarchar value) {
    HiveVarchar setValue = (HiveVarchar)o;
    if (ParameterizedPrimitiveTypeUtils.doesPrimitiveMatchTypeParams(
        value, (VarcharTypeParams) typeParams)) {
      setValue.setValue(value);
    } else {
      // Otherwise value may be too long, convert to appropriate value based on params
      setValue.setValue(value, getMaxLength());
    }

    return setValue;
  }
View Full Code Here

    return setValue;
  }

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

    return convertedValue;
  }

  @Override
  public Object create(HiveVarchar value) {
    HiveVarchar hc = new HiveVarchar(value, getMaxLength());
    return hc;
  }
View Full Code Here

    characterLength = -1;
    value.set(HiveBaseChar.enforceMaxLength(val, maxLength));
  }

  public HiveVarchar getHiveVarchar() {
    return new HiveVarchar(value.toString(), -1);
  }
View Full Code Here

    if (o == null) {
      return null;
    }

    HiveVarchar result = null;
    switch (oi.getPrimitiveCategory()) {
      case VARCHAR:
        result = ((HiveVarcharObjectInspector)oi).getPrimitiveJavaObject(o);
        break;
      default:
        // Is there a way to provide char length here?
        // It might actually be ok as long as there is an object inspector (with char length)
        // receiving this value.
        result = new HiveVarchar();
        result.setValue(getString(o, oi));
        break;
    }
    return result;
  }
View Full Code Here

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

    return getWritableWithParams(writable);
  }

  private HiveVarchar getPrimitiveWithParams(HiveVarcharWritable val) {
    HiveVarchar hv = new HiveVarchar();
    hv.setValue(val.getHiveVarchar(), getMaxLength());
    return hv;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.common.type.HiveVarchar

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.