flink1.12.0 tableAggregationFunction在PLAN阶段报错

2021-05-11 文章 wanglongl...@wondersgroup.com
您好,

在使用flink+hive进行离线数据挖掘中,需要使用到TableAggregationFunction的功能,但在idea调试过程中出现如下问题,请老师帮忙分析一下,谢谢。

1、目前flink版本为1.12.0,在参考https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/functions/udfs.html#aggregate-functions开发时,PLAN阶段出现错误,具体操作信息在附件《错误信息.txt》中。
2、数据内容项如下:

3、代码在附件中。
4、代码的逻辑:根据address分组,获取分组中organ_id最大的一行数据。



wanglongl...@wondersgroup.com


flink on k8s native ????????

2021-05-11 文章 ????????????????
Hi All??


?? k8s  flink on k8s native 
??





  k8sv1.18.16
  flinkflink-1.12.2
  javaopenjdk version "11" 2018-09-25


??
 
 1??Kubernetes = 1.9 


 
  2?? 



3??Kubernetes DNS 





4??defaultservice account withRBACpermissions to create, 
delete pods  ??


kubectl create namespace flink-session-cluster


kubectl create serviceaccount flink -n flink-session-cluster


kubectl create clusterrolebinding flink-role-binding-flink \   
--clusterrole=edit \   --serviceaccount=flink-session-cluster:flink



 session ?? flink 


  3.1 session 


./bin/kubernetes-session.sh -Dkubernetes.cluster-id=my-first-flink-cluster \
 -Dkubernetes.namespace=flink-session-cluster \
 -Dkubernetes.jobmanager.service-account=flink \
 -Dkubernetes.service.exposed.type=NodePort



 ??



 3.2 flink 


 ??
   ./bin/flink run \
  --target kubernetes-session \
 -Dkubernetes.namespace=flink-session-cluster \
  -Dkubernetes.cluster-id=my-first-flink-cluster \
 -Dkubernetes.jobmanager.service-account=flink \
  ./examples/streaming/TopSpeedWindowing.jar


 ??


Executing TopSpeedWindowing example with default input data set.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.flink.api.java.ClosureCleaner 
(file:/home/dsi/soft/flink/flink-1.12.2/lib/flink-dist_2.11-1.12.2.jar) to 
field java.lang.String.value
WARNING: Please consider reporting this to the maintainers of 
org.apache.flink.api.java.ClosureCleaner
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-05-12 15:51:30,453 INFO 
org.apache.flink.kubernetes.KubernetesClusterDescriptor   [] 
- Retrieve flink cluster my-first-flink-cluster successfully, JobManager Web 
Interface: http://10.199.252.101:8081



The program finished with the following exception:


org.apache.flink.client.program.ProgramInvocationException: The main method 
caused an error: Failed to execute job 'CarTopSpeedWindowingExample'.
at 
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:366)
at 
org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:219)
at 
org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at 
org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:812)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:246)
at 
org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1054)
at 
org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132)
at 
org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132)
Caused by: org.apache.flink.util.FlinkException: Failed to execute job 
'CarTopSpeedWindowingExample'.
at 
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1918)
at 
org.apache.flink.client.program.StreamContextEnvironment.executeAsync(StreamContextEnvironment.java:135)
at 
org.apache.flink.client.program.StreamContextEnvironment.execute(StreamContextEnvironment.java:76)
at 
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1782)
at 
org.apache.flink.streaming.examples.windowing.TopSpeedWindowing.main(TopSpeedWindowing.java:99)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at 
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:349)
... 8 more
Caused by: org.apache.flink.runtime.client.JobSubmissionException: Failed to 
submit JobGraph.
at 
org.apache.flink.client.program.rest.RestClusterClient.lambda$submitJob$7(RestClusterClient.java:400)
at 
java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:986)
at 
java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:970)
at 

Re: ./sql-client.sh embedded 这种方式提交的flink任务怎么设置state以及checkpoint?

2021-05-11 文章 JasonLee
hi

直接在 flink-conf.yaml 文件里面配置就行了



-
Best Wishes
JasonLee
--
Sent from: http://apache-flink.147419.n8.nabble.com/


flinkSQL插入数据Illegal use of 'NULL'

2021-05-11 文章 maker_d...@foxmail.com
大家好,

我在使用FlinkCDC读取mysql数据插入到Doris,在sql-client中创建doris表与mysql表,mysql表可以同步数据,到此都没有问题。
但是当insert任务提交后数据一直不能同步,并且没有报错信息。
我将数据库中的数据编辑为单条的insert语句插入flinkSQL中的doris表,报错如下:
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of 
'NULL'
经过观察,我发现我的insert语句中,多个列的值为NULL。
请问,这种情况要如何解决,要一列一列的转化吗?(这张表非常大,列很多)
到Doris表数据不同步是否也是这个的原因?

请求各位帮助。



maker_d...@foxmail.com


./sql-client.sh embedded 这种方式提交的flink任务怎么设置state以及checkpoint?

2021-05-11 文章 董建
如题
./sql-client.sh embedded 这种方式提交的flink任务怎么设置state以及checkpoint?
还是只能把sql放在java里边,通过tableEnvironment.sqlQuery执行?

Re: prometheus metric中如何设置label

2021-05-11 文章 Tony Wei
Hi,

1、是否是这种方式增加label
>
是的,MetricGroup#addGroup(key, value) 的設計其中一個目的就是為了支援 prometheus 的 label 。


> 2、由于采用了add group的方式,导致exp对应的值里面的 ‘.’ 变成了下划线,是否有办法保持为'.'

可以透過配置 filterLabelValueCharacters: false 來關閉過濾功能 [1],但使用者需要自行確保不會有非法字元混入
label value 之中。詳細可參考文檔說明。

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/deployment/metric_reporters/#prometheus


best regards,

suisuimu <726400...@qq.com> 於 2021年5月10日 週一 下午6:32寫道:

> 基于RichMapFunction自定义Prometheus metric时增加label
> ```
> counter = this.metricGroup
> .addGroup("app", value.getAppName())
> .addGroup("exp", value.getExceptionName())
> .counter("myExpCounter");
> ```
> 通过add group可以在metric中看到label信息
> flink_taskmanager_job_task_operator_app_exp_myExpCounter{app="",endpoint="pushgateway",exp="java_io_IOException",flink_namespace="xxx",host="11_7_9_11",job="xxx",job_id="xxx",job_name="custom_log",namespace="monitoring",operator_id="cf155f65686cb012844f7c745ec70a3c",operator_name="Map",pod="pushgateway-c7648cd5c-tvfb9",service="pushgateway",subtask_index="0",task_attempt_id="7d6fd088c0628eb564753939978086eb",task_attempt_num="0",task_id="cbc357ccb763df2852fee8c4fc7d55f2",task_name="Source:_Custom_SourceMapProcessMapSink:_Print_to_Std__Out",tm_id="10_7_9_71:6122_96edca"}
>
> 想问下:
> 1、是否是这种方式增加label
> 2、由于采用了add group的方式,导致exp对应的值里面的 ‘.’ 变成了下划线,是否有办法保持为'.'
>
>
>
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>


Re: Upsert kafka 作为 source 的几个问题

2021-05-11 文章 macdoor
在做join时 ksql 会强制检查两个表的key是否相同,如果不同则报错,感觉这是一个比较好的方法。
你说 “目前 Upsert-kafka 要求具有相同key的数据在相同 partition 的。因为 kafka 仅保证 partiiton 内按
offset 读取,如果相同 key 的数据分布在不同 partition 的话,那么读取会乱序。”
flink 中两个表不使用相同的key 也可以成功 join ,但数据会出现错误,这样的话,在编译sql时报错应该更好



--
Sent from: http://apache-flink.147419.n8.nabble.com/