Пример #1
0
  @Test
  public void basicTest() throws Exception {
    String tableName = "EDW.TEST_SITES";
    HiveTable hiveTable = new HiveTable(MetadataManager.getInstance(getTestConfig()), tableName);
    TableDesc tableDesc = MetadataManager.getInstance(getTestConfig()).getTableDesc(tableName);
    String snapshotPath = snapshotMgr.buildSnapshot(hiveTable, tableDesc).getResourcePath();

    snapshotMgr.wipeoutCache();

    SnapshotTable snapshot = snapshotMgr.getSnapshotTable(snapshotPath);

    // compare hive & snapshot
    TableReader hiveReader = hiveTable.getReader();
    TableReader snapshotReader = snapshot.getReader();

    while (true) {
      boolean hiveNext = hiveReader.next();
      boolean snapshotNext = snapshotReader.next();
      assertEquals(hiveNext, snapshotNext);

      if (hiveNext == false) break;

      String[] hiveRow = hiveReader.getRow();
      String[] snapshotRow = snapshotReader.getRow();
      assertArrayEquals(hiveRow, snapshotRow);
    }
  }
Пример #2
0
 @Before
 public void setup() throws Exception {
   createTestMetadata();
   snapshotMgr = SnapshotManager.getInstance(getTestConfig());
 }