Package org.apache.hadoop.hive.serde2.columnar

Examples of org.apache.hadoop.hive.serde2.columnar.ColumnarStruct


  try {
      if (reader.nextKeyValue()) {

    BytesRefArrayWritable buff = reader.getCurrentValue();
    ColumnarStruct struct = readColumnarStruct(buff);

    tuple = readColumnarTuple(struct, reader.getSplitPath());
      }

  } catch (InterruptedException e) {
View Full Code Here


     *            BytesRefArrayWritable
     * @return ColumnarStruct
     */
    private ColumnarStruct readColumnarStruct(BytesRefArrayWritable buff) {
  // use ColumnarSerDe to deserialize row
  ColumnarStruct struct = null;
  try {
      struct = (ColumnarStruct) serde.deserialize(buff);
  } catch (SerDeException e) {
      LOG.error(e.toString(), e);
      throw new RuntimeException(e.toString(), e);
View Full Code Here

  @Override
  public HowlRecord convertToHowlRecord(WritableComparable ignored, Writable bytesRefArray) throws IOException {

    // Deserialize bytesRefArray into struct and then convert that struct to
    // HowlRecord.
    ColumnarStruct struct;
    try {
      struct = (ColumnarStruct)serde.deserialize(bytesRefArray);
    } catch (SerDeException e) {
      LOG.error(e.toString(), e);
      throw new IOException(e);
View Full Code Here

        try {
            if(reader.nextKeyValue()){

                BytesRefArrayWritable buff = reader.getCurrentValue();
                ColumnarStruct struct = readColumnarStruct(buff);

                if(applyColumnRead) tuple = readColumnarTuple(struct);
                else tuple = readWholeRow(struct);
            }
View Full Code Here

     * @param buff BytesRefArrayWritable
     * @return ColumnarStruct
     */
    private ColumnarStruct readColumnarStruct(BytesRefArrayWritable buff){
        //use ColumnarSerDe to deserialize row
        ColumnarStruct struct = null;
        try {
            struct = (ColumnarStruct)serde.deserialize(buff);
        } catch (SerDeException e) {
            LOG.error(e.toString(), e);
            throw new RuntimeException(e.toString(), e);
View Full Code Here

  @Override
  public HCatRecord convertToHCatRecord(WritableComparable ignored, Writable bytesRefArray) throws IOException {

    // Deserialize bytesRefArray into struct and then convert that struct to
    // HCatRecord.
    ColumnarStruct struct;
    try {
      struct = (ColumnarStruct)serde.deserialize(bytesRefArray);
    } catch (SerDeException e) {
      LOG.error(e.toString(), e);
      throw new IOException(e);
View Full Code Here

  @Override
  public Object getStructFieldData(Object data, StructField fieldRef) {
    if (data == null) {
      return null;
    }
    ColumnarStruct struct = (ColumnarStruct) data;
    MyField f = (MyField) fieldRef;

    int fieldID = f.getFieldID();
    assert (fieldID >= 0 && fieldID < fields.size());

    return struct.getField(fieldID, nullSequence);
  }
View Full Code Here

  @Override
  public List<Object> getStructFieldsDataAsList(Object data) {
    if (data == null) {
      return null;
    }
    ColumnarStruct struct = (ColumnarStruct) data;
    return struct.getFieldsAsList(nullSequence);
  }
View Full Code Here

        server.store("a", outputFile.getAbsolutePath(), storeString);

        //then
        Path outputPath = new Path(outputFile.getAbsolutePath()+"/part-m-00000.rc");

        ColumnarStruct struct = readRow(outputFile, outputPath, "f1 string,f2 string,f3 string");

        assertEquals(3, struct.getFieldsAsList().size());
        Object o =  struct.getField(0);
        assertEquals(LazyString.class, o.getClass());
        o =  struct.getField(1);
        assertEquals(LazyString.class, o.getClass());
        o =  struct.getField(2);
        assertEquals(LazyString.class, o.getClass());

    }
View Full Code Here

        server.store("b", outputFile.getAbsolutePath(), storeString);

        //then
        Path outputPath = new Path(outputFile.getAbsolutePath()+"/part-m-00000.rc");

        ColumnarStruct struct = readRow(outputFile, outputPath, "f1 string,f2 array<string>");

        assertEquals(2, struct.getFieldsAsList().size());
        Object o =  struct.getField(0);
        assertEquals(LazyString.class, o.getClass());
        o =  struct.getField(1);
        assertEquals(LazyArray.class, o.getClass());

        LazyArray arr = (LazyArray)o;
        List<Object> values = arr.getList();
        for(Object value : values) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.serde2.columnar.ColumnarStruct

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.