diff --git a/src/dialect/hive.rs b/src/dialect/hive.rs index 303843984..80f44cf7c 100644 --- a/src/dialect/hive.rs +++ b/src/dialect/hive.rs @@ -66,9 +66,4 @@ impl Dialect for HiveDialect { fn supports_table_sample_before_alias(&self) -> bool { true } - - /// See Hive - fn supports_implicit_table_sample_method(&self) -> bool { - true - } } diff --git a/src/dialect/mod.rs b/src/dialect/mod.rs index 18417ca41..8cce6a353 100644 --- a/src/dialect/mod.rs +++ b/src/dialect/mod.rs @@ -718,16 +718,6 @@ pub trait Dialect: Debug + Any { fn supports_table_sample_before_alias(&self) -> bool { false } - - /// Returns true if this dialect support not specifying a table sample method. For example: - /// - /// Implicit table sample method: `SELECT * FROM tbl TABLESAMPLE (10)` - /// Explicit table sample method: `SELECT * FROM tbl TABLESAMPLE BERNOULLI (10)` - /// - /// - fn supports_implicit_table_sample_method(&self) -> bool { - false - } } /// This represents the operators for which precedence must be defined diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs index 90e36e8de..0f1813c2f 100644 --- a/tests/sqlparser_common.rs +++ b/tests/sqlparser_common.rs @@ -12386,16 +12386,13 @@ fn parse_create_table_with_enum_types() { #[test] fn test_table_sample() { - let dialects = all_dialects_where(|d| !d.supports_implicit_table_sample_method()); - dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE BERNOULLI (50)"); - dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50)"); - dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50) REPEATABLE (10)"); - - // The only dialect that supports implicit tablesample is Hive and it requires aliase after the table sample - let dialects = all_dialects_where(|d| { - d.supports_implicit_table_sample_method() && d.supports_table_sample_before_alias() - }); + let dialects = all_dialects_where(|d| d.supports_table_sample_before_alias()); dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50) AS t"); dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50 ROWS) AS t"); dialects.verified_stmt("SELECT * FROM tbl TABLESAMPLE (50 PERCENT) AS t"); + + let dialects = all_dialects_where(|d| !d.supports_table_sample_before_alias()); + dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE BERNOULLI (50)"); + dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50)"); + dialects.verified_stmt("SELECT * FROM tbl AS t TABLESAMPLE SYSTEM (50) REPEATABLE (10)"); }