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

RFC: create Join MV should not allow same column name #1331

Closed
BowenXiao1999 opened this issue Mar 28, 2022 · 3 comments
Closed

RFC: create Join MV should not allow same column name #1331

BowenXiao1999 opened this issue Mar 28, 2022 · 3 comments
Assignees

Comments

@BowenXiao1999
Copy link
Contributor

BowenXiao1999 commented Mar 28, 2022

Previously in java, we are expressing a MV like this:
https://github.com/singularity-data/risingwave/blob/347589e03f854c995ccbfcd74c6f349214991421/e2e_test/streaming/join.slt#L4-L23
That is, we do not need to specify column name when create streaming join (select * from t1 INNER JOIN t2 ON t1.v1=t2.v1). And we use a very hack way to express same column name columns (v10, v20 etc). Of courser users won't know this when use, so we must change it in a way.

The question is how to express same column name in a single relation. As @xiangjinwu points out, PG do not support it. #1283 (comment)

Now we are using a new way, always specify column name when create join MV (or your input has same column name). #1291. But the problem is, it makes user's efforts to express a All column CROSS JOIN.

After offline discuss with @xiangjinwu , I think a better way is: We do not allow same column name in a MV. However, it is user's responsibility to do not allow same column name in output:

create materialized view mv1 as select A.v1, B.v1 from A, B where A.v1 = B.v1 // fail
create materialized view mv1 as select * from A, B where A.v1 = B.v1 // fail
create materialized view mv1 as select A.v1 from A, B where A.v1 = B.v1 // success
create materialized view mv1 as select A.v1, B.v1 as v10 from A, B where A.v1 = B.v1 // success
@BowenXiao1999 BowenXiao1999 changed the title RFC: Always specify column name when create MV Join? RFC: create Join MV should not allow same column name? Mar 28, 2022
@BowenXiao1999 BowenXiao1999 changed the title RFC: create Join MV should not allow same column name? RFC: create Join MV should not allow same column name Mar 28, 2022
@yuhao-su
Copy link
Contributor

Could we unify the naming behavior with batch join?

@BowenXiao1999
Copy link
Contributor Author

Could we unify the naming behavior with batch join?

The tricky part is: Batch join allows this. Because database do not need to memorize batch query results, so it do not need to worry about how to store two column with same name. But create MV is not allowed.. MV will be persistent and query later

@BowenXiao1999
Copy link
Contributor Author

Closed via #1363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants