-
Notifications
You must be signed in to change notification settings - Fork 52
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
support extended query mode #65
Conversation
src/main.rs
Outdated
/// extended query mode in postgresql(only valid in postgresql) | ||
#[clap(long, action)] | ||
extend: bool, |
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.
I think we can add a different engine postgresql-extended
instead of adding the option
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.
do you mean create a different bin using different engine, and we can use different bin to run test in different mode. such as:
sqllogictest 'e2e_test/*.slt' (simeple query)
postgresql-extended 'e2e_test/*.slt' (extended query)
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.
I mean using the engine
CLI argument.
sqllogictest a.slt --engine postgresql
sqllogictest a.slt --engine mysql
sqllogictest a.slt --engine postgresql-extended
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.
cool!
Signed-off-by: Zejiong Dong <[email protected]>
Signed-off-by: Zejiong Dong <[email protected]>
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.
Currenty implementation is OK but IMO this might be slightly better:
fn main()
let engine: Box<dyn AsyncDB> = match opt.engine {
"postgres" => Postgres { ... },
"postgres-extended" => PostgresExtended { ... },
};
impl sqllogictest::AsyncDB for Postgres {}
impl sqllogictest::AsyncDB for PostgresExtended {}
In this way, the engine dispath is more clear, and we don't need the huge if
in Postgres
.
But since current sqllogictest CLI is a little big coupled with Postgres
, maybe we can also refactor it later.
Yes..I try this before but CLI has coupled with 'Postgres' such as
So I'm agree with refactoring it later. |
Sorry, I find someplace need to modify... I test in as many original e2e tests as possible first. |
* add single_process to support NULL values. * support '(empty)' in VARCHAR. * support infinity in f32 and f64. * modify output of bool type. Signed-off-by: Zejiong Dong <[email protected]>
Now the postgresql-extended can support most of e2e_test!
|
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.
Better to refine this PR. Doesn't look neat and might make maintenance harder :) But we can merge this first and fix things later, as main.rs
is already complex enough. cc @xxchan merge?
Cargo.toml
Outdated
@@ -16,7 +16,7 @@ bin = ["anyhow", "chrono", "console", "tokio-postgres", "env_logger", "clap", "t | |||
[dependencies] | |||
anyhow = { version = "1", optional = true } | |||
async-trait = "0.1" | |||
chrono = { version = "0.4", optional = true } | |||
chrono = { version = "0.4",optional = true } |
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.
missing space?
Cargo.toml
Outdated
@@ -27,7 +27,9 @@ glob = "0.3" | |||
humantime = "2" | |||
itertools = "0.10" | |||
log = "0.4" | |||
postgres-types = { version = "0.2.3", features = ["derive","with-chrono-0_4"] } |
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.
please make this consistent with other lines :) Also I think it would be better to only enable Postgres-types in bin target?
Cargo.toml
Outdated
quick-junit = { version = "0.2", optional = true } | ||
rust_decimal = { version = "1.7.0", features = [ "tokio-pg" ] } |
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.
ditto, only enable in bin target
tokio_postgres::SimpleQueryMessage::Row(row) => { | ||
for i in 0..row.len() { | ||
if i != 0 { | ||
if !self.extend { |
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.
I'd prefer making it a new engine instead of using self.extend
to change query mode.
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.
I'd prefer making it a new engine instead of using
self.extend
to change query mode.
Yes. We can make it when refactor it.
I can refactor it later 🤤 |
My plan is like to have a separate crate for bin target of sqllogictest (e.g. sqllogictest-bin). Then I believe things could be a lot more neat. |
Anyway, I'd merge this first and not bump version for now. |
... after @ZENOTME has resolved some small issues in |
Signed-off-by: Zejiong Dong <[email protected]>
Already resolved it. |
Support extended query mode.
It's compatible with past versions, extended query mode only takes effect when using the flag "--extend"
for now, this pr has the following limit:
Hence we can run all original e2e test now.