Skip to content

Commit f54dc1f

Browse files
author
chengyitian
committed
AJ-524、AJ-720: fix some issues about BasicDictionary;
1 parent 35e0d15 commit f54dc1f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/com/xxdb/data/BasicDictionary.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public Entity get(Scalar key) {
115115

116116
@Override
117117
public boolean put(Scalar key, Entity value) {
118-
if(key.getDataType() != getKeyDataType() || (value.getDataType() != getDataType()))
118+
if(key.getDataType() != getKeyDataType() || ((value.getDataType() == DATA_TYPE.DT_ANY) && (value.getDataType() != getDataType())))
119119
return false;
120120
else{
121121
dict.put(key, value);
@@ -198,8 +198,14 @@ public void write(ExtendedDataOutput out) throws IOException{
198198
throw new IOException("Can't streamlize the dictionary with value type " + valueType.name());
199199

200200
BasicEntityFactory factory = new BasicEntityFactory();
201-
Vector keys = (Vector)factory.createVectorWithDefaultValue(keyType, dict.size(), -1);
202-
Vector values = (Vector)factory.createVectorWithDefaultValue(valueType, dict.size(), -1);
201+
Vector keys = factory.createVectorWithDefaultValue(keyType, dict.size(), -1);
202+
Vector values;
203+
if (valueType == DATA_TYPE.DT_ANY) {
204+
values = new BasicAnyVector(dict.size());
205+
} else {
206+
values = factory.createVectorWithDefaultValue(valueType, dict.size(), -1);
207+
}
208+
203209
int index = 0;
204210
try{
205211
for(Map.Entry<Entity, Entity> entry : dict.entrySet()){

0 commit comments

Comments
 (0)