Examples of HiveReadableRecord


Examples of com.facebook.hiveio.record.HiveReadableRecord

    expected[3] = ImmutableSet.of(15,16,11,12,13,14);
    expected[4] = ImmutableSet.of(17,18,13,14,15,16);

    for (int i = 0; i < rows; ++i) {
      assertTrue(records.hasNext());
      HiveReadableRecord record = records.next();
      assertEquals(expected[record.getInt(0)], record.getMap(1).keySet());
    }

    assertFalse(records.hasNext());
  }
View Full Code Here

Examples of com.facebook.hiveio.record.HiveReadableRecord

    Parsers.FORCE_PARSER.set(conf, parserClass);
    Iterator<HiveReadableRecord> records = HiveInput.readTable(inputDesc, conf).iterator();

    assertTrue(records.hasNext());

    HiveReadableRecord record = records.next();
    assertEquals(record.getClass(), recordClass);

    assertEquals(1, record.getByte(0));
    checkGetOthersThrows(record, 0, HiveType.BYTE);

    assertEquals(2, record.getShort(1));
    checkGetOthersThrows(record, 1, HiveType.SHORT);

    assertEquals(3, record.getInt(2));
    checkGetOthersThrows(record, 2, HiveType.INT);

    assertEquals(4, record.getLong(3));
    checkGetOthersThrows(record, 3, HiveType.LONG);

    assertEquals(true, record.getBoolean(4));
    checkGetOthersThrows(record, 4, HiveType.BOOLEAN);

    assertEquals(5.5, record.getFloat(5), DELTA);
    checkGetOthersThrows(record, 5, HiveType.FLOAT);

    assertEquals(6.6, record.getDouble(6), DELTA);
    checkGetOthersThrows(record, 6, HiveType.DOUBLE);

    assertEquals("foo", record.getString(7));
    checkGetOthersThrows(record, 7, HiveType.STRING);

    List<Long> list = record.getList(8);
    assertEquals(3, list.size());
    assertEquals(1, (long) list.get(0));
    assertEquals(2, (long) list.get(1));
    assertEquals(3, (long) list.get(2));

    Map<String, Float> map = record.getMap(9);
    assertEquals(2, map.size());
    assertEquals(1.1, map.get("foo"), DELTA);
    assertEquals(2.2, map.get("bar"), DELTA);

    assertFalse(records.hasNext());
View Full Code Here

Examples of com.facebook.hiveio.record.HiveReadableRecord

      throws IOException, InterruptedException {
    Iterator<HiveReadableRecord> records = HiveInput.readTable(inputDesc).iterator();

    assertTrue(records.hasNext());

    HiveReadableRecord record = records.next();
    assertEquals(Long.class, record.get(0).getClass());
    assertEquals(Double.class, record.get(1).getClass());
    assertEquals(1, record.getInt(0));
    assertEquals(1.1, record.getDouble(1));

    assertTrue(records.hasNext());
    record = records.next();
    assertEquals(2, record.getInt(0));
    assertEquals(2.2, record.getDouble(1));

    assertFalse(records.hasNext());
  }
View Full Code Here

Examples of com.facebook.hiveio.record.HiveReadableRecord

  {
    Iterator<HiveReadableRecord> readRecords = HiveInput.readTable(inputDesc).iterator();

    assertTrue(readRecords.hasNext());

    HiveReadableRecord record = readRecords.next();
    assertEquals(Long.class, record.get(0).getClass());
    assertEquals(Double.class, record.get(1).getClass());
    assertEquals(1, record.getInt(0));
    assertEquals(1.1, record.getDouble(1));

    assertTrue(readRecords.hasNext());
    record = readRecords.next();
    assertEquals(2, record.getInt(0));
    assertEquals(2.2, record.getDouble(1));

    assertFalse(readRecords.hasNext());
  }
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.