You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "jasonbhansen (via GitHub)" <gi...@apache.org> on 2025/02/10 19:23:45 UTC

[I] Fails to parse FORCE INDEX(idx_test) [datafusion-sqlparser-rs]

jasonbhansen opened a new issue, #1722:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1722

   `fn main() -> ProfilerResult<()> {
       // tracing_subscriber::fmt()
       //     .with_max_level(tracing::Level::DEBUG)
       //     .init();
       use sqlparser::dialect::GenericDialect;
       use sqlparser::parser::Parser;
   
       let dialect = GenericDialect {}; // or AnsiDialect
   
       let sql = "SELECT a, b, 123, myfunc(b) \
              FROM table_1 FORCE INDEX (idx_name)\
              WHERE a > b AND b < 100 \
              ORDER BY a DESC, b";
   
       let ast = Parser::parse_sql(&dialect, sql).unwrap();
   
       println!("AST: {:?}", ast);
       Ok(())
   }`
   
   throws
   
   `DEBUG sqlparser::dialect: get_next_precedence_full() TokenWithSpan { token: Word(Word { value: "FROM", quote_style: None, keyword: FROM }), span: Span(Location(1,29)..Location(1,33)) }    
   2025-02-10T19:22:33.781308Z DEBUG sqlparser::parser: next precedence: 0    
   thread 'main' panicked at standalone/src/main.rs:19:48:
   called `Result::unwrap()` on an `Err` value: ParserError("Expected: end of statement, found: INDEX at Line: 1, Column: 48")
   stack backtrace:
      0: rust_begin_unwind
                at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
      1: core::panicking::panic_fmt
                at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:76:14
      2: core::result::unwrap_failed
                at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/result.rs:1699:5
      3: core::result::Result<T,E>::unwrap
                at /Users/jasonhansen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:1104:23
      4: standalone::main
                at ./src/main.rs:19:15
      5: core::ops::function::FnOnce::call_once
                at /Users/jasonhansen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.` 
   
   


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Fails to parse FORCE INDEX(idx_test) [datafusion-sqlparser-rs]

Posted by "LucaCappelletti94 (via GitHub)" <gi...@apache.org>.
LucaCappelletti94 commented on issue #1722:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1722#issuecomment-5803976843

   `FORCE INDEX (idx_name)` parses on `main` with `MySqlDialect` since #1675 added MySQL index hints. `GenericDialect` still rejects it because table hints are enabled per dialect through `Dialect::supports_table_hints`. As this is MySQL syntax, closing as resolved for `MySqlDialect`.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Fails to parse FORCE INDEX(idx_test) [datafusion-sqlparser-rs]

Posted by "LucaCappelletti94 (via GitHub)" <gi...@apache.org>.
LucaCappelletti94 closed issue #1722: Fails to parse FORCE INDEX(idx_test)
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1722


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org