zhztheplayer commented on code in PR #5058: URL: https://github.com/apache/incubator-gluten/pull/5058#discussion_r1533287265
########## gluten-cbo/common/src/main/scala/io/glutenproject/cbo/CboNode.scala: ########## @@ -0,0 +1,129 @@ +/* + * 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 io.glutenproject.cbo + +trait CboNode[T <: AnyRef] { + def cbo(): Cbo[T] + def self(): T + def propSet(): PropertySet[T] +} + +object CboNode { + implicit class CboNodeImplicits[T <: AnyRef](node: CboNode[T]) { + def isCanonical: Boolean = { + node.isInstanceOf[CanonicalNode[T]] + } + + def asCanonical(): CanonicalNode[T] = { + node.asInstanceOf[CanonicalNode[T]] + } + + def isGroup: Boolean = { + node.isInstanceOf[GroupNode[T]] + } + + def asGroup(): GroupNode[T] = { + node.asInstanceOf[GroupNode[T]] + } + } +} + +trait CanonicalNode[T <: AnyRef] extends CboNode[T] { Review Comment: Canonical node is a node with all children replaced by resident groups. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
