我把一个图像转换成一个二维的整数数组。对此进行一些处理,然后尝试以这样的方式发出数组:
collector.emit( new Values ( scaledImageMatrix ) );然后我试图在另一个闪电中检索数据,像这样:
int [][] imageMatrix = input.get("scaled-image-matrix");但我明白错误
incompatible types
[ERROR] found : java.lang.Object
[ERROR] required: int[][]有什么建议吗?
最新情况:
我试过这个int [][] imageMatrix = (int[][])input.get("scaled-image-matrix");
我得到了一个错误:
java.lang.IllegalArgumentException: Tuple created with wrong number of fields. Expected 1 fields but got 190 fields然后,我应该将我的问题改为:如何发出二维数组?
发布于 2014-08-13 16:26:07
发布于 2017-05-05 12:02:12
我知道这是个老问题,但这也是有用的。基元数组可以像其他任何对象一样在execute(Tuple input)方法中发出和接收,您只需要使用getValue(fieldName)方法而不是get(fieldName)
int[][] imageMatrix = (int[][]) input.getValue("scaled-image-matrix")https://stackoverflow.com/questions/25290778
复制相似问题