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

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


        .startNot()
           .startOr()
             .isNull("x")
             .between("y", HiveDecimal.create(10), 20.0)
             .in("z", (byte)1, (short)2, (int)3)
             .nullSafeEquals("a", new HiveVarchar("stinger", 100))
           .end()
        .end()
        .build();
    assertEquals("leaf-0 = (IS_NULL x)\n" +
        "leaf-1 = (BETWEEN y 10 20.0)\n" +
View Full Code Here


        .startNot()
        .startOr()
        .isNull("x")
        .between("y", new BigDecimal(10), 20.0)
        .in("z", (byte)1, (short)2, (int)3)
        .nullSafeEquals("a", new HiveVarchar("stinger", 100))
        .end()
        .end()
        .build();
    assertEquals("leaf-0 = (IS_NULL x)\n" +
        "leaf-1 = (BETWEEN y 10 20.0)\n" +
View Full Code Here

  public static class Required extends Drill${entry.drillType}ObjectInspector {
    @Override
    public HiveVarchar getPrimitiveJavaObject(Object o) {
      VarCharHolder h = (VarCharHolder)o;
      String s = StringFunctionHelpers.toStringFromUTF8(h.start, h.end, h.buffer);
      return new HiveVarchar(s, HiveVarchar.MAX_VARCHAR_LENGTH);
    }
View Full Code Here

  public static class Optional extends Drill${entry.drillType}ObjectInspector {
    @Override
    public HiveVarchar getPrimitiveJavaObject(Object o) {
      NullableVarCharHolder h = (NullableVarCharHolder)o;
      String s = h.isSet == 0 ? null : StringFunctionHelpers.toStringFromUTF8(h.start, h.end, h.buffer);
      return new HiveVarchar(s, HiveVarchar.MAX_VARCHAR_LENGTH);
    }
View Full Code Here

          return PrimitiveObjectInspectorUtils.getTimestamp(input, (TimestampObjectInspector) argumentOI);
        case DECIMAL:
          // return type is a HiveVarchar
          HiveDecimal decimalValue =
              PrimitiveObjectInspectorUtils.getHiveDecimal(input, (HiveDecimalObjectInspector) argumentOI);
          return new HiveVarchar(decimalValue.toString(), HiveVarchar.MAX_VARCHAR_LENGTH);
      }

      throw new UnsupportedOperationException(String.format("Unexpected input type '%s' in Test UDF", inputType));
    }
View Full Code Here

        case CHAR:
          HiveChar hc = new HiveChar(t, ((CharTypeInfo) typeInfo).getLength());
          row.set(c, hc);
          break;
        case VARCHAR:
          HiveVarchar hv = new HiveVarchar(t, ((VarcharTypeInfo)typeInfo).getLength());
          row.set(c, hv);
          break;
        default:
          throw new SerDeException("Unsupported type " + typeInfo);
        }
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

    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

      }
     
      @Override
      public Object initValue(Object ignored) {
        return ((SettableHiveVarcharObjectInspector) this.objectInspector)
            .create(new HiveVarchar(StringUtils.EMPTY, -1));
      }
    }.init(fieldObjInspector);
  }
View Full Code Here

  public HiveVarchar getPrimitiveJavaObject(Object o) {
    if (o == null) {
      return null;
    }

    HiveVarchar ret = ((LazyHiveVarchar) o).getWritableObject().getHiveVarchar();
    if (!ParameterizedPrimitiveTypeUtils.doesPrimitiveMatchTypeParams(
        ret, (VarcharTypeParams) typeParams)) {
      HiveVarchar newValue = new HiveVarchar(ret, ((VarcharTypeParams) typeParams).length);
      return newValue;
    }
    return ret;
  }
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.