mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 02:44:11 +00:00
Support SELECT DISTINCT
This commit is contained in:
parent
31b6076d05
commit
bbf1805729
3 changed files with 17 additions and 1 deletions
|
@ -50,11 +50,23 @@ fn parse_where_delete_statement() {
|
|||
fn parse_simple_select() {
|
||||
let sql = "SELECT id, fname, lname FROM customer WHERE id = 1 LIMIT 5";
|
||||
let select = verified_only_select(sql);
|
||||
assert_eq!(false, select.distinct);
|
||||
assert_eq!(3, select.projection.len());
|
||||
let select = verified_query(sql);
|
||||
assert_eq!(Some(ASTNode::SQLValue(Value::Long(5))), select.limit);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_select_distinct() {
|
||||
let sql = "SELECT DISTINCT name FROM customer";
|
||||
let select = verified_only_select(sql);
|
||||
assert_eq!(true, select.distinct);
|
||||
assert_eq!(
|
||||
&SQLSelectItem::UnnamedExpression(ASTNode::SQLIdentifier("name".to_string())),
|
||||
only(&select.projection)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_select_wildcard() {
|
||||
let sql = "SELECT * FROM foo";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue