jose-torres commented on code in PR #59519: URL: https://github.com/apache/spark/pull/59519#discussion_r4588950075
########## sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/autocdc/Scd1FieldToReconcile.scala: ########## @@ -0,0 +1,92 @@ +/* + * 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.pipelines.autocdc + +import org.apache.spark.sql.catalyst.analysis.Resolver +import org.apache.spark.sql.types.StructType +import org.apache.spark.util.ArrayImplicits._ + +/** + * An SCD1 user-data field reconciled independently of all others: either a leaf of a column + * selected for ignore-null, or a whole top-level column outside the selection. It depends only on + * the user-data schema and the ignore-null selection. + * + * @param path The field's name parts within the user-data schema. + * @param leafPaths The name parts of every user-data leaf at or beneath `path`. + * @param isIgnoreNullLeaf Whether the field is a leaf of a column selected for ignore-null, which + * an upsert with a version map authors only when the map records the + * leaf as authored. If not, the field is a whole column outside the + * selection, which an upsert authors in full, nulls included, unless the + * microbatch omits all of its leaves. A column without leaves, such as an + * empty struct, cannot be recorded as omitted, so an upsert always + * authors it. + */ +private[autocdc] case class Scd1FieldToReconcile( + path: Seq[String], + leafPaths: Seq[Seq[String]], + isIgnoreNullLeaf: Boolean) + +private[autocdc] object Scd1FieldToReconcile { + + /** + * Applies `ignoreNullSelection` to `schema` and returns a [[Scd1FieldToReconcile]] for each Review Comment: This is a weird semantic, why are they leaves of selected columns but top level for unselected columns? -- 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]
