/** * Get the hive {@link Table} corresponding to the name * * @param tableName table name * @return {@link Table} object corresponding to the name * @throws LensException */ public Table getHiveTable(String tableName) throws LensException { return getTable(tableName); }
/** * Get the hive {@link Table} corresponding to the name * * @param tableName table name * @return {@link Table} object corresponding to the name * @throws LensException */ public Table getHiveTable(String tableName) throws LensException { return getTable(tableName); }
/** * Is the table name passed a virtual fact table? * * @param virtualTableName table name * @return true if it is virtual fact, false otherwise * @throws HiveException */ public boolean isVirtualFactTable(String virtualTableName) throws LensException { Table tbl = getTable(virtualTableName); return isVirtualFactTable(tbl); }
/** * Is the table name passed a dimension table? * * @param tableName table name * @return true if it is cube dimension, false otherwise * @throws LensException */ public boolean isDimensionTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isDimensionTable(tbl); }
/** * Is the table name passed a fact table? * * @param tableName table name * @return true if it is cube fact, false otherwise * @throws HiveException */ public boolean isFactTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isFactTable(tbl); }
/** * Is the table name passed a fact table? * * @param tableName table name * @return true if it is cube fact, false otherwise * @throws HiveException */ public boolean isFactTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isFactTable(tbl); }
/** * Is the table name passed a virtual fact table? * * @param virtualTableName table name * @return true if it is virtual fact, false otherwise * @throws HiveException */ public boolean isVirtualFactTable(String virtualTableName) throws LensException { Table tbl = getTable(virtualTableName); return isVirtualFactTable(tbl); }
/** * Is the table name passed a dimension table? * * @param tableName table name * @return true if it is cube dimension, false otherwise * @throws LensException */ public boolean isDimensionTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isDimensionTable(tbl); }
private List<Date> getStorageTimes(String storageTableName, String timeKey) throws LensException { Date now = new Date(); List<Date> storageTimes = new ArrayList<>(); String property; property = getTable(storageTableName).getProperty(timeKey); if (StringUtils.isNotBlank(property)) { for (String timeStr : property.split("\\s*,\\s*")) { storageTimes.add(resolveDate(timeStr, now)); } } return storageTimes; }
private List<Date> getStorageTimes(String storageTableName, String timeKey) throws LensException { Date now = new Date(); List<Date> storageTimes = new ArrayList<>(); String property; property = getTable(storageTableName).getProperty(timeKey); if (StringUtils.isNotBlank(property)) { for (String timeStr : property.split("\\s*,\\s*")) { storageTimes.add(resolveDate(timeStr, now)); } } return storageTimes; }
private Collection<String> getAllHiveTableNames() throws HiveException, LensException { if (!allTablesPopulated) { List<String> allTables = getClient().getAllTables(); for (String tblName : allTables) { // getTable call here would add the table to allHiveTables getTable(tblName); } allTablesPopulated = enableCaching; return allTables; } else { return allHiveTables.keySet(); } }
private void loadTimelinesFromTableProperties(UpdatePeriod updatePeriod, String storageTableName, String timeLineKey) throws HiveException, LensException { log.info("loading from table properties: {}", storageTableName); for (String partCol : getTimePartColNamesOfTable(storageTableName)) { ensureEntry(timeLineKey, storageTableName, updatePeriod, partCol).init(getTable(storageTableName)); } }
public boolean partColExists(FactTable factTable, String storage, String partCol) throws LensException { for (String storageTable : getStorageTables(factTable, storage)) { for (FieldSchema f : getTable(storageTable).getPartCols()) { if (f.getName().equalsIgnoreCase(partCol)) { return true; } } } return false; }
public boolean partColExists(FactTable factTable, String storage, String partCol) throws LensException { for (String storageTable : getStorageTables(factTable, storage)) { for (FieldSchema f : getTable(storageTable).getPartCols()) { if (f.getName().equalsIgnoreCase(partCol)) { return true; } } } return false; }
private void loadTimelinesFromTableProperties(UpdatePeriod updatePeriod, String storageTableName, String timeLineKey) throws HiveException, LensException { log.info("loading from table properties: {}", storageTableName); for (String partCol : getTimePartColNamesOfTable(storageTableName)) { ensureEntry(timeLineKey, storageTableName, updatePeriod, partCol).init(getTable(storageTableName)); } }
public List<Partition> getPartitionsByFilter(String storageTableName, String filter) throws HiveException { try { return getClient().getPartitionsByFilter(getTable(storageTableName), filter); } catch (Exception e) { throw new HiveException(e); } }
public List<Partition> getPartitionsByFilter(String storageTableName, String filter) throws HiveException { try { return getClient().getPartitionsByFilter(getTable(storageTableName), filter); } catch (Exception e) { throw new HiveException(e); } }
private void ensureEntryForTimeLineKey(String fact, String storage, UpdatePeriod updatePeriod, String storageTableName, String timeLineKey) throws LensException { // Not found in table properties either, compute from all partitions of the fact-storage table. // First make sure all combinations of update period and partition column have an entry even // if no partitions exist if (getFactTable(fact).getUpdatePeriods() != null && getFactTable(fact).getUpdatePeriods().get(storage) != null) { log.info("loading from all partitions: {}", storageTableName); Table storageTable = getTable(storageTableName); for (String partCol : getTimePartColNamesOfTable(storageTable)) { ensureEntry(timeLineKey, storageTableName, updatePeriod, partCol); } } }
private boolean partitionExists(String storageTableName, Map<String, String> partSpec) throws LensException { try { Table storageTbl = getTable(storageTableName); Partition p = getClient().getPartition(storageTbl, partSpec, false); return (p != null && p.getTPartition() != null); } catch (HiveException e) { throw new LensException("Could not check whether table exists", e); } }
private boolean partitionExists(String storageTableName, Map<String, String> partSpec) throws LensException { try { Table storageTbl = getTable(storageTableName); Partition p = getClient().getPartition(storageTbl, partSpec, false); return (p != null && p.getTPartition() != null); } catch (HiveException e) { throw new LensException("Could not check whether table exists", e); } }