unytics/bigfunctions

[bug]: `faker`: latlng & local_latlng - BigQuery JSON decode error

cachatj opened this issue · 3 comments

Check the bug has not already been reported

Edit function_name and the short error description in title above

  • I wrote the correct function name and a short error description in the title above

What happened and what did you expect?

Testing the example bigfunctions.us.faker options, and am particularly interested in generating latitude and longitude coordinates. Build on example given on website, and ran following query:

SELECT
bigfunctions.us.faker("name", "en_US") as name, 
bigfunctions.us.faker("address","en_US") as address,
bigfunctions.us.faker("local_latlng", "en_US") as local_latlng

errors out saying: Failed to decode JSON value ["42.55308","-87.93341","Pleasant Prairie","US","America/Chicago"] in replies to SQL type STRING.

attempted to CAST as STRING, attempted a few JSON_EXTRACT & JSON_VALUE BQ functions - but could never get the proper data to return.

Please advise

Thanks a lot for opening this issue @cachatj 🙌

I just fixed the problem.
I close the issue but don't hesitate to re-open it if it's not ok.

Here is the commit.

wonderful. now, the next challenge - faker generating location history for a object traveling around city.

Essentially, generate timestamp, lat, long coordinates for a device/individual going about their day from home to work to lunch to work to store to home - for movement pattern analysis.

not sure faker can do that....but if you have any thoughts, please share.

I think you want to read this Jonathan.

https://carto.com/blog/how-to-do-route-optimization-at-scale-with-carto-bigquery

Not sure it will completely answer your need but you may find inspiration