congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CubeMetastoreClient.getPartitionsByFilter
Code IndexAdd Tabnine to your IDE (free)

How to use
getPartitionsByFilter
method
in
org.apache.lens.cube.metadata.CubeMetastoreClient

Best Java code snippets using org.apache.lens.cube.metadata.CubeMetastoreClient.getPartitionsByFilter (Showing top 19 results out of 315)

origin: apache/lens

public Partition getPartitionByFilter(String storageTableName, String filter) throws HiveException {
 List<Partition> parts = getPartitionsByFilter(storageTableName, filter);
 if (parts.size() != 1) {
  throw new HiveException(
   "filter " + filter + " did not result in unique partition. Got " + parts.size() + "partitions");
 }
 return parts.iterator().next();
}
origin: org.apache.lens/lens-cube

public Partition getPartitionByFilter(String storageTableName, String filter) throws HiveException {
 List<Partition> parts = getPartitionsByFilter(storageTableName, filter);
 if (parts.size() != 1) {
  throw new HiveException(
   "filter " + filter + " did not result in unique partition. Got " + parts.size() + "partitions");
 }
 return parts.iterator().next();
}
origin: org.apache.lens/lens-cube

Partition getLatestPart(String storageTableName, String latestPartCol, Map<String, String> nonTimeParts)
 throws HiveException {
 List<Partition> latestParts =
  getPartitionsByFilter(storageTableName, StorageConstants.getLatestPartFilter(latestPartCol, nonTimeParts));
 if (latestParts != null && !latestParts.isEmpty()) {
  return latestParts.get(0);
 }
 return null;
}
origin: apache/lens

Partition getLatestPart(String storageTableName, String latestPartCol, Map<String, String> nonTimeParts)
 throws HiveException {
 List<Partition> latestParts =
  getPartitionsByFilter(storageTableName, StorageConstants.getLatestPartFilter(latestPartCol, nonTimeParts));
 if (latestParts != null && !latestParts.isEmpty()) {
  return latestParts.get(0);
 }
 return null;
}
origin: apache/lens

private void assertNoPartitionNamedLatest(String storageTableName, String... partCols) throws HiveException {
 for (String p : partCols) {
  assertEquals(client.getPartitionsByFilter(storageTableName, p + "='latest'").size(), 0);
 }
}
origin: apache/lens

for (String tableName : storageTables) {
 String filter = getFilter(msClient, tableName, values);
 partitions.put(filter, msClient.getPartitionsByFilter(tableName, filter));
 if (partitions.get(filter).size() > 1) {
  log.error("More than one partition with specified values, corresponding filter:" + filter);
origin: org.apache.lens/lens-cube

private void loadTimelinesFromAllPartitions(String storageTableName, String timeLineKey)
 throws HiveException, LensException {
 // Then add all existing partitions for batch addition in respective timelines.
 Table storageTable = getTable(storageTableName);
 List<String> timeParts = getTimePartColNamesOfTable(storageTable);
 List<FieldSchema> partCols = storageTable.getPartCols();
 for (Partition partition : getPartitionsByFilter(storageTableName, null)) {
  UpdatePeriod period = deduceUpdatePeriod(partition);
  List<String> values = partition.getValues();
  if (values.contains(StorageConstants.LATEST_PARTITION_VALUE)) {
   log.info("dropping latest partition from fact storage table: {}. Spec: {}", storageTableName,
    partition.getSpec());
   getClient().dropPartition(storageTableName, values, false);
   continue;
  }
  for (int i = 0; i < partCols.size(); i++) {
   if (timeParts.contains(partCols.get(i).getName())) {
    addForBatchAddition(timeLineKey, storageTableName, period, partCols.get(i).getName(), values.get(i));
   }
  }
 }
}
origin: apache/lens

@Override
public XPartitionList getAllPartitionsOfFactStorage(LensSessionHandle sessionid, String fact, String storageName,
 String filter) throws LensException {
 try (SessionContext ignored = new SessionContext(sessionid)) {
  checkFactStorage(sessionid, fact, storageName);
  CubeMetastoreClient client = getClient(sessionid);
  Set<String> storageTableNames = getAllTablesForStorage(sessionid, fact, storageName);
  List<Partition> parts = new ArrayList<>();
  List<String> timePartCols = new ArrayList<>();
  for (String storageTableName : storageTableNames) {
   parts.addAll(client.getPartitionsByFilter(storageTableName, filter));
   timePartCols.addAll(client.getTimePartColNamesOfTable(storageTableName));
  }
  return xpartitionListFromPartitionList(fact, parts, timePartCols);
 } catch (HiveException exc) {
  throw new LensException(exc);
 }
}
origin: apache/lens

private void loadTimelinesFromAllPartitions(String storageTableName, String timeLineKey)
 throws HiveException, LensException {
 // Then add all existing partitions for batch addition in respective timelines.
 Table storageTable = getTable(storageTableName);
 List<String> timeParts = getTimePartColNamesOfTable(storageTable);
 List<FieldSchema> partCols = storageTable.getPartCols();
 for (Partition partition : getPartitionsByFilter(storageTableName, null)) {
  UpdatePeriod period = deduceUpdatePeriod(partition);
  List<String> values = partition.getValues();
  if (values.contains(StorageConstants.LATEST_PARTITION_VALUE)) {
   log.info("dropping latest partition from fact storage table: {}. Spec: {}", storageTableName,
    partition.getSpec());
   getClient().dropPartition(storageTableName, values, false);
   continue;
  }
  for (int i = 0; i < partCols.size(); i++) {
   if (timeParts.contains(partCols.get(i).getName())) {
    addForBatchAddition(timeLineKey, storageTableName, period, partCols.get(i).getName(), values.get(i));
   }
  }
 }
}
origin: apache/lens

CubeMetastoreClient msClient = getClient(sessionid);
for (String tableName : storageTables) {
 partitions.addAll(msClient.getPartitionsByFilter(tableName, filter));
origin: apache/lens

private void assertLatestForRegions(String storageTableName, Map<String, Date> expectedLatestValues)
 throws HiveException, LensException {
 List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
 assertEquals(parts.size(), expectedLatestValues.size());
 for (Partition part : parts) {
  assertEquals(MetastoreUtil.getLatestTimeStampFromPartition(part, getDatePartitionKey()),
   TimePartition.of(HOURLY, expectedLatestValues.get(part.getSpec().get("region"))).getDate());
 }
}
origin: apache/lens

@Override
public XPartitionList getAllPartitionsOfDimTableStorage(
 LensSessionHandle sessionid, String dimTable, String storageName, String filter)
 throws LensException {
 try (SessionContext ignored = new SessionContext(sessionid)){
  checkDimTableStorage(sessionid, dimTable, storageName);
  CubeMetastoreClient client = getClient(sessionid);
  String storageTableName = MetastoreUtil.getFactOrDimtableStorageTableName(dimTable, storageName);
  List<Partition> partitions = client.getPartitionsByFilter(storageTableName, filter);
  List<String> timePartCols = client.getTimePartColNamesOfTable(storageTableName);
  return xpartitionListFromPartitionList(dimTable, partitions, timePartCols);
 } catch (HiveException exc) {
  throw new LensException(exc);
 }
}
origin: apache/lens

TimePartition[] values = new TimePartition[partCols.length];
for (int i = 0; i < partCols.length; i++) {
 List<Partition> parts = client.getPartitionsByFilter(storageTableName,
  StorageConstants.getLatestPartFilter(partCols[i], nonTimeParts));
 for (Partition part : parts) {
origin: apache/lens

String storageTableName = getFactOrDimtableStorageTableName(dimName, c1);
assertEquals(client.getAllParts(storageTableName).size(), 2);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(1, parts.size());
assertEquals(TextInputFormat.class.getCanonicalName(), parts.get(0).getInputFormatClass().getCanonicalName());
origin: apache/lens

assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey()));
String storageTableName = getFactOrDimtableStorageTableName(cubeFact.getName(), c1);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
assertEquals(client.getAllParts(storageTableName).size(), 1);
origin: apache/lens

String storageTableName = getFactOrDimtableStorageTableName(cubeFactWithParts.getName(), c1);
assertEquals(client.getAllParts(storageTableName).size(), 1);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
origin: apache/lens

assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey()));
String storageTableName = getFactOrDimtableStorageTableName(cubeFact.getName(), c1);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
parts = client.getPartitionsByFilter(storageTableName, testDtPart.getName() + "='latest'");
assertEquals(parts.size(), 0);
origin: apache/lens

String storageTableName = getFactOrDimtableStorageTableName(factName, c1);
assertEquals(client.getAllParts(storageTableName).size(), 1);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts2, emptyHashMap));
assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey()));
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
assertFalse(client.factPartitionExists(cubeFact.getName(), c1, HOURLY, timeParts2, emptyHashMap));
assertTrue(client.latestPartitionExists(cubeFact.getName(), c1, getDatePartitionKey()));
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 0);
origin: apache/lens

assertEquals(client.getAllParts(storageTableName).size(), 2);
List<Partition> parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 1);
Partition latestPart = parts.get(0);
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 1);
latestPart = parts.get(0);
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 1);
latestPart = parts.get(0);
assertTrue(client.dimPartitionExists(cubeDim.getName(), c1, timePartsNow));
assertTrue(client.latestPartitionExists(cubeDim.getName(), c1, getDatePartitionKey()));
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 1);
latestPart = parts.get(0);
assertFalse(client.dimPartitionExists(cubeDim.getName(), c1, timePartsNow));
assertTrue(client.latestPartitionExists(cubeDim.getName(), c1, getDatePartitionKey()));
parts = client.getPartitionsByFilter(storageTableName, "dt='latest'");
assertEquals(parts.size(), 1);
latestPart = parts.get(0);
org.apache.lens.cube.metadataCubeMetastoreClientgetPartitionsByFilter

Popular methods of CubeMetastoreClient

  • getInstance
    Get the instance of CubeMetastoreClient corresponding to HiveConf
  • getHiveTable
    Get the hive Table corresponding to the name
  • createCubeDimensionTable
  • createStorage
  • getConf
    Get cube metastore client conf
  • addPartitions
    batch addition
  • alterCube
  • alterCubeDimensionTable
  • alterCubeFactTable
  • alterDimension
    Alter dimension specified by the dimension name to new definition
  • alterSegmentation
  • createCube
    Create cube in metastore defined by Cube or DerivedCube object
  • alterSegmentation,
  • createCube,
  • createDimension,
  • createSegmentation,
  • dropSegmentation,
  • dropStorageFromDim,
  • dropStorageFromFact,
  • getAllCubes,
  • getAllDimensionTables,
  • getAllFacts

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • setScale (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now