我有一个数组,我想在同一方法中多次使用单个值。
int[] array = new array[] {1, 2, 3};
Run Code Online (Sandbox Code Playgroud)
现在我问你如果我使用数组和索引来获取值是否会产生很大的性能问题......
int x = array[1] * 2;
int y = array[1] * 3;
int z = array[1] * 4;
Run Code Online (Sandbox Code Playgroud)
或者创建一个局部变量更好?
int value = array[1];
int x = value * 2;
int y = value * 3;
int z = value * 4;
Run Code Online (Sandbox Code Playgroud)
我知道使用局部变量更容易阅读,但它只是让我感兴趣是否它会带来任何性能差异。;-)
我当前正在开发一个Flink 1.4应用程序,该程序从Hadoop群集中读取Avro文件。但是,在我的IDE上以本地模式运行它可以很好地工作。但是,当我将其提交给Jobmanager Flink时,它总是失败,并显示以下消息:
java.io.IOException: Error opening the Input Split hdfs://namenode/topics/CaseLocations/partition=0/CaseLocations+0+0000155791+0000255790.avro [0,16549587]: Could not find a file system implementation for scheme 'hdfs'. The scheme is not directly supported by Flink and no Hadoop file system to support this scheme could be loaded.
at org.apache.flink.api.common.io.FileInputFormat.open(FileInputFormat.java:705)
at org.apache.flink.formats.avro.AvroInputFormat.open(AvroInputFormat.java:110)
at org.apache.flink.formats.avro.AvroInputFormat.open(AvroInputFormat.java:54)
at org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:145)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.flink.core.fs.UnsupportedFileSystemSchemeException: Could not find a file system implementation for scheme 'hdfs'. The scheme is not directly supported by Flink and no Hadoop file system to …Run Code Online (Sandbox Code Playgroud)