andygrove commented on code in PR #4799: URL: https://github.com/apache/datafusion-comet/pull/4799#discussion_r3589327484
########## spark/src/main/spark-3.x/org/apache/comet/shims/ShimLegacyConfFallback.scala: ########## @@ -0,0 +1,53 @@ +/* + * 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.comet.shims + +/** + * Spark 3.x variant: several entries in this map (view-schema compensation, decimal truncate, + * duplicate-between, scalar-subquery count-bug, disable-map-key-normalization, cache-ignore- + * options) do not exist as [[org.apache.spark.internal.config.ConfigEntry]] instances in Spark + * 3.5 or earlier, so the defaults are hardcoded. They match the Spark 4 defaults on purpose: the + * fallback rule is "when a legacy key is set to something other than the Spark 4 default, disable + * Comet". This keeps 3.x and 4.x behaviourally aligned even though 3.x can't derive the defaults + * live. See the 4.x shim for the reference-derived variant. + */ +trait ShimLegacyConfFallback { + + protected def legacyConfDefaults: Map[String, String] = Map( + "spark.sql.legacy.decimal.retainFractionDigitsOnTruncate" -> "false", + "spark.sql.legacy.literal.pickMinimumPrecision" -> "true", + "spark.sql.legacy.charVarcharAsString" -> "false", + "spark.sql.legacy.allowParameterlessCount" -> "false", + "spark.sql.legacy.doLooseUpcast" -> "false", + "spark.sql.legacy.typeCoercion.datetimeToString.enabled" -> "false", + "spark.sql.legacy.duplicateBetweenInput" -> "false", + "spark.sql.legacy.inSubqueryNullability" -> "false", + "spark.sql.legacy.scalarSubqueryCountBugBehavior" -> "false", + "spark.sql.legacy.disableMapKeyNormalization" -> "false", + "spark.sql.legacy.setopsPrecedence.enabled" -> "false", + "spark.sql.legacy.viewSchemaCompensation" -> "true", + "spark.sql.legacy.timeParserPolicy" -> "CORRECTED", + "spark.sql.legacy.parquet.datetimeRebaseModeInRead" -> "CORRECTED", + "spark.sql.legacy.parquet.datetimeRebaseModeInWrite" -> "CORRECTED", + "spark.sql.legacy.parquet.int96RebaseModeInRead" -> "CORRECTED", + "spark.sql.legacy.parquet.int96RebaseModeInWrite" -> "CORRECTED", + "spark.sql.legacy.parquet.nanosAsLong" -> "false", Review Comment: Can we not handle the parquet onces in scan planning? ########## spark/src/main/spark-3.x/org/apache/comet/shims/ShimLegacyConfFallback.scala: ########## @@ -0,0 +1,53 @@ +/* + * 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.comet.shims + +/** + * Spark 3.x variant: several entries in this map (view-schema compensation, decimal truncate, + * duplicate-between, scalar-subquery count-bug, disable-map-key-normalization, cache-ignore- + * options) do not exist as [[org.apache.spark.internal.config.ConfigEntry]] instances in Spark + * 3.5 or earlier, so the defaults are hardcoded. They match the Spark 4 defaults on purpose: the + * fallback rule is "when a legacy key is set to something other than the Spark 4 default, disable + * Comet". This keeps 3.x and 4.x behaviourally aligned even though 3.x can't derive the defaults + * live. See the 4.x shim for the reference-derived variant. + */ +trait ShimLegacyConfFallback { + + protected def legacyConfDefaults: Map[String, String] = Map( + "spark.sql.legacy.decimal.retainFractionDigitsOnTruncate" -> "false", + "spark.sql.legacy.literal.pickMinimumPrecision" -> "true", + "spark.sql.legacy.charVarcharAsString" -> "false", + "spark.sql.legacy.allowParameterlessCount" -> "false", + "spark.sql.legacy.doLooseUpcast" -> "false", + "spark.sql.legacy.typeCoercion.datetimeToString.enabled" -> "false", + "spark.sql.legacy.duplicateBetweenInput" -> "false", + "spark.sql.legacy.inSubqueryNullability" -> "false", + "spark.sql.legacy.scalarSubqueryCountBugBehavior" -> "false", + "spark.sql.legacy.disableMapKeyNormalization" -> "false", + "spark.sql.legacy.setopsPrecedence.enabled" -> "false", + "spark.sql.legacy.viewSchemaCompensation" -> "true", + "spark.sql.legacy.timeParserPolicy" -> "CORRECTED", + "spark.sql.legacy.parquet.datetimeRebaseModeInRead" -> "CORRECTED", + "spark.sql.legacy.parquet.datetimeRebaseModeInWrite" -> "CORRECTED", + "spark.sql.legacy.parquet.int96RebaseModeInRead" -> "CORRECTED", + "spark.sql.legacy.parquet.int96RebaseModeInWrite" -> "CORRECTED", + "spark.sql.legacy.parquet.nanosAsLong" -> "false", Review Comment: Can we not handle the parquet ones in scan planning? -- 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]
