public CreationMetadata deepCopy() { return new CreationMetadata(this); }
private MCreationMetadata convertToMCreationMetadata( CreationMetadata m) throws MetaException { if (m == null) { return null; } assert !m.isSetMaterializationTime(); Set<MTable> tablesUsed = new HashSet<>(); for (String fullyQualifiedName : m.getTablesUsed()) { String[] names = fullyQualifiedName.split("\\."); tablesUsed.add(getMTable(m.getCatName(), names[0], names[1], false).mtbl); } return new MCreationMetadata(normalizeIdentifier(m.getCatName()), normalizeIdentifier(m.getDbName()), normalizeIdentifier(m.getTblName()), tablesUsed, m.getValidTxnList(), System.currentTimeMillis()); }
case CAT_NAME: if (value == null) { unsetCatName(); } else { setCatName((String)value); unsetDbName(); } else { setDbName((String)value); unsetTblName(); } else { setTblName((String)value); unsetTablesUsed(); } else { setTablesUsed((Set<String>)value); unsetValidTxnList(); } else { setValidTxnList((String)value); unsetMaterializationTime(); } else { setMaterializationTime((Long)value);
public Object getFieldValue(_Fields field) { switch (field) { case CAT_NAME: return getCatName(); case DB_NAME: return getDbName(); case TBL_NAME: return getTblName(); case TABLES_USED: return getTablesUsed(); case VALID_TXN_LIST: return getValidTxnList(); case MATERIALIZATION_TIME: return getMaterializationTime(); } throw new IllegalStateException(); }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case CAT_NAME: return isSetCatName(); case DB_NAME: return isSetDbName(); case TBL_NAME: return isSetTblName(); case TABLES_USED: return isSetTablesUsed(); case VALID_TXN_LIST: return isSetValidTxnList(); case MATERIALIZATION_TIME: return isSetMaterializationTime(); } throw new IllegalStateException(); }
private CreationMetadata convertToCreationMetadata( MCreationMetadata s) throws MetaException { if (s == null) { return null; } Set<String> tablesUsed = new HashSet<>(); for (MTable mtbl : s.getTables()) { tablesUsed.add( Warehouse.getQualifiedName( mtbl.getDatabase().getName(), mtbl.getTableName())); } CreationMetadata r = new CreationMetadata(s.getCatalogName(), s.getDbName(), s.getTblName(), tablesUsed); r.setMaterializationTime(s.getMaterializationTime()); if (s.getTxnList() != null) { r.setValidTxnList(s.getTxnList()); } return r; }
public Table build(Configuration conf) throws MetaException { if (tableName == null) { throw new MetaException("You must set the table name"); } if (ownerType == null) { ownerType = PrincipalType.USER; } if (owner == null) { try { owner = SecurityUtils.getUser(); } catch (IOException e) { throw MetaStoreUtils.newMetaException(e); } } if (catName == null) catName = MetaStoreUtils.getDefaultCatalog(conf); Table t = new Table(tableName, dbName, owner, createTime, lastAccessTime, retention, buildSd(), partCols, tableParams, viewOriginalText, viewExpandedText, type); if (rewriteEnabled) t.setRewriteEnabled(true); if (temporary) t.setTemporary(temporary); t.setCatName(catName); if (!mvReferencedTables.isEmpty()) { CreationMetadata cm = new CreationMetadata(catName, dbName, tableName, mvReferencedTables); if (mvValidTxnList != null) cm.setValidTxnList(mvValidTxnList); t.setCreationMetadata(cm); } return t; }
case 17: // CREATION_METADATA if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.creationMetadata = new CreationMetadata(); struct.creationMetadata.read(iprot); struct.setCreationMetadataIsSet(true); } else {
Table mvTable = db.getTable(getWork().getViewName()); CreationMetadata cm = new CreationMetadata(MetaStoreUtils.getDefaultCatalog(conf), mvTable.getDbName(), mvTable.getTableName(), ImmutableSet.copyOf(mvTable.getCreationMetadata().getTablesUsed())); cm.setValidTxnList(conf.get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY)); db.updateCreationMetadata(mvTable.getDbName(), mvTable.getTableName(), cm);
} else { if (forceMVContentsUpToDate || timeWindow == 0L || creationMetadata.getMaterializationTime() < System.currentTimeMillis() - timeWindow) { if (currentTxnWriteIds == null) { LOG.debug("Materialized view " + materializedViewTable.getFullyQualifiedName() + return null; if (creationMetadata.getValidTxnList() == null || creationMetadata.getValidTxnList().isEmpty()) { LOG.debug("Materialized view " + materializedViewTable.getFullyQualifiedName() + " ignored for rewriting as we could not obtain materialization txn ids"); creationMetadata.getValidTxnList()); for (String qName : tablesUsed) { if (!creationMetadata.getTablesUsed().contains(qName)) { continue;
public Materialization getMaterializationInvalidationInfo( CreationMetadata creationMetadata, String validTxnListStr) throws MetaException { if (creationMetadata.getTablesUsed().isEmpty()) { new ValidTxnWriteIdList(creationMetadata.getValidTxnList()); for (String fullyQualifiedName : creationMetadata.getTablesUsed()) {
for (String qName : table.getCreationMetadata().getTablesUsed()) { table = getTable(db, qName, tabNameToTabObject); if (table == null) {
public void write(org.apache.thrift.protocol.TProtocol oprot, CreationMetadata struct) throws org.apache.thrift.TException { struct.validate(); if (struct.isSetValidTxnList()) { oprot.writeFieldBegin(VALID_TXN_LIST_FIELD_DESC); oprot.writeString(struct.validTxnList); if (struct.isSetMaterializationTime()) { oprot.writeFieldBegin(MATERIALIZATION_TIME_FIELD_DESC); oprot.writeI64(struct.materializationTime);
if (isSetValidTxnList()) { if (!first) sb.append(", "); sb.append("validTxnList:"); if (isSetMaterializationTime()) { if (!first) sb.append(", "); sb.append("materializationTime:");
creationMetadata.getValidTxnList())); creationMetadata.getValidTxnList()));
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof CreationMetadata) return this.equals((CreationMetadata)that); return false; }
private CreationMetadata convertToCreationMetadata( MCreationMetadata s) throws MetaException { if (s == null) { return null; } Set<String> tablesUsed = new HashSet<>(); for (MTable mtbl : s.getTables()) { tablesUsed.add( Warehouse.getQualifiedName( mtbl.getDatabase().getName(), mtbl.getTableName())); } CreationMetadata r = new CreationMetadata(s.getCatalogName(), s.getDbName(), s.getTblName(), tablesUsed); r.setMaterializationTime(s.getMaterializationTime()); if (s.getTxnList() != null) { r.setValidTxnList(s.getTxnList()); } return r; }
boolean this_present_catName = true && this.isSetCatName(); boolean that_present_catName = true && that.isSetCatName(); if (this_present_catName || that_present_catName) { if (!(this_present_catName && that_present_catName)) boolean this_present_dbName = true && this.isSetDbName(); boolean that_present_dbName = true && that.isSetDbName(); if (this_present_dbName || that_present_dbName) { if (!(this_present_dbName && that_present_dbName)) boolean this_present_tblName = true && this.isSetTblName(); boolean that_present_tblName = true && that.isSetTblName(); if (this_present_tblName || that_present_tblName) { if (!(this_present_tblName && that_present_tblName)) boolean this_present_tablesUsed = true && this.isSetTablesUsed(); boolean that_present_tablesUsed = true && that.isSetTablesUsed(); if (this_present_tablesUsed || that_present_tablesUsed) { if (!(this_present_tablesUsed && that_present_tablesUsed)) boolean this_present_validTxnList = true && this.isSetValidTxnList(); boolean that_present_validTxnList = true && that.isSetValidTxnList(); if (this_present_validTxnList || that_present_validTxnList) { if (!(this_present_validTxnList && that_present_validTxnList)) boolean this_present_materializationTime = true && this.isSetMaterializationTime(); boolean that_present_materializationTime = true && that.isSetMaterializationTime(); if (this_present_materializationTime || that_present_materializationTime) { if (!(this_present_materializationTime && that_present_materializationTime))
new CreationMetadata(MetaStoreUtils.getDefaultCatalog(conf), tbl.getDbName(), tbl.getTableName(), ImmutableSet.copyOf(crtView.getTablesUsed())); cm.setValidTxnList(conf.get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY)); tbl.getTTable().setCreationMetadata(cm);
struct.creationMetadata = new CreationMetadata(); struct.creationMetadata.read(iprot); struct.setCreationMetadataIsSet(true);