I'm writing a HiveStoragePredicateHandler, and I'm trying to figure
out the most appropriate way to write unit tests for the
decomposePredicate method. I'm seeking advice for the best way to do
this.

The way I see it, there seem to be two obvious approaches:
1. Write a query as a string. Run it through the parser and optimizer,
then pass it into decomposePredicate. Assert something about the
return value.
2. Run an "explain" on a query and assert that the TableScan
"filterExpr" is what I expect, and that the Filter Operator's
predicate is what I expect.

I don't how to do (1), because I'm not sure what the appropriate
classes/methods are to parse and optimize a query, or how to figure
out this information. (2) sounds a lot easier, but I'm not sure that
this is the right approach, because I'm not completely sure how my
HiveStoragePredicateHandler directly affects the explain output.

Can anyone confirm that (2) is the right/wrong way to test a
HiveStoragePredicateHandler? Any advice on trying to test using method
(1)?

Many thanks in advance.

Reply via email to