Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ protected void renameTable(ConnectorSession session, Connection connection, Stri
quoted(catalogName, newRemoteSchemaName, newRemoteTableName)));
}

private RemoteTableName constructPageSinkIdsTable(ConnectorSession session, Connection connection, JdbcOutputTableHandle handle, Set<Long> pageSinkIds)
private RemoteTableName constructPageSinkIdsTable(ConnectorSession session, Connection connection, JdbcOutputTableHandle handle, Set<Long> pageSinkIds, Closer closer)
throws SQLException
{
verify(handle.getPageSinkIdColumnName().isPresent(), "Output table handle's pageSinkIdColumn is empty");
Expand All @@ -903,6 +903,7 @@ private RemoteTableName constructPageSinkIdsTable(ConnectorSession session, Conn
LongWriteFunction pageSinkIdWriter = (LongWriteFunction) toWriteMapping(session, TRINO_PAGE_SINK_ID_COLUMN_TYPE).getWriteFunction();

execute(session, connection, pageSinkTableSql);
closer.register(() -> dropTable(session, pageSinkTable, true));
Comment thread
hashhar marked this conversation as resolved.

try (PreparedStatement statement = connection.prepareStatement(pageSinkInsertSql)) {
int batchSize = 0;
Expand Down Expand Up @@ -959,8 +960,7 @@ public void finishInsertTable(ConnectorSession session, JdbcOutputTableHandle ha
quoted(temporaryTable));

if (handle.getPageSinkIdColumnName().isPresent()) {
RemoteTableName pageSinkTable = constructPageSinkIdsTable(session, connection, handle, pageSinkIds);
closer.register(() -> dropTable(session, pageSinkTable, true));
RemoteTableName pageSinkTable = constructPageSinkIdsTable(session, connection, handle, pageSinkIds, closer);

insertSql += format(" WHERE EXISTS (SELECT 1 FROM %s page_sink_table WHERE page_sink_table.%s = temp_table.%s)",
quoted(pageSinkTable),
Expand Down