I want to append to dataframe with a new map column of existing columns which start with a given common prefix.
For example, I have input of
{"Prefix_A": "v_A", "Prefix_B": "v_B", "Field": "v"},
{"Prefix_A": "v_A", "Prefix_B": "v_B", "Prefix_C": "v_C", "Field": "v"}
I want to combine all fields with prefix "Prefix_" and get an output of
{"NewColumn": {"Prefix_A": "v_A", "Prefix_B": "v_B"}, "Field": "v"},
{"NewColumn": {"Prefix_A": "v_A", "Prefix_B": "v_B", "Prefix_C": "v_C"}, "Field": "v"}
I want to do this on the fly, i.e. I don't know the columns as the data is schemaless json dump.
Further, I want to construct a new map column of existing columns which matches given regular expression.