Skip to content

Commit

Permalink
Add hugeint in appendSqlLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Mar 28, 2024
1 parent 0c86a0a commit 1695306
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions velox/expression/ConstantExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void appendSqlLiteral(
case TypeKind::TINYINT:
case TypeKind::SMALLINT:
case TypeKind::BIGINT:
case TypeKind::HUGEINT:
case TypeKind::TIMESTAMP:
case TypeKind::REAL:
case TypeKind::DOUBLE:
Expand Down
11 changes: 11 additions & 0 deletions velox/expression/tests/ExprTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,17 @@ TEST_P(ParameterizedExprTest, constantToSql) {
ASSERT_EQ(toSql(18'506, DATE()), "'2020-09-01'::DATE");
ASSERT_EQ(toSql(variant::null(TypeKind::INTEGER), DATE()), "NULL::DATE");

ASSERT_EQ(toSql(2134456LL, DECIMAL(18, 2)), "'21344.56'::DECIMAL(18, 2)");
ASSERT_EQ(
toSql(variant::null(TypeKind::BIGINT), DECIMAL(18, 2)),
"NULL::DECIMAL(18, 2)");
ASSERT_EQ(
toSql((int128_t)1'000'000'000'000'000'000, DECIMAL(38, 2)),
"'10000000000000000.00'::DECIMAL(38, 2)");
ASSERT_EQ(
toSql(variant::null(TypeKind::HUGEINT), DECIMAL(38, 2)),
"NULL::DECIMAL(38, 2)");

ASSERT_EQ(
toSql(Timestamp(123'456, 123'000)),
"'1970-01-02T10:17:36.000123000'::TIMESTAMP");
Expand Down

0 comments on commit 1695306

Please sign in to comment.