Hello, We need to be able to parse and manipulate an HQL query. To date we’ve been intercepting and transforming the parse tree in the SemanticAnalyzerHook. However, ideally we wish to manipulate the original query as delivered by the user (or as close to it as possible), and we’re finding that the tree has been modified significantly by the time it hits the hook. Additionally we wish to track back ASTNodes to the character sequences in the source HQL that were their origin (where sensible), and ultimately hope to be able regenerate the query text from the AST.
We are expecting to need to write our own parser to do this, but hope to use the Hive grammar at least for the foundation. I wonder if anyone familiar with this code might be able to suggest some good staring points. The use case, if you are interested, is a mutation testing framework for HQL. The testing of mutants is operational, but now we need to report on survivors, hence the need to track back from specific query elements to character sequences in the original query string. Thanks, Elliot.