Commit 882c40fa by Harish Butani

fix issues in StructStore uncovered by HiveImporter

parent 1f7fe941
...@@ -156,8 +156,7 @@ public class AttributeStores { ...@@ -156,8 +156,7 @@ public class AttributeStores {
String attrName = attrNames.get(0); String attrName = attrNames.get(0);
int nullPos = instance.fieldMapping().fieldNullPos.get(attrName); int nullPos = instance.fieldMapping().fieldNullPos.get(attrName);
int colPos = instance.fieldMapping().fieldPos.get(attrName); int colPos = instance.fieldMapping().fieldPos.get(attrName);
System.out.println("Storing attribute " + attrName + " at pos " + pos + " colPos = " + colPos + nullList.set(pos, instance.nullFlags[nullPos]);
"nullPos = " + nullPos);
if (pos == nullList.size()) { if (pos == nullList.size()) {
nullList.add(instance.nullFlags[nullPos]); nullList.add(instance.nullFlags[nullPos]);
...@@ -176,7 +175,6 @@ public class AttributeStores { ...@@ -176,7 +175,6 @@ public class AttributeStores {
public void load(int pos, IConstructableType type, StructInstance instance) throws RepositoryException { public void load(int pos, IConstructableType type, StructInstance instance) throws RepositoryException {
List<String> attrNames = type.getNames(attrInfo); List<String> attrNames = type.getNames(attrInfo);
String attrName = attrNames.get(0); String attrName = attrNames.get(0);
System.out.println("Loading attribute " + attrName);
int nullPos = instance.fieldMapping().fieldNullPos.get(attrName); int nullPos = instance.fieldMapping().fieldNullPos.get(attrName);
int colPos = instance.fieldMapping().fieldPos.get(attrName); int colPos = instance.fieldMapping().fieldPos.get(attrName);
......
...@@ -21,6 +21,7 @@ package org.apache.hadoop.metadata.storage.memory; ...@@ -21,6 +21,7 @@ package org.apache.hadoop.metadata.storage.memory;
import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.hadoop.metadata.ITypedStruct;
import org.apache.hadoop.metadata.MetadataException; import org.apache.hadoop.metadata.MetadataException;
import org.apache.hadoop.metadata.storage.RepositoryException; import org.apache.hadoop.metadata.storage.RepositoryException;
import org.apache.hadoop.metadata.storage.StructInstance; import org.apache.hadoop.metadata.storage.StructInstance;
...@@ -67,9 +68,11 @@ public class StructStore extends AttributeStores.AbstractAttributeStore implemen ...@@ -67,9 +68,11 @@ public class StructStore extends AttributeStores.AbstractAttributeStore implemen
@Override @Override
protected void load(StructInstance instance, int colPos, int pos) throws RepositoryException { protected void load(StructInstance instance, int colPos, int pos) throws RepositoryException {
StructInstance s = (StructInstance) structType.createInstance();
instance.structs[colPos] = s;
for(Map.Entry<AttributeInfo, IAttributeStore> e : attrStores.entrySet()) { for(Map.Entry<AttributeInfo, IAttributeStore> e : attrStores.entrySet()) {
IAttributeStore attributeStore = e.getValue(); IAttributeStore attributeStore = e.getValue();
attributeStore.load(pos, structType, instance); attributeStore.load(pos, structType, s);
} }
} }
...@@ -89,7 +92,7 @@ public class StructStore extends AttributeStores.AbstractAttributeStore implemen ...@@ -89,7 +92,7 @@ public class StructStore extends AttributeStores.AbstractAttributeStore implemen
IAttributeStore attributeStore = e.getValue(); IAttributeStore attributeStore = e.getValue();
attributeStore.ensureCapacity(pos); attributeStore.ensureCapacity(pos);
} }
nullList.ensureCapacity(pos); nullList.size(pos+1);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment