You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by tillrohrmann <gi...@git.apache.org> on 2016/03/30 15:11:28 UTC

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

GitHub user tillrohrmann opened a pull request:

    https://github.com/apache/flink/pull/1840

    [FLINK-3681] [cep, typeextractor] Generalize TypeExtractor to support more lambdas

    The TypeExtractor.getUnaryOperatorReturnType and TypeExtractor.getBinaryOperatorReturnType
    methods have been extended to support positional arguments for the input types. This allows
    to support parameterized types as Java 8 lambda arguments where the input type is not specified
    by the first type argument (e.g. Map<String, T>). This also solves the problem that the CEP
    library did not support Java 8 lambdas as select functions.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tillrohrmann/flink fixCEPJava8

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1840.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1840
    
----
commit 4e626b79e290acb7a5fd546a985310aef17db8c2
Author: Till Rohrmann <tr...@apache.org>
Date:   2016-03-30T12:55:27Z

    [FLINK-3681] [cep, typeextractor] Generalize TypeExtractor to support more lambdas
    
    The TypeExtractor.getUnaryOperatorReturnType and TypeExtractor.getBinaryOperatorReturnType
    methods have been extended to support positional arguments for the input types. This allows
    to support parameterized types as Java 8 lambda arguments where the input type is not specified
    by the first type argument (e.g. Map<String, T>). This also solves the problem that the CEP
    library did not support Java 8 lambdas as select functions.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/1840#issuecomment-203466325
  
    Thanks for the review @uce 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by uce <gi...@git.apache.org>.
Github user uce commented on the pull request:

    https://github.com/apache/flink/pull/1840#issuecomment-203494813
  
    Till's local Travis passed (https://travis-ci.org/tillrohrmann/flink/builds/119523927). I'm going to merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/1840


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/1840#issuecomment-203466649
  
    Once Travis gives green light I'll merge it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by uce <gi...@git.apache.org>.
Github user uce commented on the pull request:

    https://github.com/apache/flink/pull/1840#issuecomment-203465710
  
    Looks like a nice generalization of the iterable and collector cases. Good that you did not introduce a `hasMap` ;-)
    
    +1 to merge to `master` and `release-1.0` after tests pass.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by uce <gi...@git.apache.org>.
Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1840#discussion_r57898915
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java ---
    @@ -291,12 +347,15 @@ protected TypeExtractor() {
     				
     				// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
     				final int paramLen = m.getGenericParameterTypes().length - 1;
    -				final Type input = (hasCollector)? m.getGenericParameterTypes()[paramLen - 1] : m.getGenericParameterTypes()[paramLen];
    -				validateInputType((hasIterable)?removeGenericWrapper(input) : input, inType);
    +				final Type input = (outputTypeArgumentIndex >= 0) ? m.getGenericParameterTypes()[paramLen - 1] : m.getGenericParameterTypes()[paramLen];
    +				validateInputType((inputTypeArgumentIndex >= 0) ? extractTypeArgument(input, inputTypeArgumentIndex) : input, inType);
     				if(function instanceof ResultTypeQueryable) {
     					return ((ResultTypeQueryable<OUT>) function).getProducedType();
     				}
    -				return new TypeExtractor().privateCreateTypeInfo((hasCollector)? removeGenericWrapper(m.getGenericParameterTypes()[paramLen]) : m.getGenericReturnType(), inType, null);
    +				return new TypeExtractor().privateCreateTypeInfo((
    +					outputTypeArgumentIndex >= 0)? extractTypeArgument(m.getGenericParameterTypes()[paramLen], outputTypeArgumentIndex) : m.getGenericReturnType(),
    --- End diff --
    
    Trivial:
    - line break after second `(` on purpose?
    - White space before `?` missing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-3681] [cep, typeextractor] Generalize T...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1840#discussion_r57900102
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java ---
    @@ -291,12 +347,15 @@ protected TypeExtractor() {
     				
     				// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
     				final int paramLen = m.getGenericParameterTypes().length - 1;
    -				final Type input = (hasCollector)? m.getGenericParameterTypes()[paramLen - 1] : m.getGenericParameterTypes()[paramLen];
    -				validateInputType((hasIterable)?removeGenericWrapper(input) : input, inType);
    +				final Type input = (outputTypeArgumentIndex >= 0) ? m.getGenericParameterTypes()[paramLen - 1] : m.getGenericParameterTypes()[paramLen];
    +				validateInputType((inputTypeArgumentIndex >= 0) ? extractTypeArgument(input, inputTypeArgumentIndex) : input, inType);
     				if(function instanceof ResultTypeQueryable) {
     					return ((ResultTypeQueryable<OUT>) function).getProducedType();
     				}
    -				return new TypeExtractor().privateCreateTypeInfo((hasCollector)? removeGenericWrapper(m.getGenericParameterTypes()[paramLen]) : m.getGenericReturnType(), inType, null);
    +				return new TypeExtractor().privateCreateTypeInfo((
    +					outputTypeArgumentIndex >= 0)? extractTypeArgument(m.getGenericParameterTypes()[paramLen], outputTypeArgumentIndex) : m.getGenericReturnType(),
    --- End diff --
    
    Good catch. Will fix it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---