Does mode support UDF with bigquery?

Hi there,

I have a query works well in bigquery, but mode is throwing error:

Syntax error: Unclosed triple-quoted string literal

here is the query. Am I missing anything?

#standardSQL

CREATE TEMP FUNCTION JsonArray(input STRING)
    RETURNS ARRAY<STRING>
    LANGUAGE js AS """
    return JSON.parse(input);
""";
SELECT JsonArray('["x","y","z"]')

Thanks,

Stone

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Stone Zhong , This is currently a known issue in Mode.  We've filed it with the development team and will let you know when we think we have a fix for this issue.  Thanks!

    Reply Like
  • Thank you Donna for the prompt response.

    Regards,

    Stone

    Reply Like
  • Is UDF something that works nowadays? 

    Reply Like
  • Hi  Stone Zhong and Andreas Rolén , we had recently fixed this issue. Before, if there's code block that contains a semi-colon, it will automatically split the query and break SQL parsing. Now, if you don't want Mode processing to split a sequence of commands on a semi-colon, you place it inside angle brackets like this: <;>. This sequence tells Mode processing to change <;> to ; wherever it occurs and then send the entire command string to the DB on the backend (whatever type that is). For example:

    CREATE TEMP FUNCTION multiplyInputs(x FLOAT64, y FLOAT64)
    RETURNS FLOAT64
    LANGUAGE js AS """
      return x*y<;>
    """<;>
    Reply Like
Like Follow
  • Status Answered
  • 3 wk agoLast active
  • 4Replies
  • 725Views
  • 5 Following

Create A New Discussion

Share your thoughts