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

Refactor Table problem handling to a more robust and hopefully cleaner approach #7879

Merged
merged 73 commits into from
Oct 16, 2023

Conversation

radeusgd
Copy link
Member

@radeusgd radeusgd commented Sep 23, 2023

Pull Request Description

Closes #7514

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@radeusgd radeusgd added p-low Low priority x-chore Type: chore -libs Libraries: New libraries to be implemented labels Sep 23, 2023
@radeusgd
Copy link
Member Author

Note that during the migration we may need some workarounds to tie the old and new problem aggregation methods. These workarounds may not look perfect and they do not show a good representation of how the final approach will look like - it will start to look good once the ProblemAggregator is used all the way down the call chain. Whereas in the first steps, I migrate only some parts and do some conversions to translate between the approaches - these translations are not most pretty, but they allow us to perform the change in an incremental manner.

@radeusgd
Copy link
Member Author

First small piece done: I managed to remove getProblems from Table (which was badly tying data to problems about operations) - now some of these operations already rely on the aggregator, altough most of the inner workings still do the handling the old way.

All tests are still passing so no regressions.

We can continue this way, moving stuff piece by piece to the new approach.

@radeusgd radeusgd changed the title [DRAFT] Refactoring Table problem handling Refactor Table problem handling to a more robust and hopefully cleaner approach Oct 10, 2023
@radeusgd radeusgd marked this pull request as ready for review October 10, 2023 17:08
Comment on lines +15 to +24
public void reportColumnAggregatedProblem(ColumnAggregatedProblem problem) {
for (ColumnAggregatedProblem p : aggregatedProblemList) {
if (p.merge(problem)) {
// The problem was merged with an existing one.
return;
}
}

aggregatedProblemList.add(problem);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

ColumnAggregatedProblemAggregator is a bit of a remnant of the old logic.

We would probably have done it slightly differently with this new system. I think we could streamline its internal implementation in the future a little bit - to make it slightly more efficient.

But it currently works well and fits OK into the current architecture, so I thought there is no need to over-engineer this at this point, as I don't think it is a bottleneck by any means - if we find out it is, we can roll more specialized solutions to aggregate the ColumnAggregatedProblem more efficiently.

Copy link
Contributor

@GregoryTravis GregoryTravis left a comment

Choose a reason for hiding this comment

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

Amazing to see so many classes replaced by a single unified approach!

Copy link
Member

@jdunkerley jdunkerley left a comment

Choose a reason for hiding this comment

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

Couple of minor nits buts looks much cleaner albeit with a lot of passing aggregators round a lot more :)

Java_Problems.unpack_value_with_aggregated_problems on_problems problem_mapping=(Parse_Values_Helper.translate_parsing_problem type) <|
parser.parseIndependentValue text
Java_Problems.with_problem_aggregator on_problems java_problem_aggregator->
related_column_name = Nothing
Copy link
Member

Choose a reason for hiding this comment

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

assume this is just for clarity?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - I like to pass named arguments, but Java interop does not allow named args IIRC, so this is a way to show 'which' argument this Null is for.

# Conflicts:
#	distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Workbook.enso
#	std-bits/table/src/main/java/org/enso/table/data/column/builder/Builder.java
#	test/Table_Tests/src/In_Memory/Builders_Spec.enso
@radeusgd radeusgd added the CI: Ready to merge This PR is eligible for automatic merge label Oct 16, 2023
@mergify mergify bot merged commit 08b717e into develop Oct 16, 2023
@mergify mergify bot deleted the wip/table-problem-handling-refactor branch October 16, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-libs Libraries: New libraries to be implemented CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge p-low Low priority x-chore Type: chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean-up problem handling in Table Java helper libraries
3 participants