Java Code Examples for org.apache.hadoop.hive.ql.hooks.Entity#Type
The following examples show how to use
org.apache.hadoop.hive.ql.hooks.Entity#Type .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveHookIT.java From incubator-atlas with Apache License 2.0 | 6 votes |
private Set<ReadEntity> getInputs(String inputName, Entity.Type entityType) throws HiveException { final ReadEntity entity = new ReadEntity(); if ( Entity.Type.DFS_DIR.equals(entityType)) { entity.setName(lower(new Path(inputName).toString())); entity.setTyp(Entity.Type.DFS_DIR); } else { entity.setName(getQualifiedTblName(inputName)); entity.setTyp(entityType); } if (entityType == Entity.Type.TABLE) { entity.setT(hiveMetaStoreBridge.hiveClient.getTable(DEFAULT_DB, inputName)); } return new LinkedHashSet<ReadEntity>() {{ add(entity); }}; }
Example 2
Source File: HiveHookIT.java From incubator-atlas with Apache License 2.0 | 6 votes |
private Set<WriteEntity> getOutputs(String inputName, Entity.Type entityType) throws HiveException { final WriteEntity entity = new WriteEntity(); if ( Entity.Type.DFS_DIR.equals(entityType) || Entity.Type.LOCAL_DIR.equals(entityType)) { entity.setName(lower(new Path(inputName).toString())); entity.setTyp(entityType); } else { entity.setName(getQualifiedTblName(inputName)); entity.setTyp(entityType); } if (entityType == Entity.Type.TABLE) { entity.setT(hiveMetaStoreBridge.hiveClient.getTable(DEFAULT_DB, inputName)); } return new LinkedHashSet<WriteEntity>() {{ add(entity); }}; }
Example 3
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 5 votes |
private Set<ReadEntity> getInputs(String inputName, Entity.Type entityType) throws HiveException { final ReadEntity entity; if (Entity.Type.DFS_DIR.equals(entityType)) { entity = new TestReadEntity(lower(new Path(inputName).toString()), entityType); } else { entity = new TestReadEntity(getQualifiedTblName(inputName), entityType); } if (entityType == Entity.Type.TABLE) { entity.setT(hiveMetaStoreBridge.getHiveClient().getTable(DEFAULT_DB, inputName)); } return new LinkedHashSet<ReadEntity>() {{ add(entity); }}; }
Example 4
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 5 votes |
private Set<WriteEntity> getOutputs(String inputName, Entity.Type entityType) throws HiveException { final WriteEntity entity; if (Entity.Type.DFS_DIR.equals(entityType) || Entity.Type.LOCAL_DIR.equals(entityType)) { entity = new TestWriteEntity(lower(new Path(inputName).toString()), entityType); } else { entity = new TestWriteEntity(getQualifiedTblName(inputName), entityType); } if (entityType == Entity.Type.TABLE) { entity.setT(hiveMetaStoreBridge.getHiveClient().getTable(DEFAULT_DB, inputName)); } return new LinkedHashSet<WriteEntity>() {{ add(entity); }}; }
Example 5
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 5 votes |
private void testAlterProperties(Entity.Type entityType, String entityName, String fmtQuery) throws Exception { String SET_OP = "set"; String UNSET_OP = "unset"; Map<String, String> expectedProps = new HashMap<String, String>() {{ put("testPropKey1", "testPropValue1"); put("comment", "test comment"); }}; String query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps)); runCommandWithDelay(query, 3000); verifyEntityProperties(entityType, entityName, expectedProps, false); expectedProps.put("testPropKey2", "testPropValue2"); //Add another property query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps)); runCommandWithDelay(query, 3000); verifyEntityProperties(entityType, entityName, expectedProps, false); if (entityType != Entity.Type.DATABASE) { //Database unset properties doesnt work - alter database %s unset DBPROPERTIES doesnt work //Unset all the props StringBuilder sb = new StringBuilder("'"); query = String.format(fmtQuery, entityName, UNSET_OP, Joiner.on("','").skipNulls().appendTo(sb, expectedProps.keySet()).append('\'')); runCommandWithDelay(query, 3000); verifyEntityProperties(entityType, entityName, expectedProps, true); } }
Example 6
Source File: HiveITBase.java From atlas with Apache License 2.0 | 5 votes |
protected static Entity getEntityByType(Set<? extends Entity> entities, Entity.Type entityType) { for (Entity entity : entities) { if (entity.getType() == entityType) { return entity; } } return null; }
Example 7
Source File: HiveHookIT.java From incubator-atlas with Apache License 2.0 | 5 votes |
private void testAlterProperties(Entity.Type entityType, String entityName, String fmtQuery) throws Exception { final String SET_OP = "set"; final String UNSET_OP = "unset"; final Map<String, String> expectedProps = new HashMap<String, String>() {{ put("testPropKey1", "testPropValue1"); put("comment", "test comment"); }}; String query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps)); runCommandWithDelay(query, 1000); verifyEntityProperties(entityType, entityName, expectedProps, false); expectedProps.put("testPropKey2", "testPropValue2"); //Add another property query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps)); runCommandWithDelay(query, 1000); verifyEntityProperties(entityType, entityName, expectedProps, false); if (entityType != Entity.Type.DATABASE) { //Database unset properties doesnt work - alter database %s unset DBPROPERTIES doesnt work //Unset all the props StringBuilder sb = new StringBuilder("'"); query = String.format(fmtQuery, entityName, UNSET_OP, Joiner.on("','").skipNulls().appendTo(sb, expectedProps.keySet()).append('\'')); runCommandWithDelay(query, 1000); verifyEntityProperties(entityType, entityName, expectedProps, true); } }
Example 8
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 4 votes |
public TestReadEntity(String name, Entity.Type type) { this.name = name; this.type = type; }
Example 9
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 4 votes |
@Override public Entity.Type getType() { return type; }
Example 10
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 4 votes |
public TestWriteEntity(String name, Entity.Type type) { this.name = name; this.type = type; }
Example 11
Source File: HiveHookIT.java From atlas with Apache License 2.0 | 4 votes |
@Override public Entity.Type getType() { return type; }