Skip to content
Closed
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
8 changes: 7 additions & 1 deletion src/sqllogictest/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ where
}

fn format_datum(d: Slt, typ: &Type, mode: Mode, col: usize) -> String {
match (typ, d.0) {
match match (typ, d.0) {
(Type::Bool, Value::Bool(b)) => b.to_string(),

(Type::Integer, Value::Int4(i)) => i.to_string(),
Expand Down Expand Up @@ -482,6 +482,12 @@ fn format_datum(d: Slt, typ: &Type, mode: Mode, col: usize) -> String {
d, typ, col,
),
}
.as_str()
{
"-0" => "0".to_string(), // convert negative zero to zero
"-0.000" => "0.000".to_string(),
v => v.to_string(),
}
}

fn format_row(row: &Row, types: &[Type], mode: Mode, sort: &Sort) -> Vec<String> {
Expand Down
4 changes: 2 additions & 2 deletions test/sqllogictest/float.slt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
mode cockroach

query T
SELECT '-0'::float::text
SELECT '-0'::float::text = '-0'::text
----
-0
true

query TTTTT
SELECT 'Inf'::float::text, 'Infinity'::float::text, 'inFinIty'::float::text, '+inf'::float::text, '+infinity'::float::text
Expand Down