PokIsemaine commented on code in PR #15183:
URL: https://github.com/apache/datafusion/pull/15183#discussion_r2005632036
##########
datafusion/sql/src/planner.rs:
##########
@@ -560,11 +558,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
SQLDataType::SmallInt(_) | SQLDataType::Int2(_) =>
Ok(DataType::Int16),
SQLDataType::Int(_) | SQLDataType::Integer(_) |
SQLDataType::Int4(_) => Ok(DataType::Int32),
SQLDataType::BigInt(_) | SQLDataType::Int8(_) =>
Ok(DataType::Int64),
- SQLDataType::UnsignedTinyInt(_) => Ok(DataType::UInt8),
- SQLDataType::UnsignedSmallInt(_) | SQLDataType::UnsignedInt2(_) =>
Ok(DataType::UInt16),
- SQLDataType::UnsignedInt(_) | SQLDataType::UnsignedInteger(_) |
SQLDataType::UnsignedInt4(_) => {
- Ok(DataType::UInt32)
- }
+ SQLDataType::TinyIntUnsigned(_) => Ok(DataType::UInt8),
+ SQLDataType::SmallIntUnsigned(_) | SQLDataType::Int2Unsigned(_) =>
Ok(DataType::UInt16),
+ SQLDataType::IntUnsigned(_) | SQLDataType::IntegerUnsigned(_) |
SQLDataType::Int4Unsigned(_) => {
+ Ok(DataType::UInt32)
Review Comment:
I'm not very familiar with Rust's ecosystem tools yet, and I encountered an
internal error when trying to run this command. This issue prevented `rustfmt`
from automatically fixing the formatting:
```rust
root@4cdc7901fce5:/workspaces/datafusion# rustfmt --config
error_on_line_overflow=true,error_on_unformatted=true
datafusion/sql/src/planner.rs
error[internal]: not formatted because a comment would be lost
--> /workspaces/datafusion/datafusion/sql/src/planner.rs:558
|
558 | match sql_type {
|
= note: set `error_on_unformatted = false` to suppress the warning
against comments or string literals
warning: rustfmt has failed to format. See previous 1 errors
```
I tried setting `error_on_unformatted=false` to force formatting.
The issue is caused by this specific comment.
```rust
| SQLDataType::CharLargeObject(_)
// Unsupported precision
| SQLDataType::Timestamp(_, _)
// Precision is not supported
| SQLDataType::Time(Some(_), _)
| SQLDataType::Dec(_)
| SQLDataType::BigNumeric(_)
| SQLDataType::BigDecimal(_)
| SQLDataType::Clob(_)
| SQLDataType::Bytes(_)
| SQLDataType::Int64
| SQLDataType::Float64
| SQLDataType::JSONB
| SQLDataType::Unspecified
// Clickhouse datatypes
| SQLDataType::Int16
| SQLDataType::Int32
```
I found similar issues in the `rustfmt` repository:
đź”— [[rustfmt issue
#6491](https://github.com/rust-lang/rustfmt/issues/6491)](https://github.com/rust-lang/rustfmt/issues/6491)
I'm not sure whether we should adjust the comment formatting—do you have any
suggestions?
Additionally, we might consider adding this check to **GitHub Actions** and
documenting it in the **Contributor Guide**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]