weixiuli commented on code in PR #8583:
URL: https://github.com/apache/incubator-gluten/pull/8583#discussion_r1924838154
##########
cpp/velox/compute/WholeStageResultIterator.cc:
##########
@@ -551,8 +551,13 @@ std::unordered_map<std::string, std::string>
WholeStageResultIterator::getQueryC
configs[velox::core::QueryConfig::kSparkPartitionId] =
std::to_string(taskInfo_.partitionId);
- // Enable Spark legacy date formatter if spark.sql.legacy.timeParserPolicy
is set to 'LEGACY'.
- if (veloxCfg_->get<std::string>(kSparkLegacyTimeParserPolicy, "") ==
"LEGACY") {
+ // Enable Spark legacy date formatter if spark.sql.legacy.timeParserPolicy
is set to 'LEGACY'
+ // or 'legacy'.
+ auto sparkPolicy =
veloxCfg_->get<std::string>(kSparkLegacyTimeParserPolicy, "");
+ for (auto& c : sparkPolicy) {
+ c = std::toupper(static_cast<unsigned char>(c));
+ }
+ if (sparkPolicy == "LEGACY") {
Review Comment:
Spark uses the toUpper and supports the `legacy`,`Legacy` ,`LEgacy` and so
on. So, we should be compatible with spark's behavior.
https://github.com/apache/spark/blob/8611d0fa05b47ce71f899f5d3fe715b8b935dd45/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala#L4532-L4544
``` scala
val LEGACY_TIME_PARSER_POLICY =
buildConf(SqlApiConfHelper.LEGACY_TIME_PARSER_POLICY_KEY)
.internal()
.doc("When LEGACY, java.text.SimpleDateFormat is used for formatting and
parsing " +
"dates/timestamps in a locale-sensitive manner, which is the approach
before Spark 3.0. " +
"When set to CORRECTED, classes from java.time.* packages are used for
the same purpose. " +
"When set to EXCEPTION, RuntimeException is thrown when we will get
different " +
"results. The default is CORRECTED.")
.version("3.0.0")
.stringConf
.transform(_.toUpperCase(Locale.ROOT))
.checkValues(LegacyBehaviorPolicy.values.map(_.toString))
.createWithDefault(LegacyBehaviorPolicy.CORRECTED.toString)
```
--
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]