Source:
public void createView(ConnectorSession session, ConnectorTableMetadata viewMetadata, String viewData, boolean replace) { Map<String, String> properties = ImmutableMap.<String, String>builder() .put(TABLE_COMMENT, "Presto View") .put(PRESTO_VIEW_FLAG, "true") .put(PRESTO_VERSION_NAME, prestoVersion) .put(PRESTO_QUERY_ID_NAME, session.getQueryId()) .build(); List<Column> columns = viewMetadata.getColumns().stream() .map(col -> new Column(col.getName(), toHiveType(typeTranslator, col.getType()), Optional.ofNullable(col.getComment()))) .collect(toImmutableList()); Table.Builder tableBuilder = Table.builder() .setDatabaseName(viewMetadata.getTable().getSchemaName()) .setTableName(viewMetadata.getTable().getTableName()) .setOwner(session.getUser()) .setTableType(VIRTUAL_VIEW) .setDataColumns(columns) .setPartitionColumns(ImmutableList.of()) .setParameters(properties) .setViewOriginalText(Optional.of(encodeViewData(viewData))) .setViewExpandedText(Optional.of(" ")); tableBuilder.getStorageBuilder() .setStorageFormat(VIEW_STORAGE_FORMAT) .setLocation(""); Table table = tableBuilder.build(); PrincipalPrivileges principalPrivileges = buildInitialPrivilegeSet(session.getUser()); Optional<Table> existing = metastore.getTable(viewMetadata.getTable().getSchemaName(), viewMetadata.getTable().getTableName()); if (existing.isPresent()) { if (!replace || !MetastoreUtil.isPrestoView(existing.get())) { throw new ViewAlreadyExistsException(viewMetadata.getTable()); } metastore.replaceView(viewMetadata.getTable().getSchemaName(), viewMetadata.getTable().getTableName(), table, principalPrivileges); return; } try { metastore.createTable(session, table, principalPrivileges, Optional.empty(), false, new PartitionStatistics(createEmptyStatistics(), ImmutableMap.of())); } catch (TableAlreadyExistsException e) { throw new ViewAlreadyExistsException(e.getTableName()); } }

Target:
public void createView(ConnectorSession session, ConnectorTableMetadata viewMetadata, String viewData, boolean replace) { Map<String, String> properties = ImmutableMap.<String, String>builder() .put(TABLE_COMMENT, "Presto View") .put(PRESTO_VIEW_FLAG, "true") .put(PRESTO_VERSION_NAME, prestoVersion) .put(PRESTO_QUERY_ID_NAME, session.getQueryId()) .build(); List<Column> columns = viewMetadata.getColumns().stream() .map(col -> new Column(col.getName(), toHiveType(typeTranslator, col.getType()), Optional.ofNullable(col.getComment()))) .collect(toImmutableList()); SchemaTableName viewName = viewMetadata.getTable(); Table.Builder tableBuilder = Table.builder() .setDatabaseName(viewName.getSchemaName()) .setTableName(viewName.getTableName()) .setOwner(session.getUser()) .setTableType(VIRTUAL_VIEW) .setDataColumns(columns) .setPartitionColumns(ImmutableList.of()) .setParameters(properties) .setViewOriginalText(Optional.of(encodeViewData(viewData))) .setViewExpandedText(Optional.of(" ")); tableBuilder.getStorageBuilder() .setStorageFormat(VIEW_STORAGE_FORMAT) .setLocation(""); Table table = tableBuilder.build(); PrincipalPrivileges principalPrivileges = buildInitialPrivilegeSet(session.getUser()); Optional<Table> existing = metastore.getTable(viewName.getSchemaName(), viewName.getTableName()); if (existing.isPresent()) { if (!replace || !MetastoreUtil.isPrestoView(existing.get())) { throw new ViewAlreadyExistsException(viewName); } metastore.replaceView(viewName.getSchemaName(), viewName.getTableName(), table, principalPrivileges); return; } try { metastore.createTable(session, table, principalPrivileges, Optional.empty(), false, new PartitionStatistics(createEmptyStatistics(), ImmutableMap.of())); } catch (TableAlreadyExistsException e) { throw new ViewAlreadyExistsException(e.getTableName()); } }