PetarVasiljevic-DB commented on code in PR #50921: URL: https://github.com/apache/spark/pull/50921#discussion_r2097685142
########## sql/catalyst/src/main/java/org/apache/spark/sql/connector/join/JoinColumn.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.spark.sql.connector.join; + +import org.apache.spark.annotation.Evolving; +import org.apache.spark.sql.connector.expressions.Expression; +import org.apache.spark.sql.connector.expressions.NamedReference; + +/** + * Represents a column reference used in DSv2 Join pushdown. + * + * @since 4.0.0 + */ +@Evolving +public final class JoinColumn implements NamedReference { + public JoinColumn(String[] qualifier, String name, Boolean isInLeftSideOfJoin) { + this.qualifier = qualifier; + this.name = name; + this.isInLeftSideOfJoin = isInLeftSideOfJoin; + } + + public String[] qualifier; + public String name; Review Comment: We can have similar implementation as `FieldReference` where we would have `parts` and `isInLeftSideOfJoin` fields, but I find the separation between qualifier and name nicer because it makes code cleaner in some way. If you take a look at `JDBCScanBuilder.pushJoin` we are passing the condition that contains JoinColumns as leaf expressions, but these are not yet qualified. I am qualifying these later on, in `qualifyCondition` method. Without `qualifier-name` separation, and with `parts:Seq[String]` I would need to do array shifting, which is fine but I just find it nicer my way. I can however change the implementation of JoinColumn if to be something like: ``` private[sql] final case class JoinColumn( parts: Seq[String], isInLeftSideOfJoin: Boolean) extends NamedReference { import org.apache.spark.sql.connector.catalog.CatalogV2Implicits.MultipartIdentifierHelper override def fieldNames(): Array[String] = parts.toArray } ``` Honestly, I am fine with both -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org