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

STAR Selection: Result predictable order of columns #2

Open
pgollangi opened this issue Jan 3, 2023 · 4 comments
Open

STAR Selection: Result predictable order of columns #2

pgollangi opened this issue Jan 3, 2023 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@pgollangi
Copy link
Owner

When all fields of Firestore documents selected using STAR selection (select * from users), the order of columns resulted is not always same.
This is because when STAR selected, FireQL don't explicitly request column selections to get all fields of Firestore collection and uses data returned by Firestore.DocumentSnapshot which is a map field and value pair where order of key is not always same.

One way to return the same columns always would be by sorting columns (map keys) returned by DocumentSnapshot.Data

@pgollangi pgollangi added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 3, 2023
@rafiramadhana
Copy link

does it mean we need to sort the columns (selectedColumns) before exiting this if-else statement select.go#L109?

if starIdx != -1 {
    ...
        }
        starIdx++
    }
    // TODO: Sort selectedColumns before exiting this if-else statement
}

@pgollangi
Copy link
Owner Author

Hi @rafiramadhana thanks a lot for your interest in this project.

Sorting selectedColumns would possibly change the position of other selected columns along with *. For example select user_id, *, account_id from users should list user_id first and account_id last in resulted columns and remaining all columns in order in place of *.

You could possible collect all fields from data and sort then add it to selectedColumns rather than adding it on-the-fly.

@rafiramadhana
Copy link

rafiramadhana commented Nov 24, 2023

@pgollangi i see, to spawn a mocked firestore in local, is it enough by doing these steps?

btw is there any UI/CLI app to interact with the mocked firestore? like for seeing data, updating data, adding collection, etc

@pgollangi
Copy link
Owner Author

@rafiramadhana yes thats right. I generally follow programatical way of manage firestore data, I found it easy. however there are many open-source and commercial tools to connect firestore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants