Commit 84a28168 by Venkatesh Seetharam

Fix broken hive bridge

parent 9670a3d7
...@@ -190,6 +190,9 @@ public class HiveMetaStoreBridge { ...@@ -190,6 +190,9 @@ public class HiveMetaStoreBridge {
tableRef.set("tableType", hiveTable.getTableType()); tableRef.set("tableType", hiveTable.getTableType());
tableRef.set("temporary", hiveTable.isTemporary()); tableRef.set("temporary", hiveTable.isTemporary());
// List<Referenceable> fieldsList = getColumns(storageDesc);
// tableRef.set("columns", fieldsList);
Referenceable tableReferenceable = createInstance(tableRef); Referenceable tableReferenceable = createInstance(tableRef);
return Pair.of(tableReferenceable, sdReferenceable); return Pair.of(tableReferenceable, sdReferenceable);
} }
...@@ -302,17 +305,7 @@ public class HiveMetaStoreBridge { ...@@ -302,17 +305,7 @@ public class HiveMetaStoreBridge {
} }
*/ */
List<Referenceable> fieldsList = new ArrayList<>(); List<Referenceable> fieldsList = getColumns(storageDesc);
Referenceable colReferenceable;
for (FieldSchema fs : storageDesc.getCols()) {
LOG.debug("Processing field " + fs);
colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName());
colReferenceable.set("name", fs.getName());
colReferenceable.set("type", fs.getType());
colReferenceable.set("comment", fs.getComment());
fieldsList.add(createInstance(colReferenceable));
}
sdReferenceable.set("cols", fieldsList); sdReferenceable.set("cols", fieldsList);
List<Struct> sortColsStruct = new ArrayList<>(); List<Struct> sortColsStruct = new ArrayList<>();
...@@ -343,6 +336,21 @@ public class HiveMetaStoreBridge { ...@@ -343,6 +336,21 @@ public class HiveMetaStoreBridge {
return createInstance(sdReferenceable); return createInstance(sdReferenceable);
} }
private List<Referenceable> getColumns(StorageDescriptor storageDesc) throws Exception {
List<Referenceable> fieldsList = new ArrayList<>();
Referenceable colReferenceable;
for (FieldSchema fs : storageDesc.getCols()) {
LOG.debug("Processing field " + fs);
colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName());
colReferenceable.set("name", fs.getName());
colReferenceable.set("type", fs.getType());
colReferenceable.set("comment", fs.getComment());
fieldsList.add(createInstance(colReferenceable));
}
return fieldsList;
}
private void registerHiveDataModel() throws Exception { private void registerHiveDataModel() throws Exception {
HiveDataModelGenerator dataModelGenerator = new HiveDataModelGenerator(); HiveDataModelGenerator dataModelGenerator = new HiveDataModelGenerator();
try { try {
......
...@@ -385,9 +385,9 @@ public class HiveDataModelGenerator { ...@@ -385,9 +385,9 @@ public class HiveDataModelGenerator {
new AttributeDefinition("partitionKeys", new AttributeDefinition("partitionKeys",
DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()), DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()),
Multiplicity.OPTIONAL, false, null), Multiplicity.OPTIONAL, false, null),
new AttributeDefinition("columns", // new AttributeDefinition("columns",
DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()), // DataTypes.arrayTypeName(HiveDataTypes.HIVE_COLUMN.getName()),
Multiplicity.COLLECTION, true, null), // Multiplicity.COLLECTION, true, null),
new AttributeDefinition("parameters", STRING_MAP_TYPE.getName(), new AttributeDefinition("parameters", STRING_MAP_TYPE.getName(),
Multiplicity.OPTIONAL, false, null), Multiplicity.OPTIONAL, false, null),
new AttributeDefinition("viewOriginalText", DataTypes.STRING_TYPE.getName(), new AttributeDefinition("viewOriginalText", DataTypes.STRING_TYPE.getName(),
......
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