Skip to content

[FEATURE] Support composability of views, materialised views, subqueries and user space tables. #629

@general-kroll-4-life

Description

@general-kroll-4-life

Feature Description

On ought to be able to select from joins of views, materialised views, subqueries and user space tables.

Example(s)

Please contrive from reality. This will form the basis of robot regression testing.

Possible Approaches or Libraries to Consider

See below.

Additional context

Unfortunately the data flow analysis is interwoven into multiple passes so this will not be simple. The high level expectation is that data flow analysis is not skipped or weakened. Views have the "novel" feature that where clauses can be rewritten externally, complicating matters.

Here is an illustrative example in a stackql shell session:


stackql  >>describe google.storage.buckets;
|-----------------------|---------|
|         name          |  type   |
|-----------------------|---------|
| id                    | string  |
|-----------------------|---------|
| name                  | string  |
|-----------------------|---------|
| acl                   | array   |
|-----------------------|---------|
| autoclass             | object  |
|-----------------------|---------|
| billing               | object  |
|-----------------------|---------|
| cors                  | array   |
|-----------------------|---------|
| customPlacementConfig | object  |
|-----------------------|---------|
| defaultEventBasedHold | boolean |
|-----------------------|---------|
| defaultObjectAcl      | array   |
|-----------------------|---------|
| encryption            | object  |
|-----------------------|---------|
| etag                  | string  |
|-----------------------|---------|
| generation            | string  |
|-----------------------|---------|
| hardDeleteTime        | string  |
|-----------------------|---------|
| hierarchicalNamespace | object  |
|-----------------------|---------|
| iamConfiguration      | object  |
|-----------------------|---------|
| ipFilter              | object  |
|-----------------------|---------|
| kind                  | string  |
|-----------------------|---------|
| labels                | object  |
|-----------------------|---------|
| lifecycle             | object  |
|-----------------------|---------|
| location              | string  |
|-----------------------|---------|
| locationType          | string  |
|-----------------------|---------|
| logging               | object  |
|-----------------------|---------|
| metageneration        | string  |
|-----------------------|---------|
| objectRetention       | object  |
|-----------------------|---------|
| owner                 | object  |
|-----------------------|---------|
| projectNumber         | string  |
|-----------------------|---------|
| retentionPolicy       | object  |
|-----------------------|---------|
| rpo                   | string  |
|-----------------------|---------|
| satisfiesPZI          | boolean |
|-----------------------|---------|
| satisfiesPZS          | boolean |
|-----------------------|---------|
| selfLink              | string  |
|-----------------------|---------|
| softDeletePolicy      | object  |
|-----------------------|---------|
| softDeleteTime        | string  |
|-----------------------|---------|
| storageClass          | string  |
|-----------------------|---------|
| timeCreated           | string  |
|-----------------------|---------|
| updated               | string  |
|-----------------------|---------|
| versioning            | object  |
|-----------------------|---------|
| website               | object  |
|-----------------------|---------|
stackql  >>select name, updated from google.storage.buckets where project = 'stackql-demo';
|----------------------------------|--------------------------|
|               name               |         updated          |
|----------------------------------|--------------------------|
| demo-app-bucket1                 | 2025-08-03T07:01:59.323Z |
|----------------------------------|--------------------------|
| demo-app-bucket2                 | 2025-08-03T07:01:59.758Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-001         | 2026-02-26T22:39:28.525Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-002         | 2026-02-26T22:40:39.282Z |
|----------------------------------|--------------------------|
| stackql-demo-bucket              | 2025-08-03T07:01:59.747Z |
|----------------------------------|--------------------------|
| stackql-demo-src-bucket          | 2025-08-03T07:01:59.749Z |
|----------------------------------|--------------------------|
| stackql-demo.appspot.com         | 2025-08-03T07:01:59.818Z |
|----------------------------------|--------------------------|
| stackql-encrypted-bucket-1       | 2025-08-03T07:01:59.770Z |
|----------------------------------|--------------------------|
| stackql-rag-demo                 | 2025-11-09T21:57:24.135Z |
|----------------------------------|--------------------------|
| staging.stackql-demo.appspot.com | 2025-08-03T07:01:59.823Z |
|----------------------------------|--------------------------|
stackql  >>create or replace view vw1 as select name, updated from google.storage.buckets where project = 'stackql-demo';
DDL Execution Completed
stackql  >>create or replace materialized view mv1 as select name, updated from google.storage.buckets where project = 'stackql-demo';
DDL Execution Completed
stackql  >>select * from vw1;
|----------------------------------|--------------------------|
|               name               |         updated          |
|----------------------------------|--------------------------|
| demo-app-bucket1                 | 2025-08-03T07:01:59.323Z |
|----------------------------------|--------------------------|
| demo-app-bucket2                 | 2025-08-03T07:01:59.758Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-001         | 2026-02-26T22:39:28.525Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-002         | 2026-02-26T22:40:39.282Z |
|----------------------------------|--------------------------|
| stackql-demo-bucket              | 2025-08-03T07:01:59.747Z |
|----------------------------------|--------------------------|
| stackql-demo-src-bucket          | 2025-08-03T07:01:59.749Z |
|----------------------------------|--------------------------|
| stackql-demo.appspot.com         | 2025-08-03T07:01:59.818Z |
|----------------------------------|--------------------------|
| stackql-encrypted-bucket-1       | 2025-08-03T07:01:59.770Z |
|----------------------------------|--------------------------|
| stackql-rag-demo                 | 2025-11-09T21:57:24.135Z |
|----------------------------------|--------------------------|
| staging.stackql-demo.appspot.com | 2025-08-03T07:01:59.823Z |
|----------------------------------|--------------------------|
stackql  >>select * from mv1;
|----------------------------------|--------------------------|
|               name               |         updated          |
|----------------------------------|--------------------------|
| demo-app-bucket1                 | 2025-08-03T07:01:59.323Z |
|----------------------------------|--------------------------|
| demo-app-bucket2                 | 2025-08-03T07:01:59.758Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-001         | 2026-02-26T22:39:28.525Z |
|----------------------------------|--------------------------|
| silly-bucket-st-demo-002         | 2026-02-26T22:40:39.282Z |
|----------------------------------|--------------------------|
| stackql-demo-bucket              | 2025-08-03T07:01:59.747Z |
|----------------------------------|--------------------------|
| stackql-demo-src-bucket          | 2025-08-03T07:01:59.749Z |
|----------------------------------|--------------------------|
| stackql-demo.appspot.com         | 2025-08-03T07:01:59.818Z |
|----------------------------------|--------------------------|
| stackql-encrypted-bucket-1       | 2025-08-03T07:01:59.770Z |
|----------------------------------|--------------------------|
| stackql-rag-demo                 | 2025-11-09T21:57:24.135Z |
|----------------------------------|--------------------------|
| staging.stackql-demo.appspot.com | 2025-08-03T07:01:59.823Z |
|----------------------------------|--------------------------|
stackql  >>select vw1.name as vn, mv1.updated as mvu from vw1 inner join mv1 on vw1.name = mv1.name;
alias 'vw1' does not map to any table expression

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions