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

Fix delete target table captured as input in event listener #16887

Closed
wants to merge 1 commit into from
Closed

Fix delete target table captured as input in event listener #16887

wants to merge 1 commit into from

Conversation

chenjian2664
Copy link
Contributor

Description

Fix #16433

Additional context and related issues

Release notes

(x) Release notes are required, with the following suggested text:

# General
* Fix delete target table captured as input in event listener ({issue}`16433`)

@cla-bot cla-bot bot added the cla-signed label Apr 5, 2023
@chenjian2664 chenjian2664 self-assigned this Apr 5, 2023
@chenjian2664 chenjian2664 requested a review from kokosing April 5, 2023 08:52
@kokosing kokosing requested a review from Praveen2112 April 5, 2023 13:24
Copy link
Member

@Praveen2112 Praveen2112 left a comment

Choose a reason for hiding this comment

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

Can we add test for DELETE in TestEventListenerBasic.

@chenjian2664
Copy link
Contributor Author

@Praveen2112 I am going to add the test cases in the assertLineage, is it reasonable, any suggestions?

@Praveen2112
Copy link
Member

Yes and can we add a prep commit - which reproduces the issue (we could catch the failure) and then apply this commit to ensure that it works as expected.

@chenjian2664
Copy link
Contributor Author

Sure, can, let me address it

@chenjian2664
Copy link
Contributor Author

chenjian2664 commented Apr 7, 2023

Sure, can, let me address it

@Praveen2112 Added a test case to reproduce it, please review it.
I commented the "Fix code" block, as you suggested, after you please with this part, I will open the code block to prove it works.

Comment on lines +1232 to +1237
private void assertIoInputTable(String sql, Set<String> inputTables)
throws Exception
{
QueryEvents queryEvents = runQueryAndWaitForEvents(sql).getQueryEvents();
QueryCompletedEvent event = queryEvents.getQueryCompletedEvent();
assertThat(event.getIoMetadata().getInputs())
.map(TestEventListenerBasic::getQualifiedName)
.containsExactlyInAnyOrderElementsOf(inputTables);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use assertLineageInternal instead of this new API ?

Copy link
Contributor Author

@chenjian2664 chenjian2664 Apr 13, 2023

Choose a reason for hiding this comment

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

Note the Line 1237 we are verify the event.getIoMetadata().getInputs() and the view creation won't have any input. Could you suggest how to use assertLineageInternal to verify?

Copy link
Member

Choose a reason for hiding this comment

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

Can you elaborate more here ? We consider the query and run other operations on top of it.

Copy link
Member

Choose a reason for hiding this comment

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

Why don't we analyze event.getMetadata().getTables()

Copy link
Member

Choose a reason for hiding this comment

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

QueryInputMetadata returns almost all the input tables that are processed by a query and if the query has views - the view information is lost in QueryInputMetadata - so we treat QueryMetadata#getTables as a source of truth for lineage details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why don't we analyze event.getMetadata().getTables()

The analyze event.getMetadata().getTables() is different from the event.getIoMetadata().getInputs(), and the pr is for fixing the delete table occurs in the event.getIoMetadata().getInputs() see #16433

Comment on lines +1232 to +1237
private void assertIoInputTable(String sql, Set<String> inputTables)
throws Exception
{
QueryEvents queryEvents = runQueryAndWaitForEvents(sql).getQueryEvents();
QueryCompletedEvent event = queryEvents.getQueryCompletedEvent();
assertThat(event.getIoMetadata().getInputs())
.map(TestEventListenerBasic::getQualifiedName)
.containsExactlyInAnyOrderElementsOf(inputTables);
Copy link
Member

Choose a reason for hiding this comment

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

Can you elaborate more here ? We consider the query and run other operations on top of it.

Comment on lines +1232 to +1237
private void assertIoInputTable(String sql, Set<String> inputTables)
throws Exception
{
QueryEvents queryEvents = runQueryAndWaitForEvents(sql).getQueryEvents();
QueryCompletedEvent event = queryEvents.getQueryCompletedEvent();
assertThat(event.getIoMetadata().getInputs())
.map(TestEventListenerBasic::getQualifiedName)
.containsExactlyInAnyOrderElementsOf(inputTables);
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we analyze event.getMetadata().getTables()

@chenjian2664
Copy link
Contributor Author

Copy link

This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua

@github-actions github-actions bot added the stale label Jan 16, 2024
@mosabua
Copy link
Member

mosabua commented Jan 16, 2024

👋 @chenjian2664 @Praveen2112 - this PR has become inactive. We hope you are still interested in working on it. Please let us know, and we can try to get reviewers to help with that.

We're working on closing out old and inactive PRs, so if you're too busy or this has too many merge conflicts to be worth picking back up, we'll be making another pass to close it out in a few weeks.

@github-actions github-actions bot removed the stale label Jan 18, 2024
Copy link

github-actions bot commented Feb 9, 2024

This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua

@github-actions github-actions bot added the stale label Feb 9, 2024
Copy link

github-actions bot commented Mar 1, 2024

Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time.

@github-actions github-actions bot closed this Mar 1, 2024
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.

DELETE target table is captured as a input in event listener
4 participants