Skip to content

Conversation

@alex-plekhanov
Copy link
Contributor

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


/**
* Creates a ConverterRule.
*/
public TableModifyConverterRule() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

But TableModifySingleNodeConverterRule is instance of ConverterRule, nothing wrong here.

// Check UPDATE statements.

// partitioned.
assertPlan("UPDATE test SET val = val + 1", schema,
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks really too short check. Maybe we need to search for Excnanheg/Aggregates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We check full plan bellow TableModify, Above distributed table modify aggregates/exchange/project never change. Correctness of the full plan is verified by integration tests (TableDmlIntegrationTest at least)


// partitioned.
assertPlan("UPDATE test SET val = val + 1", schema,
hasChildThat(isInstanceOf(IgniteTableModify.class).and(hasDistribution(IgniteDistributions.random()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why random(), not hash() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an output distribution conaining only one column (count of affected rows), it's not hashed on any key.

* Converts LogicalTableModify to distributed IgniteTableModify (Perform table modify on remote nodes,
* aggregate affected rows count and send result to the initiator node).
*/
public class TableModifyDistributedConverterRule extends AbstractIgniteConverterRule<LogicalTableModify> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if underlying cache has a node filer? Do we need to consider it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two cases:

  • when TableModify affects data source, we only allow the same hash distribution on input as on modified table, so node filter on modified table and on input data will be the same.
  • when TableModify doesn't affect data source, in this case we allow any distributed input and shouldn't be care about node filter.

.and(input(isTableScan("TEST_REPL"))));

// broadcast (force distributed).
assertPlan("UPDATE test_repl SET val = val + 1", schema,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it duplicate or corrupt data? Or TrimExchange prevents?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, trim exchange prevents.


/** Tests that table modify can be executed on remote nodes. */
@Test
public void testDistributedTableModify() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need tests with filters (WHERE )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added one test for UPDATE with change indexed column, since it adds spool to the plan, in other cases this filter will not change anything.


/**
* Creates a ConverterRule.
*/
public TableModifyConverterRule() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

But TableModifySingleNodeConverterRule is instance of ConverterRule, nothing wrong here.

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

Successfully merging this pull request may close these issues.

2 participants