gengliangwang commented on code in PR #54667:
URL: https://github.com/apache/spark/pull/54667#discussion_r2915096406


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Relation.scala:
##########
@@ -299,6 +305,75 @@ object DataSourceV2Relation {
       identifier: Option[Identifier]): DataSourceV2Relation =
     create(table, catalog, identifier, CaseInsensitiveStringMap.empty)
 
+  /**
+   * This is used to transform catalog statistics to data source v2 statistics.
+   */
+  def transformV1Stats(

Review Comment:
   `transformV1Stats` is confusing alongside the existing `transformV2Stats` 
because both say "transform X stats" but go in opposite directions: 
`transformV1Stats` converts V1 → V2, while `transformV2Stats` converts V2 → 
logical. The names describe the *input*, not the *direction*. Consider renaming 
the new method to something directional like `v1StatsToV2Stats` or `toV2Stats`.



##########
sql/catalyst/src/test/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2RelationSuite.scala:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.execution.datasources.v2
+
+import org.apache.spark.SparkFunSuite
+import org.apache.spark.sql.catalyst.catalog.{CatalogColumnStat, 
CatalogStatistics}
+import org.apache.spark.sql.catalyst.plans.logical.{Histogram, HistogramBin}
+import org.apache.spark.sql.connector.expressions.FieldReference
+import org.apache.spark.sql.types.{IntegerType, StringType, StructField, 
StructType}
+
+class DataSourceV2RelationSuite extends SparkFunSuite {
+
+  test("DataSourceV2Relation.transformV1Stats") {
+    val schema = StructType(Seq(

Review Comment:
   nit: Update the test name string to match whatever the method is renamed to.



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

Reply via email to