Commit cd0e3950 by Shwetha GS

Merge branch 'master' into dal

parents 3ccee856 7de696cc
...@@ -277,20 +277,8 @@ public class HiveMetaStoreBridge { ...@@ -277,20 +277,8 @@ public class HiveMetaStoreBridge {
tableRef.set("sd", sdReferenceable); tableRef.set("sd", sdReferenceable);
// add reference to the Partition Keys // add reference to the Partition Keys
List<Referenceable> partKeys = new ArrayList<>(); List<Referenceable> partKeys = getColumns(hiveTable.getPartitionKeys());;
Referenceable colRef; tableRef.set("partitionKeys", partKeys);
if (hiveTable.getPartitionKeys().size() > 0) {
for (FieldSchema fs : hiveTable.getPartitionKeys()) {
colRef = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName());
colRef.set("name", fs.getName());
colRef.set("type", fs.getType());
colRef.set("comment", fs.getComment());
Referenceable colRefTyped = createInstance(colRef);
partKeys.add(colRefTyped);
}
tableRef.set("partitionKeys", partKeys);
}
tableRef.set("parameters", hiveTable.getParameters()); tableRef.set("parameters", hiveTable.getParameters());
...@@ -302,7 +290,7 @@ public class HiveMetaStoreBridge { ...@@ -302,7 +290,7 @@ public class HiveMetaStoreBridge {
tableRef.set("viewExpandedText", hiveTable.getViewExpandedText()); tableRef.set("viewExpandedText", hiveTable.getViewExpandedText());
} }
tableRef.set("tableType", hiveTable.getTableType()); tableRef.set("tableType", hiveTable.getTableType().name());
tableRef.set("temporary", hiveTable.isTemporary()); tableRef.set("temporary", hiveTable.isTemporary());
List<Referenceable> colList = getColumns(hiveTable.getAllCols()); List<Referenceable> colList = getColumns(hiveTable.getAllCols());
......
---+ Hive DGI Bridge ---+ Hive DGI Bridge
Hive metadata can be modelled in DGI using its Type System. The default modelling is available in org.apache.hadoop.metadata.hive.model.HiveDataModelGenerator. It defines the following types: Hive metadata can be modelled in DGI using its Type System. The default modelling is available in org.apache.hadoop.metadata.hive.model.HiveDataModelGenerator. It defines the following types:
* hive_object_type(EnumType) - [GLOBAL, DATABASE, TABLE, PARTITION, COLUMN]
* hive_resource_type(EnumType) - [JAR, FILE, ARCHIVE] * hive_resource_type(EnumType) - [JAR, FILE, ARCHIVE]
* hive_principal_type(EnumType) - [USER, ROLE, GROUP] * hive_principal_type(EnumType) - [USER, ROLE, GROUP]
* hive_function_type(EnumType) - [JAVA] * hive_function_type(EnumType) - [JAVA]
...@@ -67,3 +66,7 @@ The following properties in hive-site.xml control the thread pool details: ...@@ -67,3 +66,7 @@ The following properties in hive-site.xml control the thread pool details:
* hive.hook.dgi.keepAliveTime - keep alive time in msecs. default 10 * hive.hook.dgi.keepAliveTime - keep alive time in msecs. default 10
* hive.hook.dgi.synchronous - boolean, true to run the hook synchronously. default false * hive.hook.dgi.synchronous - boolean, true to run the hook synchronously. default false
---++ Limitations
* Since database name, table name and column names are case insensitive in hive, the corresponding names in entities are lowercase. So, any search APIs should use lowercase while querying on the entity names
* Only the following hive operations are captured by hive hook currently - create database, create table, create view, CTAS, load, import, export, query, alter table rename and alter view rename
...@@ -20,6 +20,7 @@ package org.apache.hadoop.metadata.hive.hook; ...@@ -20,6 +20,7 @@ package org.apache.hadoop.metadata.hive.hook;
import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.RandomStringUtils;
import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.TableType;
import org.apache.hadoop.hive.ql.Driver; import org.apache.hadoop.hive.ql.Driver;
import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hadoop.metadata.MetadataServiceClient; import org.apache.hadoop.metadata.MetadataServiceClient;
...@@ -130,7 +131,9 @@ public class HiveHookIT { ...@@ -130,7 +131,9 @@ public class HiveHookIT {
assertTableIsRegistered(dbName, tableName); assertTableIsRegistered(dbName, tableName);
tableName = createTable(); tableName = createTable();
assertTableIsRegistered(DEFAULT_DB, tableName); String tableId = assertTableIsRegistered(DEFAULT_DB, tableName);
Referenceable tableRef = dgiCLient.getEntity(tableId);
Assert.assertEquals(tableRef.get("tableType"), TableType.MANAGED_TABLE.name());
//Create table where database doesn't exist, will create database instance as well //Create table where database doesn't exist, will create database instance as well
assertDatabaseIsRegistered(DEFAULT_DB); assertDatabaseIsRegistered(DEFAULT_DB);
......
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