Skip to content
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

Merged
merged 5 commits into from
Dec 9, 2022
Merged

bump sqllogictest to 0.9.0 #4547

merged 5 commits into from
Dec 9, 2022

Conversation

xxchan
Copy link
Contributor

@xxchan xxchan commented Dec 7, 2022

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Dec 7, 2022
Comment on lines 178 to 207
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();
Copy link
Contributor Author

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

Copy link
Contributor

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

cc @mvanschellebeeck

Copy link
Contributor

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
Copy link
Contributor

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

Comment on lines 178 to 207
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();
Copy link
Contributor

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

cc @mvanschellebeeck

foo (empty) NULL
Copy link
Member

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

Copy link
Member

@xudong963 xudong963 left a 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
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

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.

@alamb
Copy link
Contributor

alamb commented Dec 9, 2022

FWIW if no one beats me to it I plan to try and polish the conversion to Vec<Vec<String>> this weekend, but I would be happy to have this one merged in first. I suspect it has been accumulating both actual conflicts (as github says) as well as logical conflicts with newly added SLT files.

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)

https://github.com/risinglightdb/sqllogictest-rs/blob/d753e4c77fbf00cdaab69477df2e9c3dba3f5fcc/sqllogictest-bin/src/lib.rs#L505

@xudong963
Copy link
Member

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)

https://github.com/risinglightdb/sqllogictest-rs/blob/d753e4c77fbf00cdaab69477df2e9c3dba3f5fcc/sqllogictest-bin/src/lib.rs#L505

Yes, it's a cool feature.

but I would be happy to have this one merged in first

Sounds great!

@xxchan
Copy link
Contributor Author

xxchan commented Dec 9, 2022

rebased & resolved conflicts.

@xxchan
Copy link
Contributor Author

xxchan commented Dec 9, 2022

weird 🤨

image

@xudong963
Copy link
Member

#4565 @xxchan

Need to rebase master

@xxchan
Copy link
Contributor Author

xxchan commented Dec 9, 2022

Hope this is the last fix...

@xudong963
Copy link
Member

Let's merge!

@xudong963 xudong963 merged commit 8365d96 into apache:master Dec 9, 2022
@xxchan xxchan deleted the xxchan/naval-donkey branch December 9, 2022 14:45
@alamb
Copy link
Contributor

alamb commented Dec 9, 2022

Thanks @xxchan and @xudong963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement null / empty string handling for sqllogictest
3 participants