You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/05/27 03:20:00 UTC

[jira] [Work logged] (BEAM-7770) Add ReadAll transform for SolrIO

     [ https://issues.apache.org/jira/browse/BEAM-7770?focusedWorklogId=437216&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-437216 ]

ASF GitHub Bot logged work on BEAM-7770:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/May/20 03:19
            Start Date: 27/May/20 03:19
    Worklog Time Spent: 10m 
      Work Description: aromanenko-dev commented on a change in pull request #11357:
URL: https://github.com/apache/beam/pull/11357#discussion_r430364065



##########
File path: sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java
##########
@@ -364,36 +372,41 @@ Read withBatchSize(int batchSize) {
       // by tuning batchSize when pipelines run.
       checkArgument(
           batchSize > 0 && batchSize < MAX_BATCH_SIZE,
-          "Valid values for batchSize are 1 (inclusize) to %s (exclusive), but was: %s ",
+          "Valid values for batchSize are 1 (inclusive) to %s (exclusive), but was: %s ",
           MAX_BATCH_SIZE,
           batchSize);
       return builder().setBatchSize(batchSize).build();
     }
 
+    /** Read from a specific Replica (partition). */
+    public Read withReplicaInfo(ReplicaInfo replicaInfo) {
+      checkArgument(replicaInfo != null, "replicaInfo can not be null");
+      return builder().setReplicaInfo(replicaInfo).build();
+    }
+
     @Override
     public PCollection<SolrDocument> expand(PBegin input) {
       checkArgument(
           getConnectionConfiguration() != null, "withConnectionConfiguration() is required");
       checkArgument(getCollection() != null, "from() is required");
-
-      return input
-          .apply("Create", Create.of(this))
-          .apply("Split", ParDo.of(new SplitFn()))
-          .apply("Reshuffle", Reshuffle.viaRandomKey())
-          .apply("Read", ParDo.of(new ReadFn()));
+      return input.apply("Create", Create.of(this)).apply("ReadAll", readAll());

Review comment:
       Is `withReplicaInfo()` required here? If yes, please, add a check here.

##########
File path: sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java
##########
@@ -364,36 +372,41 @@ Read withBatchSize(int batchSize) {
       // by tuning batchSize when pipelines run.
       checkArgument(
           batchSize > 0 && batchSize < MAX_BATCH_SIZE,
-          "Valid values for batchSize are 1 (inclusize) to %s (exclusive), but was: %s ",
+          "Valid values for batchSize are 1 (inclusive) to %s (exclusive), but was: %s ",
           MAX_BATCH_SIZE,
           batchSize);
       return builder().setBatchSize(batchSize).build();
     }
 
+    /** Read from a specific Replica (partition). */
+    public Read withReplicaInfo(ReplicaInfo replicaInfo) {
+      checkArgument(replicaInfo != null, "replicaInfo can not be null");
+      return builder().setReplicaInfo(replicaInfo).build();
+    }
+
     @Override
     public PCollection<SolrDocument> expand(PBegin input) {
       checkArgument(
           getConnectionConfiguration() != null, "withConnectionConfiguration() is required");
       checkArgument(getCollection() != null, "from() is required");
-
-      return input
-          .apply("Create", Create.of(this))
-          .apply("Split", ParDo.of(new SplitFn()))
-          .apply("Reshuffle", Reshuffle.viaRandomKey())
-          .apply("Read", ParDo.of(new ReadFn()));
+      return input.apply("Create", Create.of(this)).apply("ReadAll", readAll());

Review comment:
       Is `withReplicaInfo()` required here? If yes, please, add a check.

##########
File path: sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java
##########
@@ -364,36 +372,41 @@ Read withBatchSize(int batchSize) {
       // by tuning batchSize when pipelines run.
       checkArgument(
           batchSize > 0 && batchSize < MAX_BATCH_SIZE,
-          "Valid values for batchSize are 1 (inclusize) to %s (exclusive), but was: %s ",
+          "Valid values for batchSize are 1 (inclusive) to %s (exclusive), but was: %s ",
           MAX_BATCH_SIZE,
           batchSize);
       return builder().setBatchSize(batchSize).build();
     }
 
+    /** Read from a specific Replica (partition). */
+    public Read withReplicaInfo(ReplicaInfo replicaInfo) {
+      checkArgument(replicaInfo != null, "replicaInfo can not be null");
+      return builder().setReplicaInfo(replicaInfo).build();
+    }
+
     @Override
     public PCollection<SolrDocument> expand(PBegin input) {
       checkArgument(
           getConnectionConfiguration() != null, "withConnectionConfiguration() is required");
       checkArgument(getCollection() != null, "from() is required");
-
-      return input
-          .apply("Create", Create.of(this))
-          .apply("Split", ParDo.of(new SplitFn()))
-          .apply("Reshuffle", Reshuffle.viaRandomKey())
-          .apply("Read", ParDo.of(new ReadFn()));
+      return input.apply("Create", Create.of(this)).apply("ReadAll", readAll());

Review comment:
       My bad, I think we don't it here since anyway it will pass through `SplitFn` downstream

##########
File path: sdks/java/io/solr/src/main/java/org/apache/beam/sdk/io/solr/SolrIO.java
##########
@@ -364,36 +372,41 @@ Read withBatchSize(int batchSize) {
       // by tuning batchSize when pipelines run.
       checkArgument(
           batchSize > 0 && batchSize < MAX_BATCH_SIZE,
-          "Valid values for batchSize are 1 (inclusize) to %s (exclusive), but was: %s ",
+          "Valid values for batchSize are 1 (inclusive) to %s (exclusive), but was: %s ",
           MAX_BATCH_SIZE,
           batchSize);
       return builder().setBatchSize(batchSize).build();
     }
 
+    /** Read from a specific Replica (partition). */
+    public Read withReplicaInfo(ReplicaInfo replicaInfo) {
+      checkArgument(replicaInfo != null, "replicaInfo can not be null");
+      return builder().setReplicaInfo(replicaInfo).build();
+    }
+
     @Override
     public PCollection<SolrDocument> expand(PBegin input) {
       checkArgument(
           getConnectionConfiguration() != null, "withConnectionConfiguration() is required");
       checkArgument(getCollection() != null, "from() is required");
-
-      return input
-          .apply("Create", Create.of(this))
-          .apply("Split", ParDo.of(new SplitFn()))
-          .apply("Reshuffle", Reshuffle.viaRandomKey())
-          .apply("Read", ParDo.of(new ReadFn()));
+      return input.apply("Create", Create.of(this)).apply("ReadAll", readAll());

Review comment:
       My bad, I think we don't need it here since anyway it will pass through `SplitFn` downstream




----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 437216)
    Time Spent: 20m  (was: 10m)

> Add ReadAll transform for SolrIO
> --------------------------------
>
>                 Key: BEAM-7770
>                 URL: https://issues.apache.org/jira/browse/BEAM-7770
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-solr
>            Reporter: Ismaël Mejía
>            Assignee: Ismaël Mejía
>            Priority: P3
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> SolrIO already uses internally a composable approach but we need to expose an explicit ReadAll transform that allows user to create reads in the middle of the Pipeline to improve composability (e.g. Reads in the middle of a Pipeline).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)