|
39 | 39 |
|
40 | 40 | public class ColumnStatisticsImpl implements ColumnStatistics { |
41 | 41 |
|
| 42 | + @Override |
| 43 | + public boolean equals(Object o) { |
| 44 | + if (this == o) { |
| 45 | + return true; |
| 46 | + } |
| 47 | + if (!(o instanceof ColumnStatisticsImpl)) { |
| 48 | + return false; |
| 49 | + } |
| 50 | + |
| 51 | + ColumnStatisticsImpl that = (ColumnStatisticsImpl) o; |
| 52 | + |
| 53 | + if (count != that.count) { |
| 54 | + return false; |
| 55 | + } |
| 56 | + if (hasNull != that.hasNull) { |
| 57 | + return false; |
| 58 | + } |
| 59 | + |
| 60 | + return true; |
| 61 | + } |
| 62 | + |
| 63 | + @Override |
| 64 | + public int hashCode() { |
| 65 | + int result = (int) (count ^ (count >>> 32)); |
| 66 | + result = 31 * result + (hasNull ? 1 : 0); |
| 67 | + return result; |
| 68 | + } |
| 69 | + |
42 | 70 | private static final class BooleanStatisticsImpl extends ColumnStatisticsImpl |
43 | 71 | implements BooleanColumnStatistics { |
44 | 72 | private long trueCount = 0; |
@@ -102,6 +130,34 @@ public long getTrueCount() { |
102 | 130 | public String toString() { |
103 | 131 | return super.toString() + " true: " + trueCount; |
104 | 132 | } |
| 133 | + |
| 134 | + @Override |
| 135 | + public boolean equals(Object o) { |
| 136 | + if (this == o) { |
| 137 | + return true; |
| 138 | + } |
| 139 | + if (!(o instanceof BooleanStatisticsImpl)) { |
| 140 | + return false; |
| 141 | + } |
| 142 | + if (!super.equals(o)) { |
| 143 | + return false; |
| 144 | + } |
| 145 | + |
| 146 | + BooleanStatisticsImpl that = (BooleanStatisticsImpl) o; |
| 147 | + |
| 148 | + if (trueCount != that.trueCount) { |
| 149 | + return false; |
| 150 | + } |
| 151 | + |
| 152 | + return true; |
| 153 | + } |
| 154 | + |
| 155 | + @Override |
| 156 | + public int hashCode() { |
| 157 | + int result = super.hashCode(); |
| 158 | + result = 31 * result + (int) (trueCount ^ (trueCount >>> 32)); |
| 159 | + return result; |
| 160 | + } |
105 | 161 | } |
106 | 162 |
|
107 | 163 | private static final class IntegerStatisticsImpl extends ColumnStatisticsImpl |
@@ -247,6 +303,50 @@ public String toString() { |
247 | 303 | } |
248 | 304 | return buf.toString(); |
249 | 305 | } |
| 306 | + |
| 307 | + @Override |
| 308 | + public boolean equals(Object o) { |
| 309 | + if (this == o) { |
| 310 | + return true; |
| 311 | + } |
| 312 | + if (!(o instanceof IntegerStatisticsImpl)) { |
| 313 | + return false; |
| 314 | + } |
| 315 | + if (!super.equals(o)) { |
| 316 | + return false; |
| 317 | + } |
| 318 | + |
| 319 | + IntegerStatisticsImpl that = (IntegerStatisticsImpl) o; |
| 320 | + |
| 321 | + if (minimum != that.minimum) { |
| 322 | + return false; |
| 323 | + } |
| 324 | + if (maximum != that.maximum) { |
| 325 | + return false; |
| 326 | + } |
| 327 | + if (sum != that.sum) { |
| 328 | + return false; |
| 329 | + } |
| 330 | + if (hasMinimum != that.hasMinimum) { |
| 331 | + return false; |
| 332 | + } |
| 333 | + if (overflow != that.overflow) { |
| 334 | + return false; |
| 335 | + } |
| 336 | + |
| 337 | + return true; |
| 338 | + } |
| 339 | + |
| 340 | + @Override |
| 341 | + public int hashCode() { |
| 342 | + int result = super.hashCode(); |
| 343 | + result = 31 * result + (int) (minimum ^ (minimum >>> 32)); |
| 344 | + result = 31 * result + (int) (maximum ^ (maximum >>> 32)); |
| 345 | + result = 31 * result + (int) (sum ^ (sum >>> 32)); |
| 346 | + result = 31 * result + (hasMinimum ? 1 : 0); |
| 347 | + result = 31 * result + (overflow ? 1 : 0); |
| 348 | + return result; |
| 349 | + } |
250 | 350 | } |
251 | 351 |
|
252 | 352 | private static final class DoubleStatisticsImpl extends ColumnStatisticsImpl |
@@ -364,6 +464,50 @@ public String toString() { |
364 | 464 | buf.append(sum); |
365 | 465 | return buf.toString(); |
366 | 466 | } |
| 467 | + |
| 468 | + @Override |
| 469 | + public boolean equals(Object o) { |
| 470 | + if (this == o) { |
| 471 | + return true; |
| 472 | + } |
| 473 | + if (!(o instanceof DoubleStatisticsImpl)) { |
| 474 | + return false; |
| 475 | + } |
| 476 | + if (!super.equals(o)) { |
| 477 | + return false; |
| 478 | + } |
| 479 | + |
| 480 | + DoubleStatisticsImpl that = (DoubleStatisticsImpl) o; |
| 481 | + |
| 482 | + if (hasMinimum != that.hasMinimum) { |
| 483 | + return false; |
| 484 | + } |
| 485 | + if (Double.compare(that.minimum, minimum) != 0) { |
| 486 | + return false; |
| 487 | + } |
| 488 | + if (Double.compare(that.maximum, maximum) != 0) { |
| 489 | + return false; |
| 490 | + } |
| 491 | + if (Double.compare(that.sum, sum) != 0) { |
| 492 | + return false; |
| 493 | + } |
| 494 | + |
| 495 | + return true; |
| 496 | + } |
| 497 | + |
| 498 | + @Override |
| 499 | + public int hashCode() { |
| 500 | + int result = super.hashCode(); |
| 501 | + long temp; |
| 502 | + result = 31 * result + (hasMinimum ? 1 : 0); |
| 503 | + temp = Double.doubleToLongBits(minimum); |
| 504 | + result = 31 * result + (int) (temp ^ (temp >>> 32)); |
| 505 | + temp = Double.doubleToLongBits(maximum); |
| 506 | + result = 31 * result + (int) (temp ^ (temp >>> 32)); |
| 507 | + temp = Double.doubleToLongBits(sum); |
| 508 | + result = 31 * result + (int) (temp ^ (temp >>> 32)); |
| 509 | + return result; |
| 510 | + } |
367 | 511 | } |
368 | 512 |
|
369 | 513 | protected static final class StringStatisticsImpl extends ColumnStatisticsImpl |
@@ -498,6 +642,42 @@ public String toString() { |
498 | 642 | } |
499 | 643 | return buf.toString(); |
500 | 644 | } |
| 645 | + |
| 646 | + @Override |
| 647 | + public boolean equals(Object o) { |
| 648 | + if (this == o) { |
| 649 | + return true; |
| 650 | + } |
| 651 | + if (!(o instanceof StringStatisticsImpl)) { |
| 652 | + return false; |
| 653 | + } |
| 654 | + if (!super.equals(o)) { |
| 655 | + return false; |
| 656 | + } |
| 657 | + |
| 658 | + StringStatisticsImpl that = (StringStatisticsImpl) o; |
| 659 | + |
| 660 | + if (sum != that.sum) { |
| 661 | + return false; |
| 662 | + } |
| 663 | + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) { |
| 664 | + return false; |
| 665 | + } |
| 666 | + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) { |
| 667 | + return false; |
| 668 | + } |
| 669 | + |
| 670 | + return true; |
| 671 | + } |
| 672 | + |
| 673 | + @Override |
| 674 | + public int hashCode() { |
| 675 | + int result = super.hashCode(); |
| 676 | + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); |
| 677 | + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); |
| 678 | + result = 31 * result + (int) (sum ^ (sum >>> 32)); |
| 679 | + return result; |
| 680 | + } |
501 | 681 | } |
502 | 682 |
|
503 | 683 | protected static final class BinaryStatisticsImpl extends ColumnStatisticsImpl implements |
@@ -569,6 +749,34 @@ public String toString() { |
569 | 749 | } |
570 | 750 | return buf.toString(); |
571 | 751 | } |
| 752 | + |
| 753 | + @Override |
| 754 | + public boolean equals(Object o) { |
| 755 | + if (this == o) { |
| 756 | + return true; |
| 757 | + } |
| 758 | + if (!(o instanceof BinaryStatisticsImpl)) { |
| 759 | + return false; |
| 760 | + } |
| 761 | + if (!super.equals(o)) { |
| 762 | + return false; |
| 763 | + } |
| 764 | + |
| 765 | + BinaryStatisticsImpl that = (BinaryStatisticsImpl) o; |
| 766 | + |
| 767 | + if (sum != that.sum) { |
| 768 | + return false; |
| 769 | + } |
| 770 | + |
| 771 | + return true; |
| 772 | + } |
| 773 | + |
| 774 | + @Override |
| 775 | + public int hashCode() { |
| 776 | + int result = super.hashCode(); |
| 777 | + result = 31 * result + (int) (sum ^ (sum >>> 32)); |
| 778 | + return result; |
| 779 | + } |
572 | 780 | } |
573 | 781 |
|
574 | 782 | private static final class DecimalStatisticsImpl extends ColumnStatisticsImpl |
@@ -694,6 +902,42 @@ public String toString() { |
694 | 902 | } |
695 | 903 | return buf.toString(); |
696 | 904 | } |
| 905 | + |
| 906 | + @Override |
| 907 | + public boolean equals(Object o) { |
| 908 | + if (this == o) { |
| 909 | + return true; |
| 910 | + } |
| 911 | + if (!(o instanceof DecimalStatisticsImpl)) { |
| 912 | + return false; |
| 913 | + } |
| 914 | + if (!super.equals(o)) { |
| 915 | + return false; |
| 916 | + } |
| 917 | + |
| 918 | + DecimalStatisticsImpl that = (DecimalStatisticsImpl) o; |
| 919 | + |
| 920 | + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) { |
| 921 | + return false; |
| 922 | + } |
| 923 | + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) { |
| 924 | + return false; |
| 925 | + } |
| 926 | + if (sum != null ? !sum.equals(that.sum) : that.sum != null) { |
| 927 | + return false; |
| 928 | + } |
| 929 | + |
| 930 | + return true; |
| 931 | + } |
| 932 | + |
| 933 | + @Override |
| 934 | + public int hashCode() { |
| 935 | + int result = super.hashCode(); |
| 936 | + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); |
| 937 | + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); |
| 938 | + result = 31 * result + (sum != null ? sum.hashCode() : 0); |
| 939 | + return result; |
| 940 | + } |
697 | 941 | } |
698 | 942 |
|
699 | 943 | private static final class DateStatisticsImpl extends ColumnStatisticsImpl |
@@ -815,6 +1059,46 @@ public String toString() { |
815 | 1059 | } |
816 | 1060 | return buf.toString(); |
817 | 1061 | } |
| 1062 | + |
| 1063 | + @Override |
| 1064 | + public boolean equals(Object o) { |
| 1065 | + if (this == o) { |
| 1066 | + return true; |
| 1067 | + } |
| 1068 | + if (!(o instanceof DateStatisticsImpl)) { |
| 1069 | + return false; |
| 1070 | + } |
| 1071 | + if (!super.equals(o)) { |
| 1072 | + return false; |
| 1073 | + } |
| 1074 | + |
| 1075 | + DateStatisticsImpl that = (DateStatisticsImpl) o; |
| 1076 | + |
| 1077 | + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) { |
| 1078 | + return false; |
| 1079 | + } |
| 1080 | + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) { |
| 1081 | + return false; |
| 1082 | + } |
| 1083 | + if (minDate != null ? !minDate.equals(that.minDate) : that.minDate != null) { |
| 1084 | + return false; |
| 1085 | + } |
| 1086 | + if (maxDate != null ? !maxDate.equals(that.maxDate) : that.maxDate != null) { |
| 1087 | + return false; |
| 1088 | + } |
| 1089 | + |
| 1090 | + return true; |
| 1091 | + } |
| 1092 | + |
| 1093 | + @Override |
| 1094 | + public int hashCode() { |
| 1095 | + int result = super.hashCode(); |
| 1096 | + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); |
| 1097 | + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); |
| 1098 | + result = 31 * result + (minDate != null ? minDate.hashCode() : 0); |
| 1099 | + result = 31 * result + (maxDate != null ? maxDate.hashCode() : 0); |
| 1100 | + return result; |
| 1101 | + } |
818 | 1102 | } |
819 | 1103 |
|
820 | 1104 | private static final class TimestampStatisticsImpl extends ColumnStatisticsImpl |
@@ -925,6 +1209,38 @@ public String toString() { |
925 | 1209 | } |
926 | 1210 | return buf.toString(); |
927 | 1211 | } |
| 1212 | + |
| 1213 | + @Override |
| 1214 | + public boolean equals(Object o) { |
| 1215 | + if (this == o) { |
| 1216 | + return true; |
| 1217 | + } |
| 1218 | + if (!(o instanceof TimestampStatisticsImpl)) { |
| 1219 | + return false; |
| 1220 | + } |
| 1221 | + if (!super.equals(o)) { |
| 1222 | + return false; |
| 1223 | + } |
| 1224 | + |
| 1225 | + TimestampStatisticsImpl that = (TimestampStatisticsImpl) o; |
| 1226 | + |
| 1227 | + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) { |
| 1228 | + return false; |
| 1229 | + } |
| 1230 | + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) { |
| 1231 | + return false; |
| 1232 | + } |
| 1233 | + |
| 1234 | + return true; |
| 1235 | + } |
| 1236 | + |
| 1237 | + @Override |
| 1238 | + public int hashCode() { |
| 1239 | + int result = super.hashCode(); |
| 1240 | + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); |
| 1241 | + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); |
| 1242 | + return result; |
| 1243 | + } |
928 | 1244 | } |
929 | 1245 |
|
930 | 1246 | private long count = 0; |
|
0 commit comments