Java Code Examples for org.apache.hadoop.hive.metastore.api.Function#setDbName()

The following examples show how to use org.apache.hadoop.hive.metastore.api.Function#setDbName() . 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: CatalogToHiveConverter.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 6 votes vote down vote up
public static Function convertFunction(final String dbName,
                                       final com.amazonaws.services.glue.model.UserDefinedFunction catalogFunction) {
  if (catalogFunction ==  null) {
    return null;
  }
  Function hiveFunction = new Function();
  hiveFunction.setClassName(catalogFunction.getClassName());
  hiveFunction.setCreateTime((int)(catalogFunction.getCreateTime().getTime() / 1000));
  hiveFunction.setDbName(dbName);
  hiveFunction.setFunctionName(catalogFunction.getFunctionName());
  hiveFunction.setFunctionType(FunctionType.JAVA);
  hiveFunction.setOwnerName(catalogFunction.getOwnerName());
  hiveFunction.setOwnerType(convertPrincipalType(com.amazonaws.services.glue.model.PrincipalType.fromValue(catalogFunction.getOwnerType())));
  hiveFunction.setResourceUris(convertResourceUriList(catalogFunction.getResourceUris()));
  return hiveFunction;
}
 
Example 2
Source File: DatabaseMappingImplTest.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Test
public void transformOutboundFunction() throws Exception {
  Function function = new Function();
  function.setDbName(DB_NAME);
  Function result = databaseMapping.transformOutboundFunction(function);
  assertThat(result, is(sameInstance(function)));
  assertThat(result.getDbName(), is(OUT_DB_NAME));
}
 
Example 3
Source File: DatabaseMappingImplTest.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Test
public void transformInboundFunction() throws Exception {
  Function function = new Function();
  function.setDbName(DB_NAME);
  Function result = databaseMapping.transformInboundFunction(function);
  assertThat(result, is(sameInstance(function)));
  assertThat(result.getDbName(), is(IN_DB_NAME));
}
 
Example 4
Source File: FederatedHMSHandlerTest.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Test
public void create_function() throws TException {
  Function function = new Function();
  function.setDbName(DB_P);
  Function inboundFunction = new Function();
  when(primaryMapping.transformInboundFunction(function)).thenReturn(inboundFunction);
  handler.create_function(function);
  verify(primaryMapping).checkWritePermissions(DB_P);
  verify(primaryClient).create_function(inboundFunction);
}
 
Example 5
Source File: FederatedHMSHandlerTest.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Test
public void alter_function() throws TException {
  Function newFunc = new Function();
  newFunc.setDbName(DB_P);
  Function inboundFunction = new Function();
  when(primaryMapping.transformInboundFunction(newFunc)).thenReturn(inboundFunction);
  handler.alter_function(DB_P, "function", newFunc);
  verify(primaryMapping, times(2)).checkWritePermissions(DB_P);
  verify(primaryClient).alter_function(DB_P, "function", inboundFunction);
}
 
Example 6
Source File: DatabaseMappingImpl.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
public Function transformOutboundFunction(Function function) {
  function.setDbName(metaStoreMapping.transformOutboundDatabaseName(function.getDbName()));
  return function;
}
 
Example 7
Source File: DatabaseMappingImpl.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
public Function transformInboundFunction(Function function) {
  function.setDbName(metaStoreMapping.transformInboundDatabaseName(function.getDbName()));
  return function;
}