Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,24 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
TestUtils.compareAnswers(result, expectedResult)
}

test("test 'function space'") {
val df = spark.sql(
"""
| select
| space(3),
| space(0),
| space(NULL),
| space(3/3.00f)
| from lineitem limit 1
|""".stripMargin
)
val result = df.collect()
assert(result(0).getString(0).equals(" "))
assert(result(0).getString(1).equals(""))
assert(result(0).getString(2) == null)
assert(result(0).getString(3).equals(" "))
}

test("test 'ISSUE https://github.com/Kyligence/ClickHouse/issues/225'") {
val df = spark.sql(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ object ExpressionMappings {
final val CONCAT_WS = "concat_ws"
final val REPEAT = "repeat"
final val TRANSLATE = "translate"
final val SPACE = "space"

// SparkSQL Math functions
final val ABS = "abs"
Expand Down Expand Up @@ -281,6 +282,7 @@ object ExpressionMappings {
Sig[ConcatWs](CONCAT_WS),
Sig[StringRepeat](REPEAT),
Sig[StringTranslate](TRANSLATE),
Sig[StringSpace](SPACE),
// SparkSQL Math functions
Sig[Abs](ABS),
Sig[Ceil](CEIL),
Expand Down