Examples of HiveChar


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

    }
    return getWritableWithParams((HiveChar) o);
  }

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

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

  public Object set(Object o, HiveChar value) {
    if (BaseCharUtils.doesPrimitiveMatchTypeParams(value,
        (CharTypeInfo) typeInfo)) {
      return value;
    } else {
      return new HiveChar(value, getMaxLength());
    }
  }
View Full Code Here

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

      return new HiveChar(value, getMaxLength());
    }
  }

  public Object set(Object o, String value) {
    return new HiveChar(value, getMaxLength());
  }
View Full Code Here

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

  public Object set(Object o, String value) {
    return new HiveChar(value, getMaxLength());
  }

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

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

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

    HiveChar ret = ((LazyHiveChar) o).getWritableObject().getHiveChar();
    if (!BaseCharUtils.doesPrimitiveMatchTypeParams(
        ret, (CharTypeInfo)typeInfo)) {
      HiveChar newValue = new HiveChar(ret, ((CharTypeInfo)typeInfo).getLength());
      return newValue;
    }
    return ret;
  }
View Full Code Here

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

      } catch (Exception ex) {
        throw new AvroSerdeException("Failed to obtain maxLength value for char field from file schema: " + fileSchema, ex);
      }

      String str = datum.toString();
      HiveChar hc = new HiveChar(str, maxLength);
      return hc;
    case VARCHAR:
      if (fileSchema == null) {
        throw new AvroSerdeException("File schema is missing for varchar field. Reader schema is " + columnType);
      }
View Full Code Here

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

        case DECIMAL:
          HiveDecimal bd = HiveDecimal.create(t);
          row.set(c, bd);
          break;
        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);
View Full Code Here

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

    i2.add(ii2);
    c1_1.add(i2);
    c1.add(c1_1);
    rlist.add(c1);
    rlist.add(HiveDecimal.create(new BigDecimal("123.45")));//prec 5, scale 2
    rlist.add(new HiveChar("hive_char", 10));
    rlist.add(new HiveVarchar("hive_varchar", 20));
    rlist.add(Date.valueOf("2014-01-07"));
    rlist.add(new Timestamp(System.currentTimeMillis()));

    List<Object> nlist = new ArrayList<Object>(13);
View Full Code Here

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

      }
    case DECIMAL:
      HiveDecimal dec = (HiveDecimal)fieldOI.getPrimitiveJavaObject(structFieldData);
      return AvroSerdeUtils.getBufferFromDecimal(dec, ((DecimalTypeInfo)typeInfo).scale());
    case CHAR:
      HiveChar ch = (HiveChar)fieldOI.getPrimitiveJavaObject(structFieldData);
      return ch.getStrippedValue();
    case VARCHAR:
      HiveVarchar vc = (HiveVarchar)fieldOI.getPrimitiveJavaObject(structFieldData);
      return vc.getValue();
    case DATE:
      Date date = ((DateObjectInspector)fieldOI).getPrimitiveJavaObject(structFieldData);
View Full Code Here

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

    output.close();
    m.put(cfBytes, "timestamp".getBytes(), output.toByteArray());

    // char
    baos.reset();
    HiveChar charValue = new HiveChar("char", 4);
    JavaHiveCharObjectInspector charOI = (JavaHiveCharObjectInspector) PrimitiveObjectInspectorFactory
        .getPrimitiveJavaObjectInspector(new CharTypeInfo(4));
    LazyUtils.writePrimitiveUTF8(baos, charOI.create(charValue), charOI, false, (byte) 0, null);
    m.put(cfBytes, "char".getBytes(), baos.toByteArray());
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.