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

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

dawidwys commented on a change in pull request #6725: [FLINK-10263] 
[sql-client] Fix classloader issues in SQL Client
URL: https://github.com/apache/flink/pull/6725#discussion_r219405018
 
 

 ##########
 File path: 
flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java
 ##########
 @@ -183,6 +184,21 @@ public EnvironmentInstance createEnvironmentInstance() {
                return tableSinks;
        }
 
+       /**
+        * Executes the given supplier using the execution context's 
classloader as thread classloader.
+        */
+       public <R> R wrapClassLoader(Supplier<R> supplier) {
+               final ClassLoader previousClassloader = 
Thread.currentThread().getContextClassLoader();
+               Thread.currentThread().setContextClassLoader(classLoader);
+               R returnValue;
+               try {
+                       returnValue = supplier.get();
 
 Review comment:
   Can't we just return it here?

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


> User-defined function with LITERAL paramters yields CompileException
> --------------------------------------------------------------------
>
>                 Key: FLINK-10263
>                 URL: https://issues.apache.org/jira/browse/FLINK-10263
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API &amp; SQL
>    Affects Versions: 1.7.0
>            Reporter: Fabian Hueske
>            Assignee: Timo Walther
>            Priority: Major
>              Labels: pull-request-available
>
> When using a user-defined scalar function only with literal parameters, a 
> {{CompileException}} is thrown. For example
> {code}
> SELECT myFunc(CAST(40.750444 AS FLOAT), CAST(-73.993475 AS FLOAT))
> public class MyFunc extends ScalarFunction {
>       public int eval(float lon, float lat) {
>               // do something
>       }
> }
> {code}
> results in 
> {code}
> [ERROR] Could not execute SQL statement. Reason:
> org.codehaus.commons.compiler.CompileException: Line 5, Column 10: Cannot 
> determine simple type name "com"
> {code}
> The problem is probably caused by the expression reducer because it 
> disappears if a regular attribute is added to a parameter expression.



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

Reply via email to