0

I have a parameter of type List<String> I want to pass to a Dataflow job using the web UI. Whats the right way to do that? I tried some intuitive ways like passing JSON or same key multiple times, but it did not work.

Any intuitive formats like foo,bar or [foo,bar] or ["foo","bar"] etc result in

java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('foo,bar') at [Source: (String)""foo,bar""; line: 1, column: 1]

Error is pretty self explanatory, but it seems like this use case should be quite common and should be supported out of the box, with out using JSONArray (or some other custom type) in place of your List.

kot
  • 65
  • 1
  • 7
  • Can you share more details like how are you able to run a job via UI, the code used to run the dataflow job, etc. Just so the community can easily reproduce your issue. If it's not working, what's the error message? For additional reference, see this [guideline](https://stackoverflow.com/help/minimal-reproducible-example). – Ricco D Oct 19 '21 at 03:46
  • values comma separated doesn't work? – guillaume blaquiere Oct 19 '21 at 07:48
  • I was hoping answer would be as simple as I missed the relevant part in the docs. The error is pretty self explanatory - java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('foo,bar') at [Source: (String)""foo,bar""; line: 1, column: 1] – kot Oct 19 '21 at 16:23
  • I worked around it by changing my List to org.json.JSONArray and passed a properly formatted JSON array as argument to my job, but intuitively it seems like there should be a cleaner way to pass a List. – kot Oct 19 '21 at 16:24
  • @kot you can post your work around as an answer and accept it for future community reference. – Ricco D Oct 20 '21 at 03:27

0 Answers0