Skip to content

Commit

Permalink
Merge pull request #6611 from ariesdevil/fix-data-trunc
Browse files Browse the repository at this point in the history
fix: remove unsupported IntervalType in DateTrunc
  • Loading branch information
BohuTANG authored Jul 14, 2022
2 parents b6b2fb0 + 8ce0663 commit f724f1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/ast/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
| #cast : "`CAST(... AS ...)`"
| #date_add: "`DATE_ADD(..., ..., (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW))`"
| #date_sub: "`DATE_SUB(..., ..., (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW))`"
| #date_trunc: "`DATE_TRUNC((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW), ...)`"
| #date_trunc: "`DATE_TRUNC((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND), ...)`"
| #interval: "`INTERVAL ... (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW)`"
| #pg_cast : "`::<type_name>`"
| #extract : "`EXTRACT((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND) FROM ...)`"
Expand Down
1 change: 0 additions & 1 deletion common/exception/src/exception_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ build_exceptions! {
IllegalUDFFormat(2601),
UnknownUDF(2602),
UdfAlreadyExists(2603),
UnsupportedIntervalKind(2604),

// Database error codes.
UnknownDatabaseEngine(2701),
Expand Down
2 changes: 1 addition & 1 deletion query/src/sql/planner/semantic/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ impl<'a> TypeChecker<'a> {
)
.await
}
_ => Err(ErrorCode::UnsupportedIntervalKind("Only these interval types are currently supported: year, month, day, hour, minute, second")),
_ => Err(ErrorCode::SemanticError(span.display_error("Only these interval types are currently supported: [year, month, day, hour, minute, second]".to_string()))),
}
}

Expand Down

1 comment on commit f724f1f

@vercel
Copy link

@vercel vercel bot commented on f724f1f Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-databend.vercel.app
databend-git-main-databend.vercel.app
databend.vercel.app
databend.rs

Please sign in to comment.