-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? supports `AlterTableEvent` `PurgeTableEvent` `LoadTableEvent` `ListTableEvent` ### Why are the changes needed? Fix: #2920 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? existing tests
- Loading branch information
Showing
17 changed files
with
388 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
core/src/main/java/com/datastrato/gravitino/listener/api/event/AlterTableEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
|
||
package com.datastrato.gravitino.listener.api.event; | ||
|
||
import com.datastrato.gravitino.NameIdentifier; | ||
import com.datastrato.gravitino.annotation.DeveloperApi; | ||
import com.datastrato.gravitino.listener.api.info.TableInfo; | ||
import com.datastrato.gravitino.rel.TableChange; | ||
|
||
/** Represents an event fired when a table is successfully altered. */ | ||
@DeveloperApi | ||
public final class AlterTableEvent extends TableEvent { | ||
private final TableInfo updatedTableInfo; | ||
private final TableChange[] tableChanges; | ||
|
||
/** | ||
* Constructs an instance of {@code AlterTableEvent}, encapsulating the key details about the | ||
* successful alteration of a table. | ||
* | ||
* @param user The username of the individual responsible for initiating the table alteration. | ||
* @param identifier The unique identifier of the altered table, serving as a clear reference | ||
* point for the table in question. | ||
* @param tableChanges An array of {@link TableChange} objects representing the specific changes | ||
* applied to the table during the alteration process. | ||
* @param updatedTableInfo The post-alteration state of the table. | ||
*/ | ||
public AlterTableEvent( | ||
String user, | ||
NameIdentifier identifier, | ||
TableChange[] tableChanges, | ||
TableInfo updatedTableInfo) { | ||
super(user, identifier); | ||
this.tableChanges = tableChanges.clone(); | ||
this.updatedTableInfo = updatedTableInfo; | ||
} | ||
|
||
/** | ||
* Retrieves the updated state of the table after the successful alteration. | ||
* | ||
* @return A {@link TableInfo} instance encapsulating the details of the altered table. | ||
*/ | ||
public TableInfo updatedTableInfo() { | ||
return updatedTableInfo; | ||
} | ||
|
||
/** | ||
* Retrieves the specific changes that were made to the table during the alteration process. | ||
* | ||
* @return An array of {@link TableChange} objects detailing each modification applied to the | ||
* table. | ||
*/ | ||
public TableChange[] tableChanges() { | ||
return tableChanges; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
core/src/main/java/com/datastrato/gravitino/listener/api/event/AlterTableFailureEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
|
||
package com.datastrato.gravitino.listener.api.event; | ||
|
||
import com.datastrato.gravitino.NameIdentifier; | ||
import com.datastrato.gravitino.annotation.DeveloperApi; | ||
import com.datastrato.gravitino.rel.TableChange; | ||
|
||
/** | ||
* Represents an event that is triggered when an attempt to alter a table fails due to an exception. | ||
*/ | ||
@DeveloperApi | ||
public final class AlterTableFailureEvent extends TableFailureEvent { | ||
private final TableChange[] tableChanges; | ||
|
||
/** | ||
* Constructs an {@code AlterTableFailureEvent} instance, capturing detailed information about the | ||
* failed table alteration attempt. | ||
* | ||
* @param user The user who initiated the table alteration operation. | ||
* @param identifier The identifier of the table that was attempted to be altered. | ||
* @param exception The exception that was thrown during the table alteration operation. | ||
* @param tableChanges The changes that were attempted on the table. | ||
*/ | ||
public AlterTableFailureEvent( | ||
String user, NameIdentifier identifier, Exception exception, TableChange[] tableChanges) { | ||
super(user, identifier, exception); | ||
this.tableChanges = tableChanges.clone(); | ||
} | ||
|
||
/** | ||
* Retrieves the changes that were attempted on the table. | ||
* | ||
* @return An array of {@link TableChange} objects representing the attempted modifications to the | ||
* table. | ||
*/ | ||
public TableChange[] tableChanges() { | ||
return tableChanges; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.