Skip to content

Commit

Permalink
[BugFix] fix the partition column value cast issue when inserting sta…
Browse files Browse the repository at this point in the history
…tic key partition (StarRocks#22630)

Signed-off-by: stephen <[email protected]>
  • Loading branch information
stephen-shelby authored and abc982627271 committed Jun 5, 2023
1 parent 715b982 commit c695545
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public static void analyze(InsertStmt insertStmt, ConnectContext session) {
LiteralExpr literalExpr = (LiteralExpr) partitionValue;
Column column = icebergTable.getColumn(actualName);
try {
literalExpr.castTo(column.getType());
Expr expr = LiteralExpr.create(literalExpr.getStringValue(), column.getType());
insertStmt.getTargetPartitionNames().getPartitionColValues().set(i, expr);
} catch (AnalysisException e) {
throw new SemanticException(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void testPartitionedIcebergTable(@Mocked IcebergTable icebergTable) {
"Expected: p1, but actual: p2");

analyzeFail("insert into iceberg_catalog.db.tbl partition(p1=1, p2=\"aaffsssaa\") values (1)",
"annot cast '1' from TINYINT to ARRAY<DATE>");
"Type[ARRAY<date>] not supported.");

new Expectations() {
{
Expand Down

0 comments on commit c695545

Please sign in to comment.