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

MINOR: Make ColumnPath immutable #1380

Merged

Conversation

findepi
Copy link
Member

@findepi findepi commented Jun 20, 2024

Make sure you have checked all steps below.

Jira

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason: I don't know of an estabilished way of testing for class immutability

Commits

  • My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines
    from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Style

  • My contribution adheres to the code style guidelines and Spotless passes.
    • To apply the necessary changes, run mvn spotless:apply -Pvector-plugins

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain Javadoc that explain what it does

@findepi
Copy link
Member Author

findepi commented Jun 20, 2024

cc @raunaqmorarka

  • My PR addresses the following Parquet Jira issues and references
    them in the PR title.

not yet. I will create one if needed

@@ -83,6 +83,6 @@ public int size() {
}

Copy link

@raunaqmorarka raunaqmorarka Jun 21, 2024

Choose a reason for hiding this comment

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

I think it would also help to have a boolean equals(String[] path) method so that we can make path equality checks without incurring an unnecessary array copy.

Copy link
Member Author

Choose a reason for hiding this comment

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

I know it could be useful for Parquet users such as Trino, but was hesitant to add this as not directly related to immutability. Since toArray became copying, i added toList which avoids copy. Maybe this new method also satisfies those needs and we don't need yet another one?

Choose a reason for hiding this comment

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

ya, i think that new method will help

@findepi findepi force-pushed the findepi/make-columnpath-immutable-b03814 branch 3 times, most recently from 02fc946 to 3b82f09 Compare June 22, 2024 10:14
@@ -83,6 +83,6 @@ public int size() {
}

Choose a reason for hiding this comment

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

ya, i think that new method will help

@wgtmac
Copy link
Member

wgtmac commented Jul 3, 2024

It seems that you need to run mvn spotless:apply to make the CIs happy.

findepi added 2 commits July 3, 2024 20:06
Similar to `ColumnPath.toArray`, but avoids copying the path.
@findepi findepi force-pushed the findepi/make-columnpath-immutable-b03814 branch from 3b82f09 to 195cee8 Compare July 3, 2024 18:06
@findepi
Copy link
Member Author

findepi commented Jul 3, 2024

@wgtmac thanks! can you please allow the workflow again? It passed on my fork this time.

@wgtmac
Copy link
Member

wgtmac commented Jul 4, 2024

BTW, could you please create an issue to explain why do we need this change?

https://github.com/apache/parquet-java/issues/new/choose

@findepi
Copy link
Member Author

findepi commented Jul 4, 2024

I don't think i can describe my reasoning in terms of a end-user perceivable bug. I do believe immutable objects are easier to reason about and ColumnPath looks like it was intended not to be mutated.

@wgtmac wgtmac changed the title Make ColumnPath immutable MINOR: Make ColumnPath immutable Jul 4, 2024
Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

+1

Thanks @findepi and @raunaqmorarka!

@wgtmac wgtmac merged commit 515ed4c into apache:master Jul 9, 2024
9 checks passed
@findepi findepi deleted the findepi/make-columnpath-immutable-b03814 branch July 9, 2024 12:15
@wgtmac wgtmac added this to the 1.15.0 milestone Sep 30, 2024
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.

3 participants