Skip to content

Commit f58f9bb

Browse files
committed
Remove redundant code now that syntax roundtrip is more accurate
1 parent 464fca3 commit f58f9bb

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

src/dialect/hive.rs

-5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,4 @@ impl Dialect for HiveDialect {
6666
fn supports_table_sample_before_alias(&self) -> bool {
6767
true
6868
}
69-
70-
/// See Hive <https://cwiki.apache.org/confluence/display/hive/languagemanual+sampling>
71-
fn supports_implicit_table_sample_method(&self) -> bool {
72-
true
73-
}
7469
}

src/dialect/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -718,16 +718,6 @@ pub trait Dialect: Debug + Any {
718718
fn supports_table_sample_before_alias(&self) -> bool {
719719
false
720720
}
721-
722-
/// Returns true if this dialect support not specifying a table sample method. For example:
723-
///
724-
/// Implicit table sample method: `SELECT * FROM tbl TABLESAMPLE (10)`
725-
/// Explicit table sample method: `SELECT * FROM tbl TABLESAMPLE BERNOULLI (10)`
726-
///
727-
/// <https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#sample-clause>
728-
fn supports_implicit_table_sample_method(&self) -> bool {
729-
false
730-
}
731721
}
732722

733723
/// This represents the operators for which precedence must be defined

tests/sqlparser_common.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -12386,16 +12386,13 @@ fn parse_create_table_with_enum_types() {
1238612386

1238712387
#[test]
1238812388
fn test_table_sample() {
12389-
let dialects = all_dialects_where(|d| !d.supports_implicit_table_sample_method());
12390-
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE BERNOULLI (50)");
12391-
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50)");
12392-
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50) REPEATABLE (10)");
12393-
12394-
// The only dialect that supports implicit tablesample is Hive and it requires aliase after the table sample
12395-
let dialects = all_dialects_where(|d| {
12396-
d.supports_implicit_table_sample_method() && d.supports_table_sample_before_alias()
12397-
});
12389+
let dialects = all_dialects_where(|d| d.supports_table_sample_before_alias());
1239812390
dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50) AS t");
1239912391
dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50 ROWS) AS t");
1240012392
dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50 PERCENT) AS t");
12393+
12394+
let dialects = all_dialects_where(|d| !d.supports_table_sample_before_alias());
12395+
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE BERNOULLI (50)");
12396+
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50)");
12397+
dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50) REPEATABLE (10)");
1240112398
}

0 commit comments

Comments
 (0)