Skip to content

Commit

Permalink
support function format_string
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyang-li committed Aug 7, 2024
1 parent 90055f4 commit 6e9c203
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,19 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
|""".stripMargin
runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer])
}

test("test function format_string") {
val sql = """
| SELECT
| format_string(
| 'hello world %d %d %s %f',
| id,
| id,
| CAST(id AS STRING),
| CAST(id AS float)
| )
|FROM range(10)
|""".stripMargin
runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object ExpressionMappings {
Sig[Levenshtein](LEVENSHTEIN),
Sig[UnBase64](UNBASE64),
Sig[Base64](BASE64),
Sig[FormatString](FORMAT),
Sig[FormatString](FORMAT_STRING),

// URL functions
Sig[ParseUrl](PARSE_URL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ object ExpressionNames {
final val UNBASE64 = "unbase64"
final val BASE64 = "base64"
final val MASK = "mask"
final val FORMAT = "format"
final val FORMAT_STRING = "format_string"

// URL functions
final val PARSE_URL = "parse_url"
Expand Down

0 comments on commit 6e9c203

Please sign in to comment.