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 @@ -84,8 +84,13 @@ public FunctionSignature computeSignature(FunctionSignature signature) {

@Override
public void checkLegalityAfterRewrite() {
if (arity() == 1 && !child(0).isLiteral()) {
throw new AnalysisException("UTC_TIME scale argument must be a constant literal.");
if (arity() == 1) {
if (child(0).isNullLiteral()) {
throw new AnalysisException("UTC_TIME argument cannot be NULL.");
}
if (!child(0).isLiteral()) {
throw new AnalysisException("UTC_TIME scale argument must be a constant literal.");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ public FunctionSignature computeSignature(FunctionSignature signature) {

@Override
public void checkLegalityAfterRewrite() {
if (arity() == 1 && !child(0).isLiteral()) {
throw new AnalysisException("UTC_TIMESTAMP scale argument must be a constant literal.");
if (arity() == 1) {
if (child(0).isNullLiteral()) {
throw new AnalysisException("UTC_TIMESTAMP argument cannot be NULL.");
}
if (!child(0).isLiteral()) {
throw new AnalysisException("UTC_TIMESTAMP scale argument must be a constant literal.");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,12 @@ suite("test_date_function") {
sql """ select utc_timestamp(7) """
exception "scale must be between 0 and 6"
}
test {
sql """ SELECT UTC_TIMESTAMP(NULL); """
exception "UTC_TIMESTAMP argument cannot be NULL."
}

// UTC_TIME
def utc_time_str = sql """ select utc_time(),utc_time() + 1 """
assertTrue(utc_time_str[0].size() == 2)
utc_time_str = sql """ select utc_time(6), utc_time(6) + 1 """
Expand All @@ -515,6 +520,10 @@ suite("test_date_function") {
sql """ select utc_time(7) """
exception "scale must be between 0 and 6"
}
test {
sql """ SELECT UTC_TIME(NULL); """
exception "UTC_TIME argument cannot be NULL."
}

def utc_date_str = sql """ select utc_date(),utc_date() + 1 """
assertTrue(utc_date_str[0].size() == 2)
Expand Down
Loading