Skip to content

Commit

Permalink
Remove transaction argument from DDLManager::createColumn
Browse files Browse the repository at this point in the history
The transaction can be retrieved from the Statement object.
  • Loading branch information
gartens committed Dec 23, 2024
1 parent 83cca1e commit 5df5c4a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions core/src/main/java/org/polypheny/db/ddl/DdlManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -495,7 +495,7 @@ public void createColumn( Transaction transaction, String columnName, LogicalTab
List<DataStore<?>> 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 5df5c4a

Please sign in to comment.