I'm trying to do a workaround in pyflink UDAF to r...
# troubleshooting
d
I'm trying to do a workaround in pyflink UDAF to return multiple rows of data. I'd like to return an Array of Rows which contain my data. When doing this I get an error that seems to indicate it's not possible:
ValueError: ROW is not supported to be used as the element type of ArrayType.
is there a work around here?
What I'm trying to accomplish is this: • My data science team would like to process a time based window, and produce interpolated points as a result. • There may be more than one point during the window that needs to be interpolated • I'm ok with producing the data into a separate stream and joining it later • I guess they are trying to treat the UDF as a black box and do all the data processing inside the box, then return all the results they want. This is making my life extremely painful in the flink world.
j
Note sure why it's required to modify udaf. To my understanding, interpolated points may be returned after being concatenated by comma. Then we'd be able to apply udtf to unnest those?
d
Well my interpolated points would need two fields: time, value
So wouldn’t I need to return an array of tuples?
j
By creating a UDF, we can have control over the way how to split it. For example, the example UDF splits string into a word and length of the word - https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/python/table/udfs/python_udfs/#table-functions
d
I don’t understand
j
I may not fully understand your problem so that my suggestion may not make sense. The bottom line is, as long as records are properly concatenated, we can parse it with a udf.
d
Ah, are you saying I could return: Row(Array(timestamp), Array(signal))
ok, I think this is what you were getting at and this does solve my issue