Support the string concat operator (#178)

The selected precedence is based on BigQuery documentation, where it is equal to `*` and `/`:

https://cloud.google.com/bigquery/docs/reference/standard-sql/operators
This commit is contained in:
Daniël Heres 2020-06-02 20:24:30 +02:00 committed by GitHub
parent 5f3c1bda01
commit 00dc490f72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 1 deletions

View file

@ -665,6 +665,21 @@ fn parse_in_subquery() {
);
}
#[test]
fn parse_string_agg() {
let sql = "SELECT a || b";
let select = verified_only_select(sql);
assert_eq!(
SelectItem::UnnamedExpr(Expr::BinaryOp {
left: Box::new(Expr::Identifier(Ident::new("a"))),
op: BinaryOperator::StringConcat,
right: Box::new(Expr::Identifier(Ident::new("b"))),
}),
select.projection[0]
);
}
#[test]
fn parse_between() {
fn chk(negated: bool) {