下面结构化的流媒体代码水印和窗口数据,24小时间隔,15分钟幻灯片.代码在附加模式下仅生成空的批处理0.在更新模式下,结果会正确显示.需要附加模式,因为S3接收器仅在附加模式下工作.
String windowDuration = "24 hours";
String slideDuration = "15 minutes";
Dataset<Row> sliding24h = rowData
.withWatermark(eventTimeCol, slideDuration)
.groupBy(functions.window(col(eventTimeCol), windowDuration, slideDuration),
col(nameCol)).count();
sliding24h
.writeStream()
.format("console")
.option("truncate", false)
.option("numRows", 1000)
.outputMode(OutputMode.Append())
//.outputMode(OutputMode.Complete())
.start()
.awaitTermination();
Run Code Online (Sandbox Code Playgroud)
以下是完整的测试代码:
public static void main(String [] args) throws StreamingQueryException {
SparkSession spark = SparkSession.builder().master("local[*]").getOrCreate();
ArrayList<String> rl = new ArrayList<>();
for (int i = 0; i < 200; ++i) {
long t = 1512164314L + i * 5 * 60;
rl.add(t + ",qwer");
}
String nameCol = "name";
String …Run Code Online (Sandbox Code Playgroud) 我已经使用pmap. 使用该-p选项在一台机器上的性能改进非常好。现在我想在多台机器上运行。
我--machinefile在 julia start 上使用了这个选项。它可以工作,但它只在远程机器上启动一个进程。我想在每台机器上运行多个进程。选项-p仅在本地机器上启用多个进程。有没有办法指定远程机器上的进程数?
我想有可扩展的图形,能够添加顶点和边缘,并运行dijkstra_shortest_paths算法.我无法找到正确的方法来定义图形,以便dijkstra_shortest_paths工作.以下是我的尝试.
using Graphs
g1= graph(ExVertex[], ExEdge{ExVertex}[], is_directed=false)
dist_key = "dist"
v1 = add_vertex!(g1, "a")
v2 = add_vertex!(g1, "b")
v3 = add_vertex!(g1, "c")
e12 = add_edge!(g1, v1, v2)
e12.attributes[dist_key]=1.0
e13 = add_edge!(g1, v1, v3)
e13.attributes[dist_key]=1.0
e23 = add_edge!(g1, v2, v3)
e23.attributes[dist_key]=1.0
epi = AttributeEdgePropertyInspector{Float64}(dist_key)
dijkstra_shortest_paths(g1, epi, ["a"])
Run Code Online (Sandbox Code Playgroud)
错误信息:
dijkstra_shortest_paths has no method matching dijkstra_shortest_paths(::GenericGraph{ExVertex,ExEdge{ExVertex},Array{ExVertex,1},Array{ExEdge{ExVertex},1},Array{Array{ExEdge{ExVertex},1},1}}, ::AttributeEdgePropertyInspector{Float64}, ::Array{ASCIIString,1})
Run Code Online (Sandbox Code Playgroud)