From 5df5c4a738d6c3049c8f8ae58eff8364e4fbf9a9 Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Mon, 23 Dec 2024 18:19:46 +0100 Subject: [PATCH] Remove transaction argument from DDLManager::createColumn The transaction can be retrieved from the Statement object. --- core/src/main/java/org/polypheny/db/ddl/DdlManager.java | 3 +-- dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java | 4 ++-- .../sql/language/ddl/altertable/SqlAlterTableAddColumn.java | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/polypheny/db/ddl/DdlManager.java b/core/src/main/java/org/polypheny/db/ddl/DdlManager.java index 951b5e4ccc..25e16feeb9 100644 --- a/core/src/main/java/org/polypheny/db/ddl/DdlManager.java +++ b/core/src/main/java/org/polypheny/db/ddl/DdlManager.java @@ -159,7 +159,6 @@ public static DdlManager getInstance() { /** * Add a column to an existing table * - * @param transaction current transaction * @param columnName the name of the new column * @param table the table * @param beforeColumnName the column before which the new column should be positioned; can be null @@ -169,7 +168,7 @@ public static DdlManager getInstance() { * @param defaultValue a default value for the column; can be null * @param statement the query statement */ - public abstract void createColumn( Transaction transaction, String columnName, LogicalTable table, String beforeColumnName, String afterColumnName, ColumnTypeInformation type, boolean nullable, PolyValue defaultValue, Statement statement ); + public abstract void createColumn( String columnName, LogicalTable table, String beforeColumnName, String afterColumnName, ColumnTypeInformation type, boolean nullable, PolyValue defaultValue, Statement statement ); /** * Add a foreign key to a table diff --git a/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java b/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java index 5d3d50c873..c60164644f 100644 --- a/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java +++ b/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java @@ -456,7 +456,7 @@ private void updateColumnPosition( LogicalTable table, LogicalColumn column, int @Override - public void createColumn( Transaction transaction, String columnName, LogicalTable table, String beforeColumnName, String afterColumnName, ColumnTypeInformation type, boolean nullable, PolyValue defaultValue, Statement statement ) { + public void createColumn( String columnName, LogicalTable table, String beforeColumnName, String afterColumnName, ColumnTypeInformation type, boolean nullable, PolyValue defaultValue, Statement statement ) { columnName = adjustNameIfNeeded( columnName, table.namespaceId ); // Check if the column either allows null values or has a default value defined. if ( defaultValue == null && !nullable ) { @@ -495,7 +495,7 @@ public void createColumn( Transaction transaction, String columnName, LogicalTab List> stores = RoutingManager.getInstance().getCreatePlacementStrategy().getDataStoresForNewRelField( addedColumn ); // Add column on underlying data stores and insert default value - transaction.attachCommitAction( () -> { + statement.getTransaction().attachCommitAction( () -> { for ( DataStore store : stores ) { AllocationPlacement placement = catalog.getSnapshot().alloc().getPlacement( store.getAdapterId(), table.id ).orElseThrow(); diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/altertable/SqlAlterTableAddColumn.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/altertable/SqlAlterTableAddColumn.java index a72e8c0412..0e3c87e522 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/altertable/SqlAlterTableAddColumn.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/altertable/SqlAlterTableAddColumn.java @@ -141,7 +141,6 @@ public void execute( Context context, Statement statement, ParsedQueryContext pa } DdlManager.getInstance().createColumn( - statement.getTransaction(), column.getSimple(), logicalTable, beforeColumnName == null ? null : beforeColumnName.getSimple(),