dolthub / dolthub-issues

Issues for dolthub.com
https://dolthub.com
4 stars 1 forks source link

Optimized cell button queries for queries with more than one table #412

Open liuliu-dev opened 1 year ago

liuliu-dev commented 1 year ago

this query for example: on prod: https://www.dolthub.com/repositories/liuliu/us-jails-1/query/main?active=Tables&q=SELECT+*+FROM+%60incidents%60+%2C+%60jails%60++where+%60incidents%60.%60id%60+%3D+%60jails%60.%60id%60+ORDER+BY+%60start_date%60+ASC%2C+%60end_date%60+ASC+LIMIT+200

on dev: https://dolthub.awsdev.ld-corp.com/repositories/liuliu/us-jails/query/main?active=Tables&q=SELECT+*+FROM+%60incidents%60+%2C+%60jails%60++where+%60incidents%60.%60id%60+%3D+%60jails%60.%60id%60+ORDER+BY+%60start_date%60+ASC%2C+%60end_date%60+ASC+LIMIT+200

clicking hide a column button, will see query error

the reason is the query is not parsed correctly to get the right table name list.

liuliu-dev commented 1 year ago

https://github.com/dolthub/ld/blob/e59772a72f4393070f84bef5efa72e76383f7ee8/go/services/dolthubapi/pkg/domain/repositorydata.go#L1905 the columns returned from this line don't have source table info, so the front end could not tell which column comes from which table when join query runs.

might need to add a source field on the Column struct in dolt?

tbantle22 commented 1 year ago

Also an issue with the show all columns button https://dolthub.awsdev.ld-corp.com/repositories/liuliu/us-jails/query/main?active=Tables&q=SELECT+incidents.*+FROM+%60incidents%60+join+%60jails%60+on+%60incidents%60.%60id%60+%3D+%60jails%60.%60id%60+ORDER+BY+%60start_date%60+ASC%2C+%60end_date%60+ASC+LIMIT+10

tbantle22 commented 1 year ago

For editing a cell, it works editing a column on the first time, but not the second

For example, for this query https://dolthub.awsdev.ld-corp.com/repositories/liuliu/us-jails/query/main?active=Tables&q=SELECT+incidents.*%2C+jails.county+FROM+%60incidents%60+join+jails+on+%60incidents%60.%60id%60+%3D+%60jails%60.%60id%60+ORDER+BY+%60start_date%60+ASC%2C+%60end_date%60+ASC+LIMIT+4

If you edit a cell in an incidents column, it generates the correct query. If you edit a cell in a jails column it uses incidents as the table still

liuliu-dev commented 1 year ago

reopen this issue since the PR only fixed the hide column button but all the buttons that involve multiple tables need a fix