Viraj Jasani created PHOENIX-7463:
-------------------------------------

             Summary: New ANTLR grammar to evaluate BSON's SQL style expressions
                 Key: PHOENIX-7463
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7463
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Viraj Jasani


PHOENIX-7330 introduces BSON as Data type in Phoenix. It also introduces 
complex expressions BSON_CONDITION_EXPRESSION() and BSON_UPDATE_EXPRESSION() to 
evaluate various WHERE clause based conditions and to perform full or partial 
document updates.

BSON_CONDITION_EXPRESSION() has two flavors of expressions:
 # Document style condition expression
 # SQL style condition expression with placeholder values

The Document style condition expression already comes in AST (Abstract Syntax 
Tree) form and hence the tree is directly parsed to evaluate the given 
condition.

The SQL style condition expression has statement that needs to be evaluated. 
This style of expressions do have substantial difference from what we use in 
Phoenix SQL based WHERE clause. The expression also has BSON specific functions.

PHOENIX-7330 uses MVEL based expression evaluation language to evaluate the 
given statement. MVEL also internally parses the string into AST tree before 
evaluating it. While this works well, it has some disadvantages:
 * The approach has dependency on regex based string conversions.
 * Adding more internal functions for BSON might require significant changes 
and potentially more regex overhead.

The purpose of this Jira it to introduce new ANTLR grammar for BSON's SQL style 
condition expressions such that it can be extended to support more complex BSON 
functions in future. ANTLR is a powerful parser framework and it is already in 
use for Phoenix SQL use cases. While the same ANTLR grammar rules are not fully 
applicable to BSON conditions and internal functions (e.g. field_exists()), 
creating new grammar rules for BSON (Document) data type should be beneficial.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to