flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-1062) Type Extraction for Lambdas
Date Mon, 08 Sep 2014 12:06:28 GMT

    [ https://issues.apache.org/jira/browse/FLINK-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125437#comment-14125437
] 

ASF GitHub Bot commented on FLINK-1062:
---------------------------------------

Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/113#discussion_r17233691
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/functions/util/FunctionUtils.java
---
    @@ -84,4 +84,66 @@ public static boolean isLambdaFunction(Function function) {
     		
     		return false;
     	}
    +	
    +	public static Method extractLambdaMethod(Function function) {
    +		try {
    +			// get serialized lambda
    +			Object serializedLambda = null;
    +			for (Class<?> clazz = function.getClass(); clazz != null; clazz = clazz.getSuperclass())
{
    +				try {
    +					Method replaceMethod = clazz.getDeclaredMethod("writeReplace");
    +					replaceMethod.setAccessible(true);
    +					Object serialVersion = replaceMethod.invoke(function);
    +
    +					// check if class is a lambda function
    +					if (serialVersion.getClass().getName().equals("java.lang.invoke.SerializedLambda"))
{
    +						
    +						// check if SerializedLambda class is present
    +						try {
    +							Class.forName("java.lang.invoke.SerializedLambda");
    +						}
    +						catch (Throwable t) {
    --- End diff --
    
    I think this should be a `ClassNotFoundException`


> Type Extraction for Lambdas
> ---------------------------
>
>                 Key: FLINK-1062
>                 URL: https://issues.apache.org/jira/browse/FLINK-1062
>             Project: Flink
>          Issue Type: Improvement
>          Components: Java API
>    Affects Versions: 0.7-incubating
>            Reporter: Stephan Ewen
>            Assignee: Timo Walther
>             Fix For: 0.7-incubating
>
>
> Lambdas currently work only for {{filter}} and {{reduce(a,b)}}, because Lambda type extraction
is not in place right now.
> We need to extend the type extraction for lambdas to support the other functions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message