Skip to content

Add connector test for materialized view#8117

Merged
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/mvct
May 28, 2021
Merged

Add connector test for materialized view#8117
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/mvct

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented May 28, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return materialised view, as it's also a view
I don't think we have established what is the right behaviour here
We might want to list MVs in another metadata table instead of listing in information_schema.views

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// TODO should probably return materialized view, as it's also a view -- to be double checked

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, however, i would prefer to have this tested end-to-end via java.sql.DatabaseMetadata.
it then is kind of cumbersome as a connector test

@raunaqmorarka can you please file an issue to have DatabaseMetadata tested with MVs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #8128

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: separete commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side note: do we want that check actually?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@losipiuk removed for now. I think it's default IDE's behavior, so if we want to ignore it, we should document that in DEVELOP*.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue link

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raunaqmorarka is there an issue for fix Iceberg MV reporting?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW Do we have any roadmap issue for materialized views?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already have a fix for iceberg information_schema.tables listing in 5fff606

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add a test which filters byt type expecting VIEW or MATERIALIZED VIEW depending on what we settle on.

Or assert on type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@losipiuk i think we didn't settle on this yet, but that's a very good idea.

for now will have assertion like this:

.containsAll("VALUES ('" + viewName + "', 'BASE TABLE')"); // TODO table_type should probably be "* VIEW"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are you overriding those?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@losipiuk in AbstractTestIcebergConnectorTest

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@losipiuk sorry, i think i misunderstood the question.

Copy link
Copy Markdown
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
Nice to have as a base for further work on MVs.

@findepi
Copy link
Copy Markdown
Member Author

findepi commented May 28, 2021

ac

@findepi
Copy link
Copy Markdown
Member Author

findepi commented May 28, 2021

https://github.com/trinodb/trino/runs/2693225647

2021-05-28T10:19:18.4025897Z [ERROR] testCapturingSuccessfulStatement(io.trino.plugin.postgresql.TestTestingPostgreSqlServer)  Time elapsed: 0.051 s  <<< FAILURE!
2021-05-28T10:19:18.4067860Z java.lang.AssertionError: 
2021-05-28T10:19:18.4069489Z 
2021-05-28T10:19:18.4072161Z Expecting ArrayList:
2021-05-28T10:19:18.4074392Z  <[]>
2021-05-28T10:19:18.4076456Z to contain:
2021-05-28T10:19:18.4081401Z  <[RemoteDatabaseEvent{query=SELECT 1, status=RUNNING}]>
2021-05-28T10:19:18.4085770Z but could not find the following element(s):
2021-05-28T10:19:18.4090833Z  <[RemoteDatabaseEvent{query=SELECT 1, status=RUNNING}]>

cc @kokosing

@findepi
Copy link
Copy Markdown
Member Author

findepi commented May 28, 2021

It turns out Accumulo supports views, but its tests were lying it does not.
Fixing.

This also improves connector tests for view.
@Override
public void testShowCreateTable()
{
assertThat((String) computeScalar("SHOW CREATE TABLE region"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: cast to string is not needed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, but may help completion. i will keep for now, but we can remove as followup

@Override
public void testShowCreateTable()
{
assertThat((String) computeScalar("SHOW CREATE TABLE region"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: cast to string is not needed

@findepi findepi merged commit 36cada0 into trinodb:master May 28, 2021
@findepi findepi deleted the findepi/mvct branch May 28, 2021 18:15
@findepi findepi added this to the 358 milestone May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants