mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Enable custom dialects to support MATCH() AGAINST()
(#1719)
This commit is contained in:
parent
46cfcfe8f7
commit
322209a9f3
4 changed files with 14 additions and 1 deletions
|
@ -147,4 +147,8 @@ impl Dialect for GenericDialect {
|
|||
fn supports_array_typedef_size(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn supports_match_against(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,6 +479,11 @@ pub trait Dialect: Debug + Any {
|
|||
false
|
||||
}
|
||||
|
||||
/// Does the dialect support the `MATCH() AGAINST()` syntax?
|
||||
fn supports_match_against(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Dialect-specific infix parser override
|
||||
///
|
||||
/// This method is called to parse the next infix expression.
|
||||
|
|
|
@ -129,6 +129,10 @@ impl Dialect for MySqlDialect {
|
|||
fn requires_single_line_comment_whitespace(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn supports_match_against(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// `LOCK TABLES`
|
||||
|
|
|
@ -1198,7 +1198,7 @@ impl<'a> Parser<'a> {
|
|||
})))
|
||||
}
|
||||
Keyword::NOT => Ok(Some(self.parse_not()?)),
|
||||
Keyword::MATCH if dialect_of!(self is MySqlDialect | GenericDialect) => {
|
||||
Keyword::MATCH if self.dialect.supports_match_against() => {
|
||||
Ok(Some(self.parse_match_against()?))
|
||||
}
|
||||
Keyword::STRUCT if self.dialect.supports_struct_literal() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue