Skip to content

Commit

Permalink
[fix](planner) fix now function param type error (#23446)
Browse files Browse the repository at this point in the history
  • Loading branch information
TangSiyang2001 authored Aug 24, 2023
1 parent 71071ba commit 441a9ff
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ protected void finalizeParamsForLoad(ParamCreateContext context,
if (column.getDefaultValue() != null) {
if (column.getDefaultValueExprDef() != null) {
expr = column.getDefaultValueExpr();
expr.analyze(analyzer);
} else {
expr = new StringLiteral(destSlotDesc.getColumn().getDefaultValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@
-- !select_sql --
2

-- !select --
2

-- !select --
2

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1,2010-11-30 23:59:59.281000
2,2011-11-30 23:59:59.281000
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"id":1,"name":"aa"}
{"id":2,"name":"bb"}
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,69 @@ suite("test_current_timestamp") {
"""
exception "errCode = 2, detailMessage = Internal Error, maybe syntax error or this is a bug: column's default value current_timestamp precision must be between 0 and 6"
}
}

// user case
def tableName6 = "test_current_timestamp_4"
sql """ DROP TABLE IF EXISTS ${tableName6} """
sql """
CREATE TABLE IF NOT EXISTS ${tableName6}
(
`id` int,
`date_time` datetime(3),
`data_entry_time` datetime(3) NULL DEFAULT CURRENT_TIMESTAMP(3)
) DUPLICATE KEY(`id`)
DISTRIBUTED BY HASH(id)
PROPERTIES
(
"replication_num" = "1"
);
"""

streamLoad {
table "${tableName6}"
set 'columns', 'id,date_time'
set 'format', 'csv'
set 'column_separator', ','

file "test_current_timestamp_dft.csv"

time 10000
}

sql "sync"
qt_select """ select count(*) from ${tableName6} """

def tableName7 = "test_current_timestamp_5"
sql """ DROP TABLE IF EXISTS ${tableName7} """
sql """
CREATE TABLE ${tableName7} (
id int,
`name` varchar(50) NULL,
input_time datetime default current_timestamp
) ENGINE=OLAP
DUPLICATE KEY(`id`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`id`) BUCKETS 10
PROPERTIES (
"in_memory" = "false",
"storage_format" = "V2",
"replication_num" = "1"
);
"""

streamLoad {
table "${tableName7}"
set 'columns', 'id,name'
set 'format', 'json'
set 'read_json_by_line', 'true'
set 'strip_outer_array', 'false'

file "test_current_timestamp_dft.json"

time 10000
}

sql "sync"
qt_select """ select count(*) from ${tableName7} """

}

0 comments on commit 441a9ff

Please sign in to comment.