I was working on parsing sql queries and then turning them into their parse trees, but in calcite, the smallest node is broken down to SqlIdentifier. Which doesn’t specify the context of the node.
I want to know if that Identifier node is a table name or a column name etc. But I haven’t found any way to do that in the parsing stage, all require me to go ahead with the Validation stage. I just want the parse tree to be more detailed.
I was looking at approaches like backtracking, or maintaining a data structure to figure out the context but I am stuck there as well.
Any help is appreciated, please, thank you!
I have tried backtracking to get more context, even maintaining a special data structure to store nodes and figure out, except for the validator class I have found no inbuilt method. If there is no inbuilt method, is there a data structure approach I can use to figure this out?
aindri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.