本文整理了Java中org.apache.gobblin.source.workunit.Extract.getExtractId()
方法的一些代码示例,展示了Extract.getExtractId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Extract.getExtractId()
方法的具体详情如下:
包路径:org.apache.gobblin.source.workunit.Extract
类名称:Extract
方法名:getExtractId
[英]Get a (non-globally) unique ID for this Extract.
[中]获取此提取的(非全局)唯一ID。
代码示例来源:origin: apache/incubator-gobblin
private Extract getExtractForFile(PartitionAwareFileRetriever.FileInfo file,
String topicName,
String namespace,
Map<Long, Extract> extractMap) {
Extract extract = extractMap.get(file.getWatermarkMsSinceEpoch());
if (extract == null) {
// Create an extract object for the dayPath
extract = new Extract(this.tableType, namespace, topicName);
LOG.info("Created extract: " + extract.getExtractId() + " for path " + topicName);
extractMap.put(file.getWatermarkMsSinceEpoch(), extract);
}
return extract;
}
代码示例来源:origin: apache/incubator-gobblin
@Override
public int hashCode() {
return (this.getNamespace() + this.getTable() + this.getExtractId()).hashCode();
}
代码示例来源:origin: apache/incubator-gobblin
@Override
public boolean equals(Object object) {
if (!(object instanceof Extract)) {
return false;
}
Extract other = (Extract) object;
return super.equals(other) && this.getNamespace().equals(other.getNamespace())
&& this.getTable().equals(other.getTable()) && this.getExtractId().equals(other.getExtractId());
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Get the writer output file path corresponding to this {@link Extract}.
*
* @return writer output file path corresponding to this {@link Extract}
* @deprecated As {@code this.getIsFull} is deprecated.
*/
@Deprecated
public String getOutputFilePath() {
return this.getNamespace().replaceAll("\\.", "/") + "/" + this.getTable() + "/" + this.getExtractId() + "_"
+ (this.getIsFull() ? "full" : "append");
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Returns a unique {@link Extract} instance.
* Any two calls of this method from the same {@link ExtractFactory} instance guarantees to
* return {@link Extract}s with different IDs.
*
* @param type {@link TableType}
* @param namespace dot separated namespace path
* @param table table name
* @return a unique {@link Extract} instance
*/
public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime()));
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1)));
}
}
this.createdInstances.add(newExtract);
return newExtract;
}
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Create a new properly populated {@link Extract} instance.
*
* <p>
* This method should always return a new unique {@link Extract} instance.
* </p>
*
* @param type {@link org.apache.gobblin.source.workunit.Extract.TableType}
* @param namespace namespace of the table this extract belongs to
* @param table name of the table this extract belongs to
* @return a new unique {@link Extract} instance
*
* @Deprecated Use {@link org.apache.gobblin.source.extractor.extract.AbstractSource#createExtract(
*org.apache.gobblin.source.workunit.Extract.TableType, String, String)}
*/
@Deprecated
public synchronized Extract createExtract(Extract.TableType type, String namespace, String table) {
Extract extract = new Extract(this, type, namespace, table);
while (EXTRACT_SET.contains(extract)) {
if (Strings.isNullOrEmpty(extract.getExtractId())) {
extract.setExtractId(DTF.print(new DateTime()));
} else {
DateTime extractDateTime = DTF.parseDateTime(extract.getExtractId());
extract.setExtractId(DTF.print(extractDateTime.plusSeconds(1)));
}
}
EXTRACT_SET.add(extract);
return extract;
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Verify that each {@link Extract} created by an {@ExtractFactory} has a unique ID.
*/
@Test
public void testGetUniqueExtract() {
ExtractFactory extractFactory = new ExtractFactory("yyyyMMddHHmmss");
Set<String> extractIDs = Sets.newHashSet();
int numOfExtracts = 100;
for (int i = 0; i < numOfExtracts; i++) {
extractIDs
.add(extractFactory.getUniqueExtract(Extract.TableType.APPEND_ONLY, "namespace", "table").getExtractId());
}
Assert.assertEquals(extractIDs.size(), numOfExtracts);
}
}
代码示例来源:origin: org.apache.gobblin/gobblin-api
@Override
public boolean equals(Object object) {
if (!(object instanceof Extract)) {
return false;
}
Extract other = (Extract) object;
return super.equals(other) && this.getNamespace().equals(other.getNamespace())
&& this.getTable().equals(other.getTable()) && this.getExtractId().equals(other.getExtractId());
}
代码示例来源:origin: org.apache.gobblin/gobblin-api
@Override
public int hashCode() {
return (this.getNamespace() + this.getTable() + this.getExtractId()).hashCode();
}
代码示例来源:origin: org.apache.gobblin/gobblin-core
private Extract getExtractForFile(PartitionAwareFileRetriever.FileInfo file,
String topicName,
String namespace,
Map<Long, Extract> extractMap) {
Extract extract = extractMap.get(file.getWatermarkMsSinceEpoch());
if (extract == null) {
// Create an extract object for the dayPath
extract = new Extract(this.tableType, namespace, topicName);
LOG.info("Created extract: " + extract.getExtractId() + " for path " + topicName);
extractMap.put(file.getWatermarkMsSinceEpoch(), extract);
}
return extract;
}
代码示例来源:origin: org.apache.gobblin/gobblin-api
/**
* Get the writer output file path corresponding to this {@link Extract}.
*
* @return writer output file path corresponding to this {@link Extract}
* @deprecated As {@code this.getIsFull} is deprecated.
*/
@Deprecated
public String getOutputFilePath() {
return this.getNamespace().replaceAll("\\.", "/") + "/" + this.getTable() + "/" + this.getExtractId() + "_"
+ (this.getIsFull() ? "full" : "append");
}
代码示例来源:origin: org.apache.gobblin/gobblin-api
/**
* Returns a unique {@link Extract} instance.
* Any two calls of this method from the same {@link ExtractFactory} instance guarantees to
* return {@link Extract}s with different IDs.
*
* @param type {@link TableType}
* @param namespace dot separated namespace path
* @param table table name
* @return a unique {@link Extract} instance
*/
public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime()));
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1)));
}
}
this.createdInstances.add(newExtract);
return newExtract;
}
}
代码示例来源:origin: org.apache.gobblin/gobblin-api
/**
* Create a new properly populated {@link Extract} instance.
*
* <p>
* This method should always return a new unique {@link Extract} instance.
* </p>
*
* @param type {@link org.apache.gobblin.source.workunit.Extract.TableType}
* @param namespace namespace of the table this extract belongs to
* @param table name of the table this extract belongs to
* @return a new unique {@link Extract} instance
*
* @Deprecated Use {@link org.apache.gobblin.source.extractor.extract.AbstractSource#createExtract(
*org.apache.gobblin.source.workunit.Extract.TableType, String, String)}
*/
@Deprecated
public synchronized Extract createExtract(Extract.TableType type, String namespace, String table) {
Extract extract = new Extract(this, type, namespace, table);
while (EXTRACT_SET.contains(extract)) {
if (Strings.isNullOrEmpty(extract.getExtractId())) {
extract.setExtractId(DTF.print(new DateTime()));
} else {
DateTime extractDateTime = DTF.parseDateTime(extract.getExtractId());
extract.setExtractId(DTF.print(extractDateTime.plusSeconds(1)));
}
}
EXTRACT_SET.add(extract);
return extract;
}
内容来源于网络,如有侵权,请联系作者删除!