-
Notifications
You must be signed in to change notification settings - Fork 84
Consistent hashing and equal methods #1732
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
Open
CaiJimmy
wants to merge
53
commits into
master
Choose a base branch
from
jimmy/consistent-hash
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 40 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
bf91e1a
Refactor equality and hash code implementations using Lombok's @Equal…
CaiJimmy 0831a8c
Refactor equality and hash code methods in FunctionSignature using Lo…
CaiJimmy 8824590
Add Lombok's @EqualsAndHashCode annotation to ErrorItemType class
CaiJimmy b9b74a2
Refactor XML and ItemType classes for improved equality handling
CaiJimmy 0e50251
Added explicit atomic value-comparison adapters for distinct-values, …
CaiJimmy 2ee2830
Fix FlworKey hashcode
CaiJimmy c44aab2
Undo FlowrKey change
CaiJimmy eca347f
Fix test cases that depended on order of group by
CaiJimmy ec86521
Add serialVersionUID to AbstractItemType for serialization compatibility
CaiJimmy e939bce
Add serialVersionUID for serialization compatibility in AbstractArray…
CaiJimmy e41f5bc
Add order by clause to group by test cases for consistent output
CaiJimmy 853f8f2
Test CI
CaiJimmy 477dd16
Trigger Build
CaiJimmy 0be6ac0
Trigger Build
CaiJimmy 4fd5680
Trigger Build
CaiJimmy d90bbdc
Implement Serializable interface in NamespaceDeclaration class
CaiJimmy 9d1b7b1
Enhance whitespace handling in DirectConstructorUtils and add test ca…
CaiJimmy 1bca2c9
Update boundarySpacePreserve setting to false in StaticContext and un…
CaiJimmy 905d5d9
Cover default boundary-space stripping
CaiJimmy e08a130
Refactor DirectConstructorUtils to use ElementContentBuilder for impr…
CaiJimmy dfd8270
Merge branch 'master' into jimmy/replace-hash-equal
CaiJimmy 2932ddd
Add space
CaiJimmy a1d3a3b
Merge branch 'jimmy/replace-hash-equal' into jimmy/consistent-hash
CaiJimmy 6e68bdc
Merge master branch
CaiJimmy c2b95d2
Apply spotless
CaiJimmy 9a0b2ff
Switch back to QT3 master
CaiJimmy c64ff4c
Add serialVersionUID to AbstractNodeItem for serialization compatibility
CaiJimmy 16e442a
Clarify equality check in AbstractNodeItem with additional comments
CaiJimmy c744296
Refactor equality and hashCode methods in AbstractArrayItem for consi…
CaiJimmy ac94017
Refactor equality and hashCode methods in AbstractMapItem for consist…
CaiJimmy c708b42
Add Apache header
CaiJimmy 78cd90b
Refactor MapAtomicSameKey to use primitive type for type checking; en…
CaiJimmy 69770f1
Remove unrelated test
CaiJimmy 08fc3fe
Update expected output for distinct-values test case to reflect corre…
CaiJimmy 8aacad8
Refactor comparison logic in SwitchRuntimeIterator and SwitchStatemen…
CaiJimmy eec4649
Float/double-to-decimal casts now preserve the exact binary value
CaiJimmy 36b9a42
Refactor DistinctValuesFunctionIterator to resolve collation using Co…
CaiJimmy 294e3e4
Enhance AtomicValueComparison and AtomicValueComparisonKey to support…
CaiJimmy c0fbf8e
Enhance DecimalItem to support display values for precise serializati…
CaiJimmy 033f9f6
Simplify equals in AbstractArrayItem
CaiJimmy ce1ed34
Preserve concise lexical decimal form in ValidateTypeIterator instead…
CaiJimmy de549d1
Remove unused JSoundDataFrame import and method from DistinctValuesFu…
CaiJimmy 4f6561f
Add getDataFrame method to DistinctValuesFunctionIterator for DataFra…
CaiJimmy b379d9b
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy 30af7ee
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy a9bf2d7
Enable DataFrame support in DistinctValuesFunctionIterator
CaiJimmy 1fc3e98
Clarify DataFrame handling in getDataFrame method for distinct values
CaiJimmy c0cb218
Refactor AnnotatedItem and AtomicValueComparisonKey classes to use fi…
CaiJimmy 773b07c
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy 0a02d5c
Add @NoArgsConstructor annotation to AnnotatedItem and AtomicValueCom…
CaiJimmy 8c4d35f
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy c6d4455
Update AtomicValueComparisonKey constructor to include ExceptionMetad…
CaiJimmy c366c41
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.rumbledb.items; | ||
|
|
||
| import java.io.Serial; | ||
| import java.util.List; | ||
|
|
||
| import org.rumbledb.api.Item; | ||
|
|
||
| /** | ||
| * Structural Java equality for both JSON arrays and XDM sequence-member arrays. | ||
| */ | ||
| public abstract class AbstractArrayItem implements Item { | ||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Override | ||
| public final boolean equals(Object other) { | ||
| if (this == other) { | ||
| return true; | ||
| } | ||
| if (!(other instanceof Item otherItem) || !otherItem.isArray()) { | ||
| return false; | ||
| } | ||
| return this.getSequenceMembers().equals(otherItem.getSequenceMembers()); | ||
| } | ||
|
|
||
| @Override | ||
| public final int hashCode() { | ||
| int result = 1; | ||
| for (List<Item> member : this.getSequenceMembers()) { | ||
| result = 31 * result + member.hashCode(); | ||
| } | ||
| return result; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.rumbledb.items; | ||
|
|
||
| import org.rumbledb.api.Item; | ||
|
|
||
| import java.io.Serial; | ||
|
|
||
| /** | ||
| * Base class that gives every atomic item one Java equality and hashing contract. | ||
| */ | ||
| public abstract class AbstractAtomicItem implements Item { | ||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Override | ||
| public final boolean equals(Object other) { | ||
| return other instanceof Item item && AtomicItemEquivalence.equivalent(this, item); | ||
| } | ||
|
|
||
| @Override | ||
| public final int hashCode() { | ||
| return AtomicItemEquivalence.hash(this); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.rumbledb.items; | ||
|
|
||
| import java.io.Serial; | ||
| import java.util.List; | ||
|
|
||
| import org.rumbledb.api.Item; | ||
|
|
||
| /** | ||
| * Order-independent structural Java equality for every materialized and lazy map representation. | ||
| */ | ||
| public abstract class AbstractMapItem implements Item { | ||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @Override | ||
| public final boolean equals(Object other) { | ||
| if (this == other) { | ||
| return true; | ||
| } | ||
| if (!(other instanceof Item otherItem) || !otherItem.isMap() || this.getSize() != otherItem.getSize()) { | ||
| return false; | ||
| } | ||
| for (Item key : this.getItemKeys()) { | ||
| List<Item> value = this.getSequenceByKey(key); | ||
| List<Item> otherValue = otherItem.getSequenceByKey(key); | ||
| if (!value.equals(otherValue)) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public final int hashCode() { | ||
| int result = this.getSize(); | ||
| for (Item key : this.getItemKeys()) { | ||
| result += 31 * key.hashCode() + this.getSequenceByKey(key).hashCode(); | ||
| } | ||
| return result; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to AbstractArrayItem