Add keyword to queries for PARALLEL execution
This commit is contained in:
parent
cd545c2edd
commit
ec698e85de
7 changed files with 42 additions and 0 deletions
|
@ -57,6 +57,7 @@ impl<'a> From<&'a SelectStatement> for Iterator<'a> {
|
|||
order: v.order.as_ref(),
|
||||
limit: v.limit.as_ref(),
|
||||
start: v.start.as_ref(),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +67,7 @@ impl<'a> From<&'a CreateStatement> for Iterator<'a> {
|
|||
fn from(v: &'a CreateStatement) -> Self {
|
||||
Iterator {
|
||||
stmt: Statement::from(v),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +77,7 @@ impl<'a> From<&'a UpdateStatement> for Iterator<'a> {
|
|||
fn from(v: &'a UpdateStatement) -> Self {
|
||||
Iterator {
|
||||
stmt: Statement::from(v),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +87,7 @@ impl<'a> From<&'a RelateStatement> for Iterator<'a> {
|
|||
fn from(v: &'a RelateStatement) -> Self {
|
||||
Iterator {
|
||||
stmt: Statement::from(v),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +97,7 @@ impl<'a> From<&'a DeleteStatement> for Iterator<'a> {
|
|||
fn from(v: &'a DeleteStatement) -> Self {
|
||||
Iterator {
|
||||
stmt: Statement::from(v),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +107,7 @@ impl<'a> From<&'a InsertStatement> for Iterator<'a> {
|
|||
fn from(v: &'a InsertStatement) -> Self {
|
||||
Iterator {
|
||||
stmt: Statement::from(v),
|
||||
parallel: v.parallel,
|
||||
..Iterator::default()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ pub struct CreateStatement {
|
|||
pub data: Option<Data>,
|
||||
pub output: Option<Output>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl CreateStatement {
|
||||
|
@ -71,6 +72,9 @@ impl fmt::Display for CreateStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +86,7 @@ pub fn create(i: &str) -> IResult<&str, CreateStatement> {
|
|||
let (i, data) = opt(preceded(shouldbespace, data))(i)?;
|
||||
let (i, output) = opt(preceded(shouldbespace, output))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
CreateStatement {
|
||||
|
@ -89,6 +94,7 @@ pub fn create(i: &str) -> IResult<&str, CreateStatement> {
|
|||
data,
|
||||
output,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ pub struct DeleteStatement {
|
|||
pub cond: Option<Cond>,
|
||||
pub output: Option<Output>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl DeleteStatement {
|
||||
|
@ -72,6 +73,9 @@ impl fmt::Display for DeleteStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +88,7 @@ pub fn delete(i: &str) -> IResult<&str, DeleteStatement> {
|
|||
let (i, cond) = opt(preceded(shouldbespace, cond))(i)?;
|
||||
let (i, output) = opt(preceded(shouldbespace, output))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
DeleteStatement {
|
||||
|
@ -91,6 +96,7 @@ pub fn delete(i: &str) -> IResult<&str, DeleteStatement> {
|
|||
cond,
|
||||
output,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ pub struct InsertStatement {
|
|||
pub update: Option<Data>,
|
||||
pub output: Option<Output>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl InsertStatement {
|
||||
|
@ -80,6 +81,9 @@ impl fmt::Display for InsertStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +97,7 @@ pub fn insert(i: &str) -> IResult<&str, InsertStatement> {
|
|||
let (i, update) = opt(preceded(shouldbespace, update))(i)?;
|
||||
let (i, output) = opt(preceded(shouldbespace, output))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
InsertStatement {
|
||||
|
@ -102,6 +107,7 @@ pub fn insert(i: &str) -> IResult<&str, InsertStatement> {
|
|||
update,
|
||||
output,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ pub struct RelateStatement {
|
|||
pub data: Option<Data>,
|
||||
pub output: Option<Output>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl RelateStatement {
|
||||
|
@ -81,6 +82,9 @@ impl fmt::Display for RelateStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +97,7 @@ pub fn relate(i: &str) -> IResult<&str, RelateStatement> {
|
|||
let (i, data) = opt(preceded(shouldbespace, data))(i)?;
|
||||
let (i, output) = opt(preceded(shouldbespace, output))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
RelateStatement {
|
||||
|
@ -103,6 +108,7 @@ pub fn relate(i: &str) -> IResult<&str, RelateStatement> {
|
|||
data,
|
||||
output,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ pub struct SelectStatement {
|
|||
pub fetch: Option<Fetchs>,
|
||||
pub version: Option<Version>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl SelectStatement {
|
||||
|
@ -114,6 +115,9 @@ impl fmt::Display for SelectStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +139,7 @@ pub fn select(i: &str) -> IResult<&str, SelectStatement> {
|
|||
let (i, fetch) = opt(preceded(shouldbespace, fetch))(i)?;
|
||||
let (i, version) = opt(preceded(shouldbespace, version))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
SelectStatement {
|
||||
|
@ -149,6 +154,7 @@ pub fn select(i: &str) -> IResult<&str, SelectStatement> {
|
|||
fetch,
|
||||
version,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ pub struct UpdateStatement {
|
|||
pub cond: Option<Cond>,
|
||||
pub output: Option<Output>,
|
||||
pub timeout: Option<Timeout>,
|
||||
pub parallel: bool,
|
||||
}
|
||||
|
||||
impl UpdateStatement {
|
||||
|
@ -76,6 +77,9 @@ impl fmt::Display for UpdateStatement {
|
|||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
}
|
||||
if self.parallel {
|
||||
write!(f, " PARALLEL")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +92,7 @@ pub fn update(i: &str) -> IResult<&str, UpdateStatement> {
|
|||
let (i, cond) = opt(preceded(shouldbespace, cond))(i)?;
|
||||
let (i, output) = opt(preceded(shouldbespace, output))(i)?;
|
||||
let (i, timeout) = opt(preceded(shouldbespace, timeout))(i)?;
|
||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||
Ok((
|
||||
i,
|
||||
UpdateStatement {
|
||||
|
@ -96,6 +101,7 @@ pub fn update(i: &str) -> IResult<&str, UpdateStatement> {
|
|||
cond,
|
||||
output,
|
||||
timeout,
|
||||
parallel: parallel.is_some(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue