Print arithmetic and comparison expressions in human-readable format.#12783
Conversation
There was a problem hiding this comment.
Let's use StandardFunctionResolution for the constructor; so it's more general
There was a problem hiding this comment.
Use FunctionMetadataManager to make it generic.
There was a problem hiding this comment.
Can you add more complicated test cases to invoke recursive printing? For example ((a + b) * c) > 0 OR length(d) > e
There was a problem hiding this comment.
Just call it expression. We usually spell out a word completely than using abbreviations.
There was a problem hiding this comment.
Could you also handle the CAST case?
For CAST(a) we can print out as CAST(a AS <return_type>). This helps us to understand the type info.
Also, can we handle NEGATION and SUBSCRIPT as well?
There was a problem hiding this comment.
Sure thing, should I also include AND and OR.
highker
left a comment
There was a problem hiding this comment.
For commit message, we usually bound each line (for body or title) within 72 words.
|
Could you squash the commits into one and do a force push? @AkshayPall |
3361068 to
e9c199b
Compare
There was a problem hiding this comment.
use node.getType().getTypeSignature(); lower case is fine.
There was a problem hiding this comment.
Nit: put all variables in one line or one variable per line. For example:
private static void printSubPlan(
SubPlan plan,
Map<PlanFragmentId, PlanFragment> fragmentsById,
...There was a problem hiding this comment.
We don't usually use numbers in variable names; but it's fine in tests.
Previously, all functions (CallExpressions) would be printed as '$function_name$(ARG1, ARG2, ..., ARGN)' but now some expressions will print in human format eg, '(prestodb#1) + (BIGINT 5)'. Additional changes were made to pass a `FunctionManager` instance to `RowExpressionFormatter` instead of instantiating one in the class.
e9c199b to
b1c7e5c
Compare
Previously, all functions (CallExpressions) would be printed as
$function_name$(ARG1, ARG2, ..., ARGN)but now arithmetic and comparison expressions will print with the operand between arguments eg,(#1) + (BIGINT 5). Additional changes were made to pass aFunctionManagerinstance toRowExpressionFormatterinstead of instantiating one in the class.