Skip to content

Commit

Permalink
Translate NUMERIC to Trino
Browse files Browse the repository at this point in the history
  • Loading branch information
emk committed Oct 30, 2023
1 parent 359555f commit aa634b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,10 +1375,8 @@ impl Emit for DataType {
DataType::Float64(token) => token.ident.token.with_str("DOUBLE").emit(t, f),
DataType::Geography(token) => token.ident.token.with_str("JSON").emit(t, f),
DataType::Int64(token) => token.ident.token.with_str("BIGINT").emit(t, f),
// TODO: This cannot be done safely in Trino, because you always
// need to specify the precision and where to put the decimal
// place.
DataType::Numeric(token) => token.ident.token.with_str("DECIMAL(?,?)").emit(t, f),
// BigQuery's precision is fixed, and we can't change it.
DataType::Numeric(token) => token.ident.token.with_str("DECIMAL(38,9)").emit(t, f),
DataType::String(token) => token.ident.token.with_str("VARCHAR").emit(t, f),
DataType::Time(token) => token.emit(t, f),
DataType::Timestamp(token) => token
Expand Down
2 changes: 0 additions & 2 deletions tests/sql/data_types/numeric.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-- pending: trino BigQuery NUMERIC may lose data when converted to DECIMAL(n,m).

-- Test type parsing without creating any actual rows. This allows us to
-- verify as many types as possible without needing to worry about reading
-- data from the database.
Expand Down

0 comments on commit aa634b7

Please sign in to comment.