iffyio commented on code in PR #2029:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2029#discussion_r2379306526
##########
tests/sqlparser_common.rs:
##########
@@ -17246,3 +17246,46 @@ fn parse_invisible_column() {
_ => panic!("Unexpected statement {stmt}"),
}
}
+
+#[test]
+fn parse_create_index_different_using_positions() {
+ let sql = "CREATE INDEX idx_name USING BTREE ON table_name (col1)";
+ let expected = "CREATE INDEX idx_name ON table_name USING BTREE (col1)";
+ match all_dialects().one_statement_parses_to(sql, expected) {
+ Statement::CreateIndex(CreateIndex {
+ name,
+ table_name,
+ using,
+ columns,
+ unique,
+ ..
+ }) => {
+ assert_eq!(name.unwrap().to_string(), "idx_name");
+ assert_eq!(table_name.to_string(), "table_name");
+ assert_eq!(using, Some(IndexType::BTree));
+ assert_eq!(columns.len(), 1);
+ assert!(!unique);
+ }
+ _ => unreachable!(),
+ }
+
+ let sql = "CREATE INDEX idx_name USING BTREE ON table_name (col1) USING
HASH";
+ let expected = "CREATE INDEX idx_name ON table_name(col1) USING HASH";
Review Comment:
I'm not sure I followed the intent, why do we drop the first clause vs
keeping both as in the input?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]