naveenp2708 commented on code in PR #57644: URL: https://github.com/apache/spark/pull/57644#discussion_r3799232860
########## sql/pipelines/src/test/scala/org/apache/spark/sql/pipelines/graph/AutoCdcReservedColumnMaterializationSuite.scala: ########## @@ -0,0 +1,136 @@ +/* + * 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.graph + +import java.util.Locale + +import org.apache.spark.sql.Row +import org.apache.spark.sql.execution.streaming.runtime.MemoryStream +import org.apache.spark.sql.functions +import org.apache.spark.sql.internal.SQLConf +import org.apache.spark.sql.pipelines.autocdc.{AutoCdcReservedNames, Scd1BatchProcessor} +import org.apache.spark.sql.pipelines.utils.{ExecutionTest, TestGraphRegistrationContext} +import org.apache.spark.sql.test.SharedSparkSession +import org.apache.spark.sql.types.{IntegerType, LongType, StringType, StructType} + +/** + * Materialization-level tests for AUTO CDC's engine-owned reserved metadata column (SPARK-58118). + * + * The reserved `__spark_autocdc_metadata` column is engine-owned: a user-declared schema may omit + * it, and materialization appends the engine-owned shape so the created table matches what the + * AUTO CDC MERGE writes at runtime. Reserved-column matching goes through the flow's effective + * case sensitivity -- a pipeline-level `SET spark.sql.caseSensitive` can differ from the session -- + * so these tests inspect the created table's schema rather than only validation. + */ +class AutoCdcReservedColumnMaterializationSuite Review Comment: Added. AutoCdcReservedColumnMaterializationSuite has a test where a downstream MV in the same graph does SELECT * from the target and asserts the consumer's schema matches the materialized target. It fails without the read-path fix. -- 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]
