-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bump sqllogictest to 0.9.0 #4547
Conversation
let builder = WriterBuilder::new().has_headers(false).with_delimiter(b' '); | ||
let builder = WriterBuilder::new() | ||
.has_headers(false) | ||
.with_delimiter(b'\t'); | ||
let mut writer = builder.build(&mut bytes); | ||
for batch in batches { | ||
writer.write(&normalize_batch(batch)).unwrap(); | ||
} | ||
} | ||
Ok(String::from_utf8(bytes).unwrap()) | ||
let res = String::from_utf8(bytes).unwrap(); | ||
let rows = res | ||
.lines() | ||
.map(|s| { | ||
s.split("\t") | ||
.map(|s| { | ||
if s.is_empty() { | ||
"NULL".to_string() | ||
} else { | ||
s.to_string() | ||
} | ||
}) | ||
.collect() | ||
}) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using tab-separated CSV to get a row as Vec<String>
is a little bit hacky, but it works... 😄
BTW here's some information about separator in test files risinglightdb/sqllogictest-rs#109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @xxchan -- this is great! The new interface makes a lot of sense. Thank you for the PR!
Given what I see here, I think there may be some better ways to format the output into Vec<Vec<String>>
than re-parsing CSV, by using arrow directly (for example how it is done in https://docs.rs/arrow/28.0.0/arrow/util/pretty/index.html)
I'll give it a think and see if I can find some way to update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a PR that avoids reparsing CSV: #4578
if batches.is_empty() { | ||
return Ok(DBOutput::StatementComplete(0)); | ||
} | ||
// TODO: use the actual types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks -- we can fill this in
let builder = WriterBuilder::new().has_headers(false).with_delimiter(b' '); | ||
let builder = WriterBuilder::new() | ||
.has_headers(false) | ||
.with_delimiter(b'\t'); | ||
let mut writer = builder.build(&mut bytes); | ||
for batch in batches { | ||
writer.write(&normalize_batch(batch)).unwrap(); | ||
} | ||
} | ||
Ok(String::from_utf8(bytes).unwrap()) | ||
let res = String::from_utf8(bytes).unwrap(); | ||
let rows = res | ||
.lines() | ||
.map(|s| { | ||
s.split("\t") | ||
.map(|s| { | ||
if s.is_empty() { | ||
"NULL".to_string() | ||
} else { | ||
s.to_string() | ||
} | ||
}) | ||
.collect() | ||
}) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @xxchan -- this is great! The new interface makes a lot of sense. Thank you for the PR!
Given what I see here, I think there may be some better ways to format the output into Vec<Vec<String>>
than re-parsing CSV, by using arrow directly (for example how it is done in https://docs.rs/arrow/28.0.0/arrow/util/pretty/index.html)
I'll give it a think and see if I can find some way to update it
foo (empty) NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xxchan You are so quickly!
I noticed your new release and prepared to remove the issue about NULL
. Then I found you done!
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xxchan
@@ -45,9 +45,9 @@ query II rowsort | |||
select * from users; | |||
---- | |||
1 2 | |||
11 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For rowsort, runner will only sort actual results now, which means the result in the test cases should be sorted.
FWIW if no one beats me to it I plan to try and polish the conversion to I poked around in the sqllogictest runner, and it looks like you already have some code that will run / update the test files with new results that looks super awesome (and relevant to updating results) |
Yes, it's a cool feature.
Sounds great! |
rebased & resolved conflicts. |
Hope this is the last fix... |
Let's merge! |
Thanks @xxchan and @xudong963 |
NULL
normalization, close Implement null / empty string handling for sqllogictest #4500re #4460
cc @alamb @xudong963