davidradl commented on code in PR #26306: URL: https://github.com/apache/flink/pull/26306#discussion_r2005889032
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/trait/DeleteKindTrait.scala: ########## @@ -0,0 +1,100 @@ +/* + * 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.flink.table.planner.plan.`trait` + +import org.apache.flink.table.connector.ChangelogMode +import org.apache.flink.types.RowKind + +import org.apache.calcite.plan.{RelOptPlanner, RelTrait, RelTraitDef} + +/** DeleteKindTrait is used to describe the kind of delete operation. */ +class DeleteKindTrait(val deleteKind: DeleteKind) extends RelTrait { + + override def satisfies(relTrait: RelTrait): Boolean = relTrait match { + case other: DeleteKindTrait => + // should totally match + other.deleteKind == this.deleteKind + case _ => false + } + + override def getTraitDef: RelTraitDef[_ <: RelTrait] = DeleteKindTraitDef.INSTANCE + + override def register(planner: RelOptPlanner): Unit = {} + + override def hashCode(): Int = deleteKind.hashCode() + + override def equals(obj: Any): Boolean = obj match { + case t: DeleteKindTrait => this.deleteKind.equals(t.deleteKind) + case _ => false + } + + override def toString: String = s"[${deleteKind.toString}]" +} + +object DeleteKindTrait { + + /** An [[DeleteKindTrait]] that describes the node does not support delete operation. */ + val NONE = new DeleteKindTrait(DeleteKind.NONE) + + /** An [[DeleteKindTrait]] that describes the node supports deletes on key only. */ + val DELETE_ON_KEY = new DeleteKindTrait(DeleteKind.DELETE_ON_KEY) + + /** An [[DeleteKindTrait]] that describes the node produces requires deletes by full records. */ + val FULL_DELETE = new DeleteKindTrait(DeleteKind.FULL_DELETE) + + /** + * Returns DELETE_ON_KEY [[DeleteKindTrait]] if there is delete changes. Otherwise, returns NONE Review Comment: nit: is -> are -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org