firebase / extensions

Source code for official Firebase extensions
https://firebase.google.com/products/extensions
Apache License 2.0
888 stars 375 forks source link

extensions/firestore-bigquery-export: geopoint function args are incorrect #318

Closed vpetlu closed 4 years ago

vpetlu commented 4 years ago

[READ] Step 1: Are you in the right place?

Yes

[REQUIRED] Step 2: Describe your configuration

[REQUIRED] Step 3: Describe the problem

When exporting geolocations from Firestore into BigQuery, the args are flipped causing lats and longs to be swapped.

ST_GEOGPOINT interface definition: ST_GEOGPOINT(longitude, latitude)

firestoreGeopointDefinition code: (ST_GEOGPOINT(SAFE_CAST(JSON_EXTRACT(json, '$._latitude') AS NUMERIC), SAFE_CAST(JSON_EXTRACT(json, '$._longitude') AS NUMERIC)))

Steps to reproduce:

Expected result
Actual result
vpetlu commented 4 years ago

FYI, I have a PR ready to address this already. We've signed a CLA, waiting for the OK from Google before I submit.

russellwheatley commented 4 years ago

Thanks for reporting the issue @vpetlu, I'll take a look and report back.

vpetlu commented 4 years ago

Thanks. PR: https://github.com/firebase/extensions/pull/320

russellwheatley commented 4 years ago

Hey @vpetlu, your observation is correct, the latitude and longitude values are placed incorrectly. However, I'm having trouble replicating it in my BigQuery table views (changelog and latest). Do you mind providing me with instructions on how to reproduce, please? Thank you!

russellwheatley commented 4 years ago

Thanks for raising the issue @vpetlu I was finally able to see it in the changelog after I fixed another bug in the script. I've approved your PR even though I've also made the same change in my PR. I hope yours gets merged in before mine :)