private void updatePartitionStorage(FactPartition part) throws LensException { try { if (getCubeMetastoreClient().factPartitionExists(fact, part, storageTable)) { part.getStorageTables().add(storageTable); part.setFound(true); } } catch (HiveException e) { log.warn("Hive exception while getting storage table partition", e); } }
private void updatePartitionStorage(FactPartition part) throws LensException { try { if (getCubeMetastoreClient().factPartitionExists(fact, part, storageTable)) { part.getStorageTables().add(storageTable); part.setFound(true); } } catch (HiveException e) { log.warn("Hive exception while getting storage table partition", e); } }
assertTrue(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timePartsNow, partSpec)); assertFalse(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timePartsBeforeTwoMonths, partSpec));
assertTrue(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timePartsNow, partSpec)); assertFalse(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timePartsBeforeTwoMonths, partSpec));
StoragePartitionDesc partSpec = new StoragePartitionDesc(cubeFact.getName(), timeParts, null, HOURLY); client.addPartition(partSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); String storageTableName = getFactOrDimtableStorageTableName(cubeFact.getName(), c1); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertFalse(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); assertEquals(client.getAllParts(storageTableName).size(), 0);
new StoragePartitionDesc(cubeFactWithParts.getName(), timeParts, partSpec, HOURLY); client.addPartition(sPartSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timeParts, partSpec)); assertTrue(client.latestPartitionExists(cubeFactWithParts.getName(), c1, getDatePartitionKey())); assertFalse(client.latestPartitionExists(cubeFactWithParts.getName(), c1, factPartColumns.get(0).getName())); assertFalse(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timeParts, partSpec)); assertFalse(client.latestPartitionExists(cubeFactWithParts.getName(), c1, getDatePartitionKey())); assertEquals(client.getAllParts(storageTableName).size(), 0);
partSpec = new StoragePartitionDesc(cubeFact.getName(), timeParts, null, HOURLY); client.addPartition(partSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); client.addPartition(partSpec2, c1, CubeTableType.FACT); assertEquals(client.getAllParts(storageTableName).size(), 1); assertTrue(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts2, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); parts = client.getPartitionsByFilter(storageTableName, "dt='latest'"); assertTrue(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts2, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); parts = client.getPartitionsByFilter(storageTableName, "dt='latest'"); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts2, emptyHashMap)); assertFalse(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey()));
new StoragePartitionDesc(cubeFactWithTwoStorages.getName(), timeParts, partSpec, HOURLY); client.addPartition(sPartSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFactWithTwoStorages.getName(), c1, HOURLY, timeParts, partSpec)); assertTrue(client.latestPartitionExists(cubeFactWithTwoStorages.getName(), c1, getDatePartitionKey())); String storageTableName = getFactOrDimtableStorageTableName(cubeFactWithTwoStorages.getName(), c1); new StoragePartitionDesc(cubeFactWithTwoStorages.getName(), timeParts, null, HOURLY); client.addPartition(sPartSpec2, c2, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFactWithTwoStorages.getName(), c2, HOURLY, timeParts, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFactWithTwoStorages.getName(), c2, getDatePartitionKey())); String storageTableName2 = getFactOrDimtableStorageTableName(cubeFactWithTwoStorages.getName(), c2); assertFalse(client.factPartitionExists(cubeFactWithTwoStorages.getName(), c1, HOURLY, timeParts, partSpec)); assertFalse(client.latestPartitionExists(cubeFactWithTwoStorages.getName(), c1, getDatePartitionKey())); assertEquals(client.getAllParts(storageTableName).size(), 0); assertFalse(client.factPartitionExists(cubeFactWithTwoStorages.getName(), c2, HOURLY, timeParts, emptyHashMap)); assertFalse(client.latestPartitionExists(cubeFactWithTwoStorages.getName(), c2, getDatePartitionKey())); assertEquals(client.getAllParts(storageTableName2).size(), 0);
StoragePartitionDesc partSpec = new StoragePartitionDesc(cubeFact.getName(), timeParts, null, HOURLY); client.addPartition(partSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, testDtPart.getName())); assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts, emptyHashMap)); assertFalse(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey())); assertFalse(client.latestPartitionExists(cubeFact.getName(), c1, testDtPart.getName()));
new StoragePartitionDesc(cubeFactWithParts.getName(), timeParts, partSpec, HOURLY); client.addPartition(sPartSpec, c1, CubeTableType.FACT); assertTrue(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timeParts, partSpec)); assertTrue(client.latestPartitionExists(cubeFactWithParts.getName(), c1, getDatePartitionKey())); assertTrue(client.latestPartitionExists(cubeFactWithParts.getName(), c1, testDtPart.getName())); assertFalse(client.factPartitionExists(cubeFactWithParts.getName(), c1, HOURLY, timeParts, partSpec)); assertFalse(client.latestPartitionExists(cubeFactWithParts.getName(), c1, testDtPart.getName())); assertFalse(client.latestPartitionExists(cubeFactWithParts.getName(), c1, getDatePartitionKey()));