1

Not sure where else to go so thought I would ask the group.

I have Apache Calcite working as a SQL parser for my application - I am trying to parse MySQL. However it is unable to handle certain SQL statements. The issue seems to be with any SQL statement that contains a variable denoted by "@@" so something like :

SELECT @@session.auto_increment_increment AS auto_increment_increment

fails in the parser. I appreciate this is MySQL specific but was wondering if there is a way to "handle" these @@'s to at least get them into the Node tree so I can provide a more useful response than throw an exception.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
Spanners
  • 366
  • 2
  • 20

1 Answers1

0

There is an open request for this feature, CALCITE-5066. Probably the best way to "handle" these @@ variables is to implement the feature.

I'm not being facetious. A quick 'hack' solution will likely trip up if @@ characters appear in comments or character literals. So it's better to handle this by modifying the parser. And once you've modified the parser, if you want it to stay working you should write tests and contribute it back to the project.

Julian Hyde
  • 1,239
  • 7
  • 10
  • Thanks - Having tried to read some of the Calcite documentation, it's so damn powerful but its concepts are so woefully documented. I wish I had the time to spend the time gaining a proper understanding to be able to contribute the change back because it would help more than just me but unfortunately like you I have a full time job. Thanks for the answer though. I'll mark it answered – Spanners Nov 22 '22 at 16:28