@Override public TableDto create(@Nonnull QualifiedName name){
  TableDto result=null;
  log.info("Get the table {}",name);
  Optional<TableDto> oTable=tableService.get(name,false);
  if (oTable.isPresent()) {
    TableDto table=oTable.get();
    String viewName=createViewName(name);
    QualifiedName targetName=QualifiedName.ofTable(name.getCatalogName(),VIEW_DB_NAME,viewName);
    log.info("Check if the view table {} exists.",targetName);
    Optional<TableDto> oViewTable=Optional.empty();
    try {
      oViewTable=tableService.get(targetName,false);
    }
 catch (    NotFoundException ignored) {
    }
    if (!oViewTable.isPresent()) {
      log.info("Creating view {}.",targetName);
      result=tableService.copy(table,targetName);
    }
 else {
      result=oViewTable.get();
    }
  }
 else {
    throw new TableNotFoundException(new SchemaTableName(name.getDatabaseName(),name.getTableName()));
  }
  return result;
}

@ Override public TableDto create ( @ Nonnull QualifiedName name ) { TableDto result = null ; log . info ( "Get the table {}" , name ) ; Optional < TableDto > oTable = tableService . get ( name , false ) ; if ( oTable . isPresent ( ) ) { TableDto table = oTable . get ( ) ; String viewName = createViewName ( name ) ; QualifiedName targetName = QualifiedName . ofTable ( name . getCatalogName ( ) , VIEW_DB_NAME , viewName ) ; log . info ( "Check if the view table {} exists." , targetName ) ; Optional < TableDto > oViewTable = Optional . empty ( ) ; try { oViewTable = tableService . get ( targetName , false ) ; } catch ( NotFoundException ignored ) { } if ( ! oViewTable . isPresent ( ) ) { log . info ( "Creating view {}." , targetName ) ; result = tableService . copy ( table , targetName ) ; } else { result = oViewTable . get ( ) ; } } else { throw new TableNotFoundException ( new SchemaTableName ( name . getDatabaseName ( ) , name . getTableName ( ) ) ) ; } return result ; }
creates the materialized view using the schema of the give table assumes that the " franklinviews " database name already exists in the given catalog .
