MCPcopy Create free account
hub / github.com/apache/orc / compareTo

Method compareTo

java/mapreduce/src/java/org/apache/orc/mapred/OrcMap.java:87–133  ·  view source on GitHub ↗
(OrcMap<K,V> other)

Source from the content-addressed store, hash-verified

85 }
86
87 @Override
88 public int compareTo(OrcMap<K,V> other) {
89 if (other == null) {
90 return -1;
91 }
92 int result = keySchema.compareTo(other.keySchema);
93 if (result != 0) {
94 return result;
95 }
96 result = valueSchema.compareTo(other.valueSchema);
97 if (result != 0) {
98 return result;
99 }
100 Iterator<Map.Entry<K,V>> ourItr = entrySet().iterator();
101 Iterator<Map.Entry<K,V>> theirItr = other.entrySet().iterator();
102 while (ourItr.hasNext() && theirItr.hasNext()) {
103 Map.Entry<K,V> ourItem = ourItr.next();
104 Map.Entry<K,V> theirItem = theirItr.next();
105 K ourKey = ourItem.getKey();
106 K theirKey = theirItem.getKey();
107 int val = ourKey.compareTo(theirKey);
108 if (val != 0) {
109 return val;
110 }
111 Comparable<V> ourValue = ourItem.getValue();
112 V theirValue = theirItem.getValue();
113 if (ourValue == null) {
114 if (theirValue != null) {
115 return 1;
116 }
117 } else if (theirValue == null) {
118 return -1;
119 } else {
120 val = ourItem.getValue().compareTo(theirItem.getValue());
121 if (val != 0) {
122 return val;
123 }
124 }
125 }
126 if (ourItr.hasNext()) {
127 return 1;
128 } else if (theirItr.hasNext()) {
129 return -1;
130 } else {
131 return 0;
132 }
133 }
134
135 @Override
136 public boolean equals(Object other) {

Callers 11

testCompareMethod · 0.95
testMapKeysMethod · 0.95
testSchemaInCompareMethod · 0.95
equalsMethod · 0.95
printResultsMethod · 0.45
StructTypeClass · 0.45
pickTypeMethod · 0.45
orcRowFilterMethod · 0.45
orcNoFilterMethod · 0.45
setupMethod · 0.45
compareMethod · 0.45

Calls 4

hasNextMethod · 0.65
nextMethod · 0.65
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by 4

testCompareMethod · 0.76
testMapKeysMethod · 0.76
testSchemaInCompareMethod · 0.76
compareMethod · 0.36