Skip to content

Conversation

@c-f-cooper
Copy link
Contributor

@c-f-cooper c-f-cooper commented Apr 28, 2023

Change Logs

use try with resource to close stream

Impact

If input streams are not properly closed after use, it can potentially affect the normal execution of commands or programs.

Risk level (write none, low medium or high below)

there is a low level

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • [ v] Read through contributor's guide
  • [ v] Change Logs and Impact were stated clearly
  • [ v] Adequate tests were added if applicable
  • [ v] CI passed

@danny0405 danny0405 added the type:refactor Code refactoring and cleanup label Apr 28, 2023
@Test
public void testOverwriteHoodiePropertiesWithInputStreamFix() throws IOException {
RepairsCommand command = new RepairsCommand();
URL newProps = this.getClass().getClassLoader().getResource("table-config.properties");
Copy link
Contributor

Choose a reason for hiding this comment

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

Most of the test items are similiar with testOverwriteHoodieProperties ?

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, their general test logic are similar."

Copy link
Contributor

@danny0405 danny0405 May 4, 2023

Choose a reason for hiding this comment

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

What's the difference, can you explain the test purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The purpose of the test is to call this method and check whether the inputStream is working properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

to call this method

Which method is called here, does testOverwriteHoodieProperties already cover the code path?

Copy link
Contributor

Choose a reason for hiding this comment

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

So testOverwriteHoodieProperties already covers this, can you just take an offline validation instead, we can get rid of these UTs if manual test passes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry,I don't understand how to validate,and how to get rid of these UTs,can you help me?

Copy link
Contributor

Choose a reason for hiding this comment

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

get rid of these UTs

I mean there is no need to add UTs, instead, validate these two commds you have modified offline to make sure it works correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK,understand!

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 delete the redundant UTs,and run the exists UTs to validate the commands,it works correctly.

@danny0405 danny0405 changed the title [BUG-FIX] use try with resource to close stream [MINOR] Use try with resource to close stream May 4, 2023
@danny0405 danny0405 self-assigned this May 4, 2023
@danny0405 danny0405 added the priority:medium Moderate impact; usability gaps label May 4, 2023
@danny0405
Copy link
Contributor

The CI is failing, can you check it.

@c-f-cooper
Copy link
Contributor Author

The CI is failing, can you check it.

yeah,found the problem.

@ShellOption(value = {"--repairedOutputPath"}, help = "Location to place the repaired files")
final String repairedOutputPath,
@ShellOption(value = {"--duplicatedPartitionPath"}, defaultValue = "", help = "Partition Path containing the duplicates") final String duplicatedPartitionPath,
@ShellOption(value = {"--repairedOutputPath"}, help = "Location to place the repaired files") final String repairedOutputPath,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we do these format changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why we do these format changes

I used the shortcut keys in IntelliJ IDEA to format it.

@hudi-bot
Copy link
Collaborator

hudi-bot commented May 8, 2023

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@danny0405
Copy link
Contributor

The failure is known to be flaky, would merge it soon ~

@danny0405 danny0405 merged commit aa3ef4b into apache:master May 8, 2023
yihua pushed a commit to yihua/hudi that referenced this pull request May 15, 2023
yihua pushed a commit to yihua/hudi that referenced this pull request May 15, 2023
yihua pushed a commit to yihua/hudi that referenced this pull request May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Moderate impact; usability gaps type:refactor Code refactoring and cleanup

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants