HyukjinKwon commented on code in PR #59929:
URL: https://github.com/apache/spark/pull/59929#discussion_r4470819107
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/ffi/NativeDataSourceSuite.scala:
##########
@@ -881,6 +994,16 @@ class NativeDataSourceSuite extends QueryTest with
SharedSparkSession {
check("plan a scan of", "injected failure in plan") { session =>
range(session, "fail" -> "plan").collect()
}
+ // Spark releases the ranges of the domains that it pushes down, after a
failure of push_domains
Review Comment:
Added in ad6187b: with the option `move_domains`, the test library moves the
ranges and their schema in `push_domains`, checks them again when it plans the
partitions, and releases them when the reader is closed. The new check in
"report the errors of native code" pushes the domain through
`ColumnarScanBuilder` with that option, checks that the Arrow allocator still
holds the ranges after `push_domains`, plans the partitions, and checks that
the allocator is back to its baseline once the reader is closed.
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/columnar/ColumnDomainsSuite.scala:
##########
@@ -0,0 +1,383 @@
+/*
+ * 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.columnar
+
+import java.sql.Date
+
+import scala.jdk.CollectionConverters._
+import scala.util.Random
+
+import org.scalatest.concurrent.TimeLimits
+import org.scalatest.time.SpanSugar._
+
+import org.apache.spark.sql.{Column, QueryTest, Row}
+import org.apache.spark.sql.catalyst.{CatalystTypeConverters, InternalRow}
+import org.apache.spark.sql.catalyst.expressions.{Literal, PredicateHelper}
+import org.apache.spark.sql.catalyst.plans.logical.Filter
+import org.apache.spark.sql.connector.expressions.{Expression => V2Expression,
FieldReference, LiteralValue}
+import org.apache.spark.sql.connector.expressions.filter.Predicate
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Strategy
+import org.apache.spark.sql.functions.{col, expr, not}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.SharedSparkSession
+import org.apache.spark.sql.types._
+import org.apache.spark.unsafe.types.UTF8String
+
+/** Tests how [[ColumnDomains]] derives the domains of columns from the
predicates of a query. */
+class ColumnDomainsSuite extends QueryTest with SharedSparkSession with
PredicateHelper
+ with TimeLimits {
+
+ private val schema = StructType.fromDDL("id BIGINT, i INT, d DOUBLE, f
FLOAT, s STRING, " +
Review Comment:
Added in ad6187b: the schema of `ColumnDomainsSuite` has `tinyint`,
`smallint` and `timestamp_ntz` columns, whose domains have their own types (`t:
1Y`, `sm: (-inf, 10S)`, and the `TIMESTAMP_NTZ` bounds). "the narrow integers
that the optimizer compares without a cast have domains" checks that `t = 1 AND
sm < 10`, whose analyzed plan compares the casts, gets both domains once
`UnwrapCastInBinaryComparison` rewrote it.
--
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]