mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
SET with a list of comma separated assignments (#1757)
This commit is contained in:
parent
3392623b00
commit
85f855150f
12 changed files with 564 additions and 375 deletions
|
@ -22,9 +22,8 @@
|
|||
|
||||
use sqlparser::ast::{
|
||||
ClusteredBy, CommentDef, CreateFunction, CreateFunctionBody, CreateFunctionUsing, CreateTable,
|
||||
Expr, Function, FunctionArgumentList, FunctionArguments, Ident, ObjectName,
|
||||
OneOrManyWithParens, OrderByExpr, OrderByOptions, SelectItem, Statement, TableFactor,
|
||||
UnaryOperator, Use, Value,
|
||||
Expr, Function, FunctionArgumentList, FunctionArguments, Ident, ObjectName, OrderByExpr,
|
||||
OrderByOptions, SelectItem, Set, Statement, TableFactor, UnaryOperator, Use, Value,
|
||||
};
|
||||
use sqlparser::dialect::{GenericDialect, HiveDialect, MsSqlDialect};
|
||||
use sqlparser::parser::ParserError;
|
||||
|
@ -92,7 +91,7 @@ fn parse_msck() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn parse_set() {
|
||||
fn parse_set_hivevar() {
|
||||
let set = "SET HIVEVAR:name = a, b, c_d";
|
||||
hive().verified_stmt(set);
|
||||
}
|
||||
|
@ -369,20 +368,20 @@ fn from_cte() {
|
|||
fn set_statement_with_minus() {
|
||||
assert_eq!(
|
||||
hive().verified_stmt("SET hive.tez.java.opts = -Xmx4g"),
|
||||
Statement::SetVariable {
|
||||
Statement::Set(Set::SingleAssignment {
|
||||
local: false,
|
||||
hivevar: false,
|
||||
variables: OneOrManyWithParens::One(ObjectName::from(vec![
|
||||
variable: ObjectName::from(vec![
|
||||
Ident::new("hive"),
|
||||
Ident::new("tez"),
|
||||
Ident::new("java"),
|
||||
Ident::new("opts")
|
||||
])),
|
||||
value: vec![Expr::UnaryOp {
|
||||
]),
|
||||
values: vec![Expr::UnaryOp {
|
||||
op: UnaryOperator::Minus,
|
||||
expr: Box::new(Expr::Identifier(Ident::new("Xmx4g")))
|
||||
}],
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue