[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 20:13
Start Date: 14/Dec/18 20:13
Worklog Time Spent: 10m 
  Work Description: kennknowles closed pull request #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Contextful.java 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Contextful.java
index 7e788cf05866..97a994f3727e 100644
--- 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Contextful.java
+++ 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Contextful.java
@@ -104,11 +104,11 @@ public String toString() {
   }
 
   /**
-   * Wraps a {@link SerializableFunction} as a {@link Contextful} of {@link 
Fn} with empty {@link
+   * Wraps a {@link ProcessFunction} as a {@link Contextful} of {@link Fn} 
with empty {@link
* Requirements}.
*/
   public static  Contextful> fn(
-  final SerializableFunction fn) {
+  final ProcessFunction fn) {
 return new Contextful<>((element, c) -> fn.apply(element), 
Requirements.empty());
   }
 
diff --git 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Filter.java 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Filter.java
index 4bffeb6be3d0..aa9d2cd38100 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Filter.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Filter.java
@@ -32,7 +32,7 @@
   /**
* Returns a {@code PTransform} that takes an input {@code PCollection} 
and returns a {@code
* PCollection} with elements that satisfy the given predicate. The 
predicate must be a {@code
-   * SerializableFunction}.
+   * ProcessFunction}.
*
* Example of use:
*
@@ -46,7 +46,7 @@
* #greaterThanEq}, which return elements satisfying various inequalities 
with the specified value
* based on the elements' natural ordering.
*/
-  public static > 
Filter by(
+  public static > Filter 
by(
   PredicateT predicate) {
 return new Filter<>(predicate);
   }
@@ -71,7 +71,7 @@
* See also {@link #by}, which returns elements that satisfy the given 
predicate.
*/
   public static > Filter lessThan(final T value) {
-return by((SerializableFunction) input -> 
input.compareTo(value) < 0)
+return by((ProcessFunction) input -> input.compareTo(value) < 
0)
 .described(String.format("x < %s", value));
   }
 
@@ -95,7 +95,7 @@
* See also {@link #by}, which returns elements that satisfy the given 
predicate.
*/
   public static > Filter greaterThan(final T value) 
{
-return by((SerializableFunction) input -> 
input.compareTo(value) > 0)
+return by((ProcessFunction) input -> input.compareTo(value) > 
0)
 .described(String.format("x > %s", value));
   }
 
@@ -119,7 +119,7 @@
* See also {@link #by}, which returns elements that satisfy the given 
predicate.
*/
   public static > Filter lessThanEq(final T value) {
-return by((SerializableFunction) input -> 
input.compareTo(value) <= 0)
+return by((ProcessFunction) input -> input.compareTo(value) <= 
0)
 .described(String.format("x ≤ %s", value));
   }
 
@@ -143,7 +143,7 @@
* See also {@link #by}, which returns elements that satisfy the given 
predicate.
*/
   public static > Filter greaterThanEq(final T 
value) {
-return by((SerializableFunction) input -> 
input.compareTo(value) >= 0)
+return by((ProcessFunction) input -> input.compareTo(value) >= 
0)
 .described(String.format("x ≥ %s", value));
   }
 
@@ -166,20 +166,20 @@
* See also {@link #by}, which returns elements that satisfy the given 
predicate.
*/
   public static > Filter equal(final T value) {
-return by((SerializableFunction) input -> 
input.compareTo(value) == 0)
+return by((ProcessFunction) input -> input.compareTo(value) == 
0)
 .described(String.format("x == %s", value));
   }
 
   
///
 
-  private SerializableFunction predicate;
+  private ProcessFunction predicate;
   private String predicateDescription;
 
-  private Filter(SerializableFunction predicate) {
+  private Filter(ProcessFunction predicate) {
 this(predicate, "Filter.predicate");
   }
 
-  private Filter(SerializableFunction predicate, String 

[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 20:13
Start Date: 14/Dec/18 20:13
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-447441634
 
 
   Done


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


Issue Time Tracking
---

Worklog Id: (was: 175570)
Time Spent: 1h 40m  (was: 1.5h)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 20:12
Start Date: 14/Dec/18 20:12
Worklog Time Spent: 10m 
  Work Description: jklukas commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-447441228
 
 
   > It looks like the commits should be squashed
   
   Yes, that would be lovely. Do you need me to do that, or are you happy to 
use GitHub's squash and merge?


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


Issue Time Tracking
---

Worklog Id: (was: 175568)
Time Spent: 1h 20m  (was: 1h 10m)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 20:10
Start Date: 14/Dec/18 20:10
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-447440631
 
 
   Nice. It looks like the commits should be squashed, but I don't want to 
assume - is that what you intended?


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


Issue Time Tracking
---

Worklog Id: (was: 175567)
Time Spent: 1h 10m  (was: 1h)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 19:15
Start Date: 14/Dec/18 19:15
Worklog Time Spent: 10m 
  Work Description: jklukas commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-447426035
 
 
   Thanks for the review, @kennknowles.
   
   > But instead of porting tests to InferableFunction can you duplicate them, 
or some of them.
   
   Done. This should be ready for another review.


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


Issue Time Tracking
---

Worklog Id: (was: 175556)
Time Spent: 1h  (was: 50m)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 19:14
Start Date: 14/Dec/18 19:14
Worklog Time Spent: 10m 
  Work Description: jklukas commented on a change in pull request #7160: 
[BEAM-6150] Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#discussion_r241860714
 
 

 ##
 File path: website/src/contribute/ptransform-style-guide.md
 ##
 @@ -395,8 +395,8 @@ If the transform has an aspect of behavior to be 
customized by a user's code, ma
 
 Do:
 
-* If possible, just use PTransform composition as an extensibility device - 
i.e. if the same effect can be achieved by the user applying the transform in 
their pipeline and composing it with another `PTransform`, then the transform 
itself should not be extensible. E.g., a transform that writes JSON objects to 
a third-party system should take a `PCollection` (assuming it is 
possible to provide a `Coder` for `JsonObject`), rather than taking a generic 
`PCollection` and a `SerializableFunction` (anti-example that 
should be fixed: `TextIO`).
-* If extensibility by user code is necessary inside the transform, pass the 
user code as a `SerializableFunction` or define your own serializable 
function-like type (ideally single-method, for interoperability with Java 8 
lambdas). Because Java erases the types of lambdas, you should be sure to have 
adequate type information even if a raw-type `SerializableFunction` is provided 
by the user. See `MapElements` and `FlatMapElements` for examples of how to use 
`SimpleFunction` and `SerializableFunction` in tandem to support Java 7 and 
Java 8 well.
+* If possible, just use PTransform composition as an extensibility device - 
i.e. if the same effect can be achieved by the user applying the transform in 
their pipeline and composing it with another `PTransform`, then the transform 
itself should not be extensible. E.g., a transform that writes JSON objects to 
a third-party system should take a `PCollection` (assuming it is 
possible to provide a `Coder` for `JsonObject`), rather than taking a generic 
`PCollection` and a `ProcessFunction` (anti-example that 
should be fixed: `TextIO`).
+* If extensibility by user code is necessary inside the transform, pass the 
user code as a `ProcessFunction` or define your own serializable function-like 
type (ideally single-method, for interoperability with Java 8 lambdas). Because 
Java erases the types of lambdas, you should be sure to have adequate type 
information even if a raw-type `ProcessFunction` is provided by the user. See 
`MapElements` and `FlatMapElements` for examples of how to use 
`ProcessFunction` and `InferableFunction` in tandem to provide good support for 
both lambdas and concrete subclasses with type information.
 
 Review comment:
   Changed wording of the last sentence here to remove reference to Java 7 and 
instead discuss type inferability.


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


Issue Time Tracking
---

Worklog Id: (was: 17)
Time Spent: 50m  (was: 40m)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-12-14 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 14/Dec/18 19:13
Start Date: 14/Dec/18 19:13
Worklog Time Spent: 10m 
  Work Description: jklukas commented on a change in pull request #7160: 
[BEAM-6150] Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#discussion_r241860482
 
 

 ##
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/MapElementsTest.java
 ##
 @@ -166,12 +231,31 @@ public Integer apply(KV input) {
   }
 
   /**
-   * Basic test of {@link MapElements} with a {@link SerializableFunction}. 
This style is generally
-   * discouraged in Java 7, in favor of {@link SimpleFunction}.
+   * Test of {@link MapElements} coder propagation with a parametric {@link 
InferableFunction} where
+   * the type variable occurs nested within other concrete type constructors.
 
 Review comment:
   This looks out of place in the diff. The removed lines are the docstring for 
`testMapBasicSerializableFunction` which has been renamed to 
`testMapBasicProcessFunction` and appears as the next function below.


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


Issue Time Tracking
---

Worklog Id: (was: 175554)
Time Spent: 40m  (was: 0.5h)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-11-29 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 29/Nov/18 21:19
Start Date: 29/Nov/18 21:19
Worklog Time Spent: 10m 
  Work Description: jklukas commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-442996932
 
 
retest this please


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


Issue Time Tracking
---

Worklog Id: (was: 170805)
Time Spent: 0.5h  (was: 20m)

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-11-29 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 29/Nov/18 16:50
Start Date: 29/Nov/18 16:50
Worklog Time Spent: 10m 
  Work Description: jklukas commented on issue #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160#issuecomment-442907787
 
 
   cc @reuvenlax and @rmannibucau as potential reviewers. If you have 
suggestions for how to validate that this will indeed be binary compatible, let 
me know.


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


Issue Time Tracking
---

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

> Provide alternatives to SerializableFunction and SimpleFunction that may 
> declare exceptions
> ---
>
> Key: BEAM-6150
> URL: https://issues.apache.org/jira/browse/BEAM-6150
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Jeff Klukas
>Assignee: Jeff Klukas
>Priority: Minor
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Contextful.Fn allows subclasses to declare checked exceptions, but neither 
> SerializableFunction nor SimpleFunction do. We want to add a new entry in 
> each of those hierarchies where checked exceptions are allowed. We can then 
> change existing method signatures to accept the new superinterfaces in 
> contexts where allowing user code to throw checked exceptions is acceptable, 
> such as in ProcessElement methods.
> Discussed on the dev mailing list:
> https://lists.apache.org/thread.html/eecd8dea8b47710098ec67d73b87cf9b4e2926c444c3fee1a6b9a743@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (BEAM-6150) Provide alternatives to SerializableFunction and SimpleFunction that may declare exceptions

2018-11-29 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot logged work on BEAM-6150:


Author: ASF GitHub Bot
Created on: 29/Nov/18 16:45
Start Date: 29/Nov/18 16:45
Worklog Time Spent: 10m 
  Work Description: jklukas opened a new pull request #7160: [BEAM-6150] 
Superinterface for SerializableFunction allowing declared exceptions
URL: https://github.com/apache/beam/pull/7160
 
 
   Also provides an equivalent superclass for SimpleFunction.
   
   See https://issues.apache.org/jira/browse/BEAM-6150
   
   The intention here is to be both binary and recompile compatible with code 
using previous version of the Beam Java SDK, so some careful review is needed 
to ensure that's the case. See the Java specification's chapter on [binary 
compatibility](https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html).
   
   We originally discussed deprecating SerializableFunction and SimpleFunction 
in favor of the new classes, but there appear to be two fairly separate use 
cases for SerializableFunction. It's either defining user code that will be 
executed in a DoFn, in which case I think we always want to prefer the new 
interface that allows declared exceptions. But it's also used where the code is 
to be executed as part of pipeline construction, in which case it may be 
reasonable to want to restrict checked exceptions. In any case, deprecating 
SerializableFunction and SimpleFunction can be discussed further in the future.
   
   I've attempted to provide significant context in the docstrings to explain 
the differences between these various classes and interfaces, and to explain 
the naming. The new interface and class are now used in `MapElements`, 
`FlatMapElements` and `Filter` as part of this PR. There are many other places 
in the SDK where we could alter methods to accept these less restrictive types, 
but those can be altered as needed in future changes.
   
   I'm very open to feedback about suggestions for alternate names for the new 
`ProcessFunction` and `InferableFunction`.
   
   
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [x] Format the pull request title like `[BEAM-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA 
issue, if applicable. This will automatically link the pull request to the 
issue.
- [x] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   It will help us expedite review of your Pull Request if you tag someone 
(e.g. `@username`) to look at it.
   
   Post-Commit Tests Status (on master branch)
   

   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/)
 | --- | --- | --- | --- | --- | ---
   Java | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/)
 [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/)
 | [![Build