You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/09/18 02:35:23 UTC
[GitHub] zrjnike opened a new pull request #6709: Release 1.6
zrjnike opened a new pull request #6709: Release 1.6
URL: https://github.com/apache/flink/pull/6709
When I define a user-defined function,When I use the sql client, I get an error (flink version 1.6.0).
```
Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:184)
Caused by: java.lang.RuntimeException: The Nothing type cannot have a serializer.
at org.apache.flink.api.common.typeinfo.NothingTypeInfo.createSerializer(NothingTypeInfo.java:74)
at org.apache.flink.api.java.typeutils.RowTypeInfo.createSerializer(RowTypeInfo.java:240)
at org.apache.flink.api.java.typeutils.TupleTypeInfo.createSerializer(TupleTypeInfo.java:107)
at org.apache.flink.api.java.typeutils.TupleTypeInfo.createSerializer(TupleTypeInfo.java:52)
at org.apache.flink.table.client.gateway.local.result.CollectStreamResult.<init>(CollectStreamResult.java:65)
at org.apache.flink.table.client.gateway.local.result.ChangelogCollectStreamResult.<init>(ChangelogCollectStreamResult.java:43)
at org.apache.flink.table.client.gateway.local.ResultStore.createResult(ResultStore.java:72)
at org.apache.flink.table.client.gateway.local.LocalExecutor.executeQueryInternal(LocalExecutor.java:380)
at org.apache.flink.table.client.gateway.local.LocalExecutor.executeQuery(LocalExecutor.java:239)
at org.apache.flink.table.client.cli.CliClient.callSelect(CliClient.java:376)
at org.apache.flink.table.client.cli.CliClient.callCommand(CliClient.java:255)
at java.util.Optional.ifPresent(Optional.java:159)
at org.apache.flink.table.client.cli.CliClient.open(CliClient.java:184)
at org.apache.flink.table.client.SqlClient.openCli(SqlClient.java:117)
at org.apache.flink.table.client.SqlClient.start(SqlClient.java:101)
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:172)
```
User-defined Functions code:
```
public class Split extends TableFunction<Tuple2<String, Integer>>{
private String separator = " ";
public Split(String separator) {
this.separator = separator;
}
public void eval(String str) {
for (String s : str.split(separator)) {
// use collect(...) to emit a row
collect(new Tuple2<String, Integer>(s, s.length()));
}
}
}
```
SQL yaml config:
```
functions:
\- name: user_split
from: class
class: com.youzu.flink.udf.Split
constructor:
- type: VARCHAR
value: sd
```
SQL Client command:
`./bin/sql-client.sh embedded --jar /home/datacenter/flink/flink-1.6.0/udfs/flink-udf-1.0-SNAPSHOT.jar
`
SQL:
`select user_split('sads asasd sasa')`
@jpzk @zitterbewegung @hadronzoo please help,thanks
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services