Skip to content
Open
Show file tree
Hide file tree
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 Jul 24, 2026
0831a8c
Refactor equality and hash code methods in FunctionSignature using Lo…
CaiJimmy Jul 24, 2026
8824590
Add Lombok's @EqualsAndHashCode annotation to ErrorItemType class
CaiJimmy Jul 24, 2026
b9b74a2
Refactor XML and ItemType classes for improved equality handling
CaiJimmy Jul 24, 2026
0e50251
Added explicit atomic value-comparison adapters for distinct-values, …
CaiJimmy Jul 24, 2026
2ee2830
Fix FlworKey hashcode
CaiJimmy Jul 24, 2026
c44aab2
Undo FlowrKey change
CaiJimmy Jul 24, 2026
eca347f
Fix test cases that depended on order of group by
CaiJimmy Jul 24, 2026
ec86521
Add serialVersionUID to AbstractItemType for serialization compatibility
CaiJimmy Jul 24, 2026
e939bce
Add serialVersionUID for serialization compatibility in AbstractArray…
CaiJimmy Jul 24, 2026
e41f5bc
Add order by clause to group by test cases for consistent output
CaiJimmy Jul 24, 2026
853f8f2
Test CI
CaiJimmy Jul 24, 2026
477dd16
Trigger Build
CaiJimmy Jul 24, 2026
0be6ac0
Trigger Build
CaiJimmy Jul 24, 2026
4fd5680
Trigger Build
CaiJimmy Jul 24, 2026
d90bbdc
Implement Serializable interface in NamespaceDeclaration class
CaiJimmy Jul 24, 2026
9d1b7b1
Enhance whitespace handling in DirectConstructorUtils and add test ca…
CaiJimmy Jul 24, 2026
1bca2c9
Update boundarySpacePreserve setting to false in StaticContext and un…
CaiJimmy Jul 24, 2026
905d5d9
Cover default boundary-space stripping
CaiJimmy Jul 24, 2026
e08a130
Refactor DirectConstructorUtils to use ElementContentBuilder for impr…
CaiJimmy Jul 25, 2026
dfd8270
Merge branch 'master' into jimmy/replace-hash-equal
CaiJimmy Jul 27, 2026
2932ddd
Add space
CaiJimmy Jul 27, 2026
a1d3a3b
Merge branch 'jimmy/replace-hash-equal' into jimmy/consistent-hash
CaiJimmy Jul 27, 2026
6e68bdc
Merge master branch
CaiJimmy Jul 27, 2026
c2b95d2
Apply spotless
CaiJimmy Jul 27, 2026
9a0b2ff
Switch back to QT3 master
CaiJimmy Jul 27, 2026
c64ff4c
Add serialVersionUID to AbstractNodeItem for serialization compatibility
CaiJimmy Jul 27, 2026
16e442a
Clarify equality check in AbstractNodeItem with additional comments
CaiJimmy Jul 27, 2026
c744296
Refactor equality and hashCode methods in AbstractArrayItem for consi…
CaiJimmy Jul 27, 2026
ac94017
Refactor equality and hashCode methods in AbstractMapItem for consist…
CaiJimmy Jul 27, 2026
c708b42
Add Apache header
CaiJimmy Jul 27, 2026
78cd90b
Refactor MapAtomicSameKey to use primitive type for type checking; en…
CaiJimmy Jul 27, 2026
69770f1
Remove unrelated test
CaiJimmy Jul 27, 2026
08fc3fe
Update expected output for distinct-values test case to reflect corre…
CaiJimmy Jul 27, 2026
8aacad8
Refactor comparison logic in SwitchRuntimeIterator and SwitchStatemen…
CaiJimmy Jul 27, 2026
eec4649
Float/double-to-decimal casts now preserve the exact binary value
CaiJimmy Jul 27, 2026
36b9a42
Refactor DistinctValuesFunctionIterator to resolve collation using Co…
CaiJimmy Jul 27, 2026
294e3e4
Enhance AtomicValueComparison and AtomicValueComparisonKey to support…
CaiJimmy Jul 27, 2026
c0fbf8e
Enhance DecimalItem to support display values for precise serializati…
CaiJimmy Jul 27, 2026
033f9f6
Simplify equals in AbstractArrayItem
CaiJimmy Jul 27, 2026
ce1ed34
Preserve concise lexical decimal form in ValidateTypeIterator instead…
CaiJimmy Jul 27, 2026
de549d1
Remove unused JSoundDataFrame import and method from DistinctValuesFu…
CaiJimmy Jul 27, 2026
4f6561f
Add getDataFrame method to DistinctValuesFunctionIterator for DataFra…
CaiJimmy Jul 28, 2026
b379d9b
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy Jul 28, 2026
30af7ee
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy Jul 28, 2026
a9bf2d7
Enable DataFrame support in DistinctValuesFunctionIterator
CaiJimmy Jul 28, 2026
1fc3e98
Clarify DataFrame handling in getDataFrame method for distinct values
CaiJimmy Jul 28, 2026
c0cb218
Refactor AnnotatedItem and AtomicValueComparisonKey classes to use fi…
CaiJimmy Jul 28, 2026
773b07c
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy Jul 28, 2026
0a02d5c
Add @NoArgsConstructor annotation to AnnotatedItem and AtomicValueCom…
CaiJimmy Jul 28, 2026
8c4d35f
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy Jul 28, 2026
c6d4455
Update AtomicValueComparisonKey constructor to include ExceptionMetad…
CaiJimmy Jul 28, 2026
c366c41
Merge branch 'master' into jimmy/consistent-hash
CaiJimmy Jul 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/main/java/org/rumbledb/items/AbstractArrayItem.java
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;
}
}
40 changes: 40 additions & 0 deletions src/main/java/org/rumbledb/items/AbstractAtomicItem.java
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);
}
}
58 changes: 58 additions & 0 deletions src/main/java/org/rumbledb/items/AbstractMapItem.java
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;
}
}
19 changes: 7 additions & 12 deletions src/main/java/org/rumbledb/items/AnnotatedItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.time.Period;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.ml.Estimator;
Expand All @@ -19,14 +18,11 @@
import org.rumbledb.context.FunctionIdentifier;
import org.rumbledb.context.Name;
import org.rumbledb.exceptions.DuplicateObjectKeyException;
import org.rumbledb.exceptions.ExceptionMetadata;
import org.rumbledb.exceptions.OurBadException;
import org.rumbledb.expressions.comparison.ComparisonExpression.ComparisonOperator;
import org.rumbledb.items.structured.JSoundDataFrame;
import org.rumbledb.items.xml.XMLDocumentPosition;
import org.rumbledb.runtime.RuntimeIterator;
import org.rumbledb.runtime.flwor.NativeClauseContext;
import org.rumbledb.runtime.misc.ComparisonIterator;
import org.rumbledb.runtime.update.primitives.Collection;
import org.rumbledb.types.FunctionSignature;
import org.rumbledb.types.ItemType;
Expand Down Expand Up @@ -59,15 +55,12 @@ public Item copy(boolean mutable) {

@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other instanceof Item otherItem) {
if (otherItem.isAtomic()) {
long c = ComparisonIterator.compareItems(
this,
otherItem,
ComparisonOperator.VC_EQ,
ExceptionMetadata.EMPTY_METADATA
);
return c == 0;
return AtomicItemEquivalence.equivalent(this, otherItem);
}
return this.itemToAnnotate.equals(otherItem);
}
Expand All @@ -76,7 +69,9 @@ public boolean equals(Object other) {

@Override
public int hashCode() {
return Objects.hash(this.itemToAnnotate, this.type);
return this.isAtomic()
? AtomicItemEquivalence.hash(this)
: this.itemToAnnotate.hashCode();
}


Expand Down
24 changes: 1 addition & 23 deletions src/main/java/org/rumbledb/items/AnyURIItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
import java.net.URISyntaxException;

import org.rumbledb.api.Item;
import org.rumbledb.exceptions.ExceptionMetadata;
import org.rumbledb.expressions.comparison.ComparisonExpression.ComparisonOperator;
import org.rumbledb.runtime.misc.ComparisonIterator;
import org.rumbledb.types.BuiltinTypesCatalogue;
import org.rumbledb.types.ItemType;


public class AnyURIItem implements Item {
public class AnyURIItem extends AbstractAtomicItem {


@Serial
Expand All @@ -53,20 +50,6 @@ public Item copy(boolean mutable) {
return new AnyURIItem(this.value.toString());
}

@Override
public boolean equals(Object other) {
if (other instanceof Item otherItem) {
long c = ComparisonIterator.compareItems(
this,
otherItem,
ComparisonOperator.VC_EQ,
ExceptionMetadata.EMPTY_METADATA
);
return c == 0;
}
return false;
}

static URI parseAnyURIString(String anyURIString) throws IllegalArgumentException {
if (anyURIString == null)
throw new IllegalArgumentException();
Expand All @@ -87,11 +70,6 @@ public boolean getEffectiveBooleanValue() {
return !this.value.toString().isEmpty();
}

@Override
public int hashCode() {
return this.value.hashCode();
}

public URI getValue() {
return this.value;
}
Expand Down
28 changes: 1 addition & 27 deletions src/main/java/org/rumbledb/items/ArrayItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.rumbledb.types.ItemTypeFactory;


public class ArrayItem implements Item {
public class ArrayItem extends AbstractArrayItem {


@Serial
Expand Down Expand Up @@ -81,24 +81,6 @@ public Item copy(boolean mutable) {
return copy;
}

public boolean equals(Object other) {
if (!(other instanceof Item otherItem)) {
return false;
}
if (!otherItem.isArray()) {
return false;
}
if (getSize() != otherItem.getSize()) {
return false;
}
for (int i = 0; i < getSize(); ++i) {
if (!getItemAt(i).equals(otherItem.getItemAt(i))) {
return false;
}
}
return true;
}

Comment on lines -84 to -101

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Moved to AbstractArrayItem

// region arrays

@Override
Expand Down Expand Up @@ -209,14 +191,6 @@ public void removeSequenceAt(int index) {



public int hashCode() {
int result = 1;
for (int i = 0; i < getSize(); ++i) {
result = 31 * result + getItemAt(i).hashCode();
}
return result;
}

@Override
public ItemType getDynamicType() {
if (this.arrayItems.isEmpty()) {
Expand Down
Loading
Loading