gobblin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-gobblin] zxcware commented on a change in pull request #2722: GOBBLIN-865: Add feature that enables PK-chunking in partition
Date Fri, 13 Sep 2019 22:09:18 GMT
zxcware commented on a change in pull request #2722: GOBBLIN-865: Add feature that enables
PK-chunking in partition
URL: https://github.com/apache/incubator-gobblin/pull/2722#discussion_r324383638
 
 

 ##########
 File path: gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceExtractor.java
 ##########
 @@ -588,11 +576,41 @@ public String getTimestampPredicateCondition(String column, long value,
String v
     return dataTypeMap;
   }
 
+
+  private String partitionPkChunkingJobId = null;
+  private Iterator<String> partitionPkChunkingBatchIdResultIterator = null;
+
+  private Iterator<JsonElement> getRecordSetPkchunking(WorkUnit workUnit) throws RuntimeException
{
+    if (partitionPkChunkingBatchIdResultIterator == null) {
+      partitionPkChunkingJobId = workUnit.getProp(PK_CHUNKING_JOB_ID);
+      partitionPkChunkingBatchIdResultIterator = Arrays.stream(workUnit.getProp(PK_CHUNKING_BATCH_RESULT_IDS).split(",")).iterator();
+    }
+    if (!partitionPkChunkingBatchIdResultIterator.hasNext()) {
+      return null;
+    }
+    try {
+      if (!bulkApiLogin()) {
+        throw new IllegalArgumentException("Invalid Login");
+      }
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+    String[] batchIdResultIdArray = partitionPkChunkingBatchIdResultIterator.next().split(":");
+    String batchId = batchIdResultIdArray[0];
+    String resultId = batchIdResultIdArray[1];
+    List<JsonElement> rs = fetchPkChunkingResultSetWithRetry(bulkConnection, partitionPkChunkingJobId,
batchId, resultId, fetchRetryLimit);
+    return rs.iterator();
+  }
+
   @Override
   public Iterator<JsonElement> getRecordSetFromSourceApi(String schema, String entity,
WorkUnit workUnit,
       List<Predicate> predicateList) throws IOException {
     log.debug("Getting salesforce data using bulk api");
-    RecordSet<JsonElement> rs = null;
+
+    // new version of extractor: bulk api with pk-chunking in pre-partitioning of SalesforceSource
+    if (!workUnit.getProp(PK_CHUNKING_JOB_ID, "").equals("")) {
 
 Review comment:
   Are you checking if `PK_CHUNKING_JOB_ID` exists in workUnit? If so, we can use `workUnit.contains(PK_CHUNKING_JOB_ID)`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message