[FIX](complextype)fix array/map/struct impl hashcode and equals (#27717)
This commit is contained in:
@ -32,6 +32,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ArrayLiteral extends LiteralExpr {
|
||||
|
||||
@ -134,6 +135,23 @@ public class ArrayLiteral extends LiteralExpr {
|
||||
msg.setChildType(((ArrayType) type).getItemType().getPrimitiveType().toThrift());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof ArrayLiteral)) {
|
||||
return false;
|
||||
}
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
ArrayLiteral that = (ArrayLiteral) o;
|
||||
return Objects.equals(children, that.children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutput out) throws IOException {
|
||||
super.write(out);
|
||||
|
||||
@ -35,6 +35,7 @@ import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
// INSERT INTO table_map VALUES ({'key1':1, 'key2':10, 'k3':100}), ({'key1':2,'key2':20}), ({'key1':3,'key2':30});
|
||||
@ -218,4 +219,22 @@ public class MapLiteral extends LiteralExpr {
|
||||
Expr.writeTo(e, out);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MapLiteral)) {
|
||||
return false;
|
||||
}
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
MapLiteral that = (MapLiteral) o;
|
||||
return Objects.equals(children, that.children);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class StructLiteral extends LiteralExpr {
|
||||
// only for persist
|
||||
@ -164,4 +165,21 @@ public class StructLiteral extends LiteralExpr {
|
||||
e.checkValueValid();
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof StructLiteral)) {
|
||||
return false;
|
||||
}
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
StructLiteral that = (StructLiteral) o;
|
||||
return Objects.equals(children, that.children);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user