Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Stream Firestore to BigQuery] gen-schema-view script: create optimal *view_latest query #2143

Open
blikblum opened this issue Aug 13, 2024 · 0 comments
Labels
type: feature request New feature or request

Comments

@blikblum
Copy link

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

Issues filed here should be about a feature request for a Stream Firestore to BigQuery. To file a feature request that affects multiple extensions or the Firebase Extensions platform, please reach out to
Firebase support directly.

[REQUIRED] Step 2: Extension name

This feature request is for extension: _ Stream Firestore to BigQuery

What feature would you like to see?

The script gen-schema-view creates *view_latest queries with redundant operations.

The generated *view_latest query uses *raw_latest query that already exclude 'DELETE' operations and outdated versions

So the generated *view_latest query can remove is_deleted field since is always false and remove schema field partitioning e.g:

for each schema field, instead of

      FIRST_VALUE(JSON_EXTRACT_SCALAR(data, '$.gender')) OVER(
        PARTITION BY document_name
        ORDER BY
          timestamp DESC
      ) AS gender,

generate

JSON_EXTRACT_SCALAR(data, '$.gender') AS gender,

BTW: the comment in the generated query ("-- Given a user-defined schema over a raw JSON changelog, returns the") suggest that is was using previously the *raw_changelog table that would make sense the field partitioning and is_deleted check. This not true anymore

How would you use it?

The query/view performance would be optimal and easier to understand

@blikblum blikblum added the type: feature request New feature or request label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant