Skip to content

Commit 19079e9

Browse files
committed
Support single line comments starting with '#' for Hive
1 parent c808c4e commit 19079e9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/tokenizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use serde::{Deserialize, Serialize};
4040
#[cfg(feature = "visitor")]
4141
use sqlparser_derive::{Visit, VisitMut};
4242

43-
use crate::ast::DollarQuotedString;
43+
use crate::{ast::DollarQuotedString, dialect::HiveDialect};
4444
use crate::dialect::Dialect;
4545
use crate::dialect::{
4646
BigQueryDialect, DuckDbDialect, GenericDialect, MySqlDialect, PostgreSqlDialect,
@@ -1372,7 +1372,7 @@ impl<'a> Tokenizer<'a> {
13721372
}
13731373
'{' => self.consume_and_return(chars, Token::LBrace),
13741374
'}' => self.consume_and_return(chars, Token::RBrace),
1375-
'#' if dialect_of!(self is SnowflakeDialect | BigQueryDialect | MySqlDialect) => {
1375+
'#' if dialect_of!(self is SnowflakeDialect | BigQueryDialect | MySqlDialect | HiveDialect) => {
13761376
chars.next(); // consume the '#', starting a snowflake single-line comment
13771377
let comment = self.tokenize_single_line_comment(chars);
13781378
Ok(Some(Token::Whitespace(Whitespace::SingleLineComment {

tests/sqlparser_common.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10423,6 +10423,7 @@ fn test_comment_hash_syntax() {
1042310423
Box::new(BigQueryDialect {}),
1042410424
Box::new(SnowflakeDialect {}),
1042510425
Box::new(MySqlDialect {}),
10426+
Box::new(HiveDialect {}),
1042610427
]);
1042710428
let sql = r#"
1042810429
# comment

0 commit comments

Comments
 (0)