-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disable checking for uint_8 and uint_16 if complex type readers are enabled #1376
base: main
Are you sure you want to change the base?
Changes from 7 commits
940aed5
db7b11e
0aa27d6
5dfdc19
9389be8
501c52a
a6c33a0
2c2237d
ddfac54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1352,6 +1352,11 @@ object CometSparkSessionExtensions extends Logging { | |
org.apache.spark.SPARK_VERSION >= "4.0" | ||
} | ||
|
||
def isComplexTypeReaderEnabled(conf: SQLConf): Boolean = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find the naming confusing here. This method determines if we are using Complex type support was a big motivation for adding these new scans, but it doesn't seem to make sense to refer to complex types in the changes in this PR. This is just a nit, and we can rename the methods in a future PR. |
||
CometConf.COMET_NATIVE_SCAN_IMPL.get(conf) == CometConf.SCAN_NATIVE_ICEBERG_COMPAT || | ||
CometConf.COMET_NATIVE_SCAN_IMPL.get(conf) == CometConf.SCAN_NATIVE_DATAFUSION | ||
} | ||
|
||
/** Calculates required memory overhead in MB per executor process for Comet. */ | ||
def getCometMemoryOverheadInMiB(sparkConf: SparkConf): Long = { | ||
// `spark.executor.memory` default value is 1g | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,12 +39,14 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
val path = new Path(dir.toURI.toString, "test.parquet") | ||
makeParquetFileAllTypes(path, dictionaryEnabled, 10000) | ||
spark.read.parquet(path.toString).createOrReplaceTempView("t1") | ||
checkSparkAnswerAndOperator( | ||
sql("SELECT array_remove(array(_2, _3,_4), _2) from t1 where _2 is null")) | ||
checkSparkAnswerAndOperator( | ||
sql("SELECT array_remove(array(_2, _3,_4), _3) from t1 where _3 is not null")) | ||
checkSparkAnswerAndOperator(sql( | ||
"SELECT array_remove(case when _2 = _3 THEN array(_2, _3,_4) ELSE null END, _3) from t1")) | ||
withSQLConf(CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be okay with that. Most Spark users will not have unsigned ints, and having it false creates a penalty for users who do not have any unsigned ints unless they explicitly set the allow incompatible flag. |
||
checkSparkAnswerAndOperator( | ||
sql("SELECT array_remove(array(_2, _3,_4), _2) from t1 where _2 is null")) | ||
checkSparkAnswerAndOperator( | ||
sql("SELECT array_remove(array(_2, _3,_4), _3) from t1 where _3 is not null")) | ||
checkSparkAnswerAndOperator(sql( | ||
"SELECT array_remove(case when _2 = _3 THEN array(_2, _3,_4) ELSE null END, _3) from t1")) | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -74,7 +76,9 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
sql(s"SELECT array($fieldName, $fieldName) as a, $fieldName as b FROM t1") | ||
.createOrReplaceTempView("t2") | ||
val df = sql("SELECT array_remove(a, b) FROM t2") | ||
checkSparkAnswerAndOperator(df) | ||
withSQLConf(CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
checkSparkAnswerAndOperator(df) | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -121,22 +125,26 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
val path = new Path(dir.toURI.toString, "test.parquet") | ||
makeParquetFileAllTypes(path, dictionaryEnabled = true, 100) | ||
spark.read.parquet(path.toString).createOrReplaceTempView("t1") | ||
sql("SELECT array(struct(_1, _2)) as a, struct(_1, _2) as b FROM t1") | ||
.createOrReplaceTempView("t2") | ||
val expectedFallbackReasons = HashSet( | ||
"data type not supported: ArrayType(StructType(StructField(_1,BooleanType,true),StructField(_2,ByteType,true)),false)") | ||
// note that checkExtended is disabled here due to an unrelated issue | ||
// https://github.com/apache/datafusion-comet/issues/1313 | ||
checkSparkAnswerAndCompareExplainPlan( | ||
sql("SELECT array_remove(a, b) FROM t2"), | ||
expectedFallbackReasons, | ||
checkExplainString = false) | ||
withSQLConf(CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
sql("SELECT array(struct(_1, _2)) as a, struct(_1, _2) as b FROM t1") | ||
.createOrReplaceTempView("t2") | ||
val expectedFallbackReasons = HashSet( | ||
"data type not supported: ArrayType(StructType(StructField(_1,BooleanType,true),StructField(_2,ByteType,true)),false)") | ||
// note that checkExtended is disabled here due to an unrelated issue | ||
// https://github.com/apache/datafusion-comet/issues/1313 | ||
checkSparkAnswerAndCompareExplainPlan( | ||
sql("SELECT array_remove(a, b) FROM t2"), | ||
expectedFallbackReasons, | ||
checkExplainString = false) | ||
} | ||
} | ||
} | ||
|
||
test("array_append") { | ||
assume(isSpark34Plus) | ||
withSQLConf(CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withSQLConf( | ||
CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true", | ||
CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
Seq(true, false).foreach { dictionaryEnabled => | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
|
@@ -220,7 +228,9 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
} | ||
|
||
test("array_contains") { | ||
withSQLConf(CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withSQLConf( | ||
CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true", | ||
CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
makeParquetFileAllTypes(path, dictionaryEnabled = false, n = 10000) | ||
|
@@ -234,7 +244,9 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
} | ||
|
||
test("array_intersect") { | ||
withSQLConf(CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withSQLConf( | ||
CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true", | ||
CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
Seq(true, false).foreach { dictionaryEnabled => | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
|
@@ -252,7 +264,9 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
} | ||
|
||
test("array_join") { | ||
withSQLConf(CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withSQLConf( | ||
CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true", | ||
CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
Seq(true, false).foreach { dictionaryEnabled => | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
|
@@ -273,7 +287,9 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp | |
} | ||
|
||
test("arrays_overlap") { | ||
withSQLConf(CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true") { | ||
withSQLConf( | ||
CometConf.COMET_EXPR_ALLOW_INCOMPATIBLE.key -> "true", | ||
CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key -> "true") { | ||
Seq(true, false).foreach { dictionaryEnabled => | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We link to the Compatibility Guide here but there is no new information in that guide about handling for byte/short, so would be good to add that. This could be done in a follow on PR.