FANNG1 commented on code in PR #5559: URL: https://github.com/apache/gravitino/pull/5559#discussion_r1839348017
########## core/src/main/java/org/apache/gravitino/listener/api/event/CreateSchemaPreEvent.java: ########## @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.gravitino.listener.api.event; + +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.annotation.DeveloperApi; +import org.apache.gravitino.listener.api.info.SchemaInfo; + +/** Represents an event triggered before creating a schema. */ +@DeveloperApi +public final class CreateSchemaPreEvent extends SchemaPreEvent { + private final SchemaInfo createdSchemaRequest; + + public CreateSchemaPreEvent( + String user, NameIdentifier identifier, SchemaInfo createdSchemaRequest) { + super(user, identifier); + this.createdSchemaRequest = createdSchemaRequest; + } + + /** + * Retrieves the create schema request. + * + * @return A {@link SchemaInfo} instance encapsulating the comprehensive details of the newly + * created schema. + */ + public SchemaInfo createdSchemaInfo() { Review Comment: createdSchemaInfo -> createSchemaRequest? ########## core/src/main/java/org/apache/gravitino/listener/api/event/CreateSchemaPreEvent.java: ########## @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.gravitino.listener.api.event; + +import org.apache.gravitino.NameIdentifier; +import org.apache.gravitino.annotation.DeveloperApi; +import org.apache.gravitino.listener.api.info.SchemaInfo; + +/** Represents an event triggered before creating a schema. */ +@DeveloperApi +public final class CreateSchemaPreEvent extends SchemaPreEvent { + private final SchemaInfo createdSchemaRequest; + + public CreateSchemaPreEvent( + String user, NameIdentifier identifier, SchemaInfo createdSchemaRequest) { Review Comment: createdSchemaRequest -> createSchemaRequest? ########## core/src/main/java/org/apache/gravitino/listener/api/event/AlterTablePreEvent.java: ########## @@ -30,7 +30,7 @@ public class AlterTablePreEvent extends TablePreEvent { public AlterTablePreEvent(String user, NameIdentifier identifier, TableChange[] tableChanges) { super(user, identifier); - this.tableChanges = tableChanges; + this.tableChanges = tableChanges.clone(); Review Comment: In post-event, the objects are cloned to prevent the user from changing the object. But in pre-event, I prefer to relax the constraint to allow users to make changes to in inject some custom logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
