voonhous commented on code in PR #19164:
URL: https://github.com/apache/hudi/pull/19164#discussion_r3878671612


##########
hudi-spark-datasource/hudi-spark-common/src/test/scala/org/apache/hudi/TestSparkDatasourceSmallClasses.scala:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.hudi
+
+import org.apache.hudi.exception.HoodieException
+import org.apache.hudi.util.CachingIterator
+
+import org.apache.spark.sql.HoodieSparkCatalogUtils
+import org.apache.spark.sql.connector.catalog.{Identifier, Table, 
TableCapability, TableCatalog}
+import org.apache.spark.sql.connector.expressions.{Expressions, Transform}
+import org.apache.spark.sql.connector.write.LogicalWriteInfo
+import org.apache.spark.sql.hudi.catalog.BasicStagedTable
+import 
org.apache.spark.sql.hudi.command.HoodieSparkValidateDuplicateKeyRecordMerger
+import org.apache.spark.sql.types.{DataTypes, StructType}
+import org.junit.jupiter.api.Assertions.{assertEquals, assertFalse, 
assertThrows, assertTrue, fail}
+import org.junit.jupiter.api.Test
+import org.mockito.Mockito.{mock, verify, when}
+
+/**
+ * Coverage for a handful of small, otherwise-untested classes in the Spark 
datasource:
+ * [[CachingIterator]], [[HoodieSparkCatalogUtils]], [[BasicStagedTable]] and
+ * [[HoodieSparkValidateDuplicateKeyRecordMerger]].
+ */
+class TestSparkDatasourceSmallClasses {

Review Comment:
   76e1b5c8efec replaces `TestHoodieSparkCatalogUtils` with `TestHoodieCatalog` 
covering `convertTransforms` (identity, bucket, sorted bucket, the two 
rejections); the extractor is covered through it, including the `sorted_bucket` 
arm the standalone test could not reach (`sortedRefs` is hardcoded empty on the 
plain `bucket` arm). `TestBasicStagedTable` keeps only the commit/abort pair; 
metadata delegation was already asserted through a real `HoodieCatalog` in 
`TestHoodieCatalogStagedTable`.



##########
hudi-spark-datasource/hudi-spark/src/test/java/org/apache/hudi/cli/TestSchemaProvider.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.hudi.cli;
+
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.schema.HoodieSchema;
+
+import org.apache.avro.Schema;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+/**
+ * Tests default behavior of the abstract {@link SchemaProvider} used by Hudi 
Streamer.

Review Comment:
   76e1b5c8efec reshapes `TestCliSchemaProvider` after the flink copy's 
`TestSchemaProviderCompatibility` (one static schema, anonymous subclasses, 
legacy/modern/null cases). The production comment now names the two provider 
shapes that reach the catch; the earlier wording ("supplies only a source 
schema") never does, since `getSourceSchema()` is abstract here.



-- 
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]

Reply via email to