Skip to content

spanner/spansql: Support subselect and maybe other limitations for spansql parser #8519

@asetty

Description

@asetty

I'm using spannertest and I have the following query:

SELECT
    subTable.Foo AS FooValue,
    IFNULL(COUNT(t.UUID), 0) AS count
FROM
    (SELECT DISTINCT TestColumn FROM TestTable) subTable
LEFT JOIN TestTable t
ON
    subTable.TestColumn = t.TestColumn AND t.ProvisionDate IS NULL
GROUP BY subTable.TestColumn

Using spannertest I get the following error: I also added the value of tok, and tok.typ to the original error for debugging:

spanner: code = "InvalidArgument", desc = "bad query: -:6: expected identifier tok=\"(\", tok.typ=0"

I'm pretty sure the subquery "(SELECT DISTINCT TestColumn FROM TestTable) subTable" is giving the issue as I noticed subselects were not supported. I enabled debug for spansql and am trying to understand a bit for myself how we could go about supporting this, but wanted to raise the issue and see if anyone else has already thought about this or is working on support.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p3Desirable enhancement or fix. May not be included in next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions