txdong-sz commented on issue #1951:
URL: https://github.com/apache/iceberg/issues/1951#issuecomment-773271127
i donnot know how to run a daily report by flink 1.12 iceberg sql table
i write code like this but get a error
could u please help me ? thanks.
bsEnv.setRuntimeMode(RuntimeExecutionMode.BATCH);
String querySql = "SELECT
ftime,extinfo,country,province,operator,apn,gw,src_ip_head,info_str,product_id,app_version,sdk_id,sdk_version,hardware_os,qua,upload_ip,client_ip,upload_apn,event_code,event_result,package_size,consume_time,event_value,event_time,upload_time,boundle_id,uin,platform,os_version,channel,brand,model
from bfzt3 ";
Table table = tEnv.sqlQuery(querySql);
DataStream<AttaInfo> sinkStream = tEnv.toAppendStream(table,
Types.POJO(AttaInfo.class, map));
sinkStream.map(x->1).returns(Types.INT).keyBy(new
NullByteKeySelector<Integer>()).reduce((x,y) -> {
return x+y;
}).print();
sinkStream.addSink(new RichSinkFunction<AttaInfo>() {
@Override
public void invoke(AttaInfo value, Context context)
throws Exception {
Map<String, String> map2 =
value.getEvent_value();
map2.entrySet().stream().forEach(x->{
System.out.println(x.getKey()+":" +
x.getValue());
});
}
});

org.apache.flink.client.program.ProgramInvocationException: The main method
caused an error: Detected an UNBOUNDED source with the 'execution.runtime-mode'
set to 'BATCH'. This combination is not allowed, please set the
'execution.runtime-mode' to STREAMING or AUTOMATIC
at
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:360)
at
org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:213)
at
org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
at
org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:816)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:248)
at
org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1058)
at
org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1136)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1754)
at
org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
at
org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1136)
Caused by: java.lang.IllegalStateException: Detected an UNBOUNDED source
with the 'execution.runtime-mode' set to 'BATCH'. This combination is not
allowed, please set the 'execution.runtime-mode' to STREAMING or AUTOMATIC
at
org.apache.flink.util.Preconditions.checkState(Preconditions.java:193)
at
org.apache.flink.streaming.api.graph.StreamGraphGenerator.shouldExecuteInBatchMode(StreamGraphGenerator.java:335)
at
org.apache.flink.streaming.api.graph.StreamGraphGenerator.generate(StreamGraphGenerator.java:258)
at
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:1958)
at
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:1943)
at
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1782)
at
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1765)
at com.tencent.ReadStreamingZt2Cos.main(ReadStreamingZt2Cos.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:343)
... 11 more
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]