-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GLUTEN-1336][VL] add spark3.3 UT under connector and expression (#1685)
* [GLUTEN-1336][VL] add spark3.3 UT under connector and expression
- Loading branch information
Showing
34 changed files
with
1,068 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
gluten-ut/spark33/src/test/scala/org/apache/spark/sql/GlutenJsonFunctionsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 | ||
|
||
class GlutenJsonFunctionsSuite extends JsonFunctionsSuite with GlutenSQLTestsTrait { | ||
} |
112 changes: 112 additions & 0 deletions
112
...park33/src/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenAnsiCastSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* 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.catalyst.expressions | ||
|
||
import org.apache.spark.sql.{GlutenTestConstants, GlutenTestsTrait} | ||
import org.apache.spark.sql.internal.SQLConf | ||
import org.apache.spark.sql.types.{DataType, StringType} | ||
|
||
import java.time.LocalDateTime | ||
|
||
class GlutenCastSuiteWithAnsiModeOn extends AnsiCastSuiteBase with GlutenTestsTrait { | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
SQLConf.get.setConf(SQLConf.ANSI_ENABLED, true) | ||
} | ||
|
||
override def afterAll(): Unit = { | ||
super.afterAll() | ||
SQLConf.get.unsetConf(SQLConf.ANSI_ENABLED) | ||
} | ||
|
||
override def cast(v: Any, targetType: DataType, timeZoneId: Option[String] = None): CastBase = { | ||
v match { | ||
case lit: Expression => Cast(lit, targetType, timeZoneId) | ||
case _ => Cast(Literal(v), targetType, timeZoneId) | ||
} | ||
} | ||
|
||
override def setConfigurationHint: String = | ||
s"set ${SQLConf.ANSI_ENABLED.key} as false" | ||
} | ||
|
||
class GlutenAnsiCastSuiteWithAnsiModeOn extends AnsiCastSuiteBase with GlutenTestsTrait { | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
SQLConf.get.setConf(SQLConf.ANSI_ENABLED, true) | ||
} | ||
|
||
override def afterAll(): Unit = { | ||
super.afterAll() | ||
SQLConf.get.unsetConf(SQLConf.ANSI_ENABLED) | ||
} | ||
|
||
override def cast(v: Any, targetType: DataType, timeZoneId: Option[String] = None): CastBase = { | ||
v match { | ||
case lit: Expression => AnsiCast(lit, targetType, timeZoneId) | ||
case _ => AnsiCast(Literal(v), targetType, timeZoneId) | ||
} | ||
} | ||
|
||
override def setConfigurationHint: String = | ||
s"set ${SQLConf.STORE_ASSIGNMENT_POLICY.key} as" + | ||
s" ${SQLConf.StoreAssignmentPolicy.LEGACY.toString}" | ||
} | ||
|
||
class GlutenAnsiCastSuiteWithAnsiModeOff extends AnsiCastSuiteBase with GlutenTestsTrait { | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
SQLConf.get.setConf(SQLConf.ANSI_ENABLED, false) | ||
} | ||
|
||
override def afterAll(): Unit = { | ||
super.afterAll() | ||
SQLConf.get.unsetConf(SQLConf.ANSI_ENABLED) | ||
} | ||
|
||
override def cast(v: Any, targetType: DataType, timeZoneId: Option[String] = None): CastBase = { | ||
v match { | ||
case lit: Expression => AnsiCast(lit, targetType, timeZoneId) | ||
case _ => AnsiCast(Literal(v), targetType, timeZoneId) | ||
} | ||
} | ||
|
||
override def setConfigurationHint: String = | ||
s"set ${SQLConf.STORE_ASSIGNMENT_POLICY.key} as" + | ||
s" ${SQLConf.StoreAssignmentPolicy.LEGACY.toString}" | ||
} | ||
|
||
class GlutenTryCastSuite extends TryCastSuite with GlutenTestsTrait { | ||
|
||
private val specialTs = Seq( | ||
"0001-01-01T00:00:00", // the fist timestamp of Common Era | ||
"1582-10-15T23:59:59", // the cutover date from Julian to Gregorian calendar | ||
"1970-01-01T00:00:00", // the epoch timestamp | ||
"9999-12-31T23:59:59" // the last supported timestamp according to SQL standard | ||
) | ||
|
||
test(GlutenTestConstants.GLUTEN_TEST + | ||
"SPARK-35698: cast timestamp without time zone to string") { | ||
specialTs.foreach { s => | ||
checkEvaluation(cast(LocalDateTime.parse(s), StringType), s.replace("T", " ")) | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...est/scala/org/apache/spark/sql/catalyst/expressions/GlutenArithmeticExpressionSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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.catalyst.expressions | ||
|
||
import org.apache.spark.sql.GlutenTestsTrait | ||
|
||
class GlutenArithmeticExpressionSuite extends ArithmeticExpressionSuite with GlutenTestsTrait { | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
.../test/scala/org/apache/spark/sql/catalyst/expressions/GlutenBitwiseExpressionsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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.catalyst.expressions | ||
|
||
import org.apache.spark.sql.{GlutenTestConstants, GlutenTestsTrait} | ||
|
||
class GlutenBitwiseExpressionsSuite extends BitwiseExpressionsSuite with GlutenTestsTrait { | ||
} |
Oops, something went wrong.