DRILL-2060: Constant folding rule
2060 update - Constant folding work completed.
Fix issue with date, time and timestamp literal creation.
Fix literal creation during expression interpretation to match nullability of incoming expression.
Fix decimal literals in interpreted expression eval.
Disable test with an exposed planning bug when the project instance of the constant folding rule is enabled. The rule is not actually influencing the final plan when the rule is firing and making expression reductions. This is due to our current cost model fro project which just counts the number of expressions and does not consider expression complexity. The issues have been logged in DRILL-2218 for further investigation, they do not need to be solved to merge the other constant folding rules and all of the interpreted expression work that has been done.
Get rid of clutter in RuleSets, explanation has been moved to the 2218 JIRA.
Belongs with 2060, fix constant expression executor to use the new constant expression interpreter interface that returns a ValueHolder instead a ValueVector with a single value filled in.
2060 update - change test baseline due to new column ordering (no functional or performance impacting changes to plan)
2060 - address Aman's comments.
add test ignore - DRILL-2218
Baseline update for project pushdown test (only column ordering on a scan, no functional or performance impacting plan changes)
Turn back on project instance.
Small casting bug in constant executor.
Don't fold hive UDFs.
Modify DrillBuf to allow a BufferManager to be the owning context for a DrilllBuf.
TODO - refactor to remove remaining common code from OperatorContext and FragmentContext,
have them both use the new BufferManager.
Add system option for disabling constant folding.
2060 update - test option to disable constant folding.
Update RuleSets to actually allow turning the constant folding rules on and off as well as establish general pattern for turning logical rules on an off, similar to how some physical rules can be already.
Change the estimated row count in EasyGroupScan to report a number of files in the case where the file size indicates an estimated total count of 0 records. Allows very small files to be pruned.
Fix folding expressions that result in null after refactoring the interpreted expression evaluation to return a ValueHolder in the case of a constant expression. Previously a value vector was returned in the same manner as the interpreter can still do when given an input VectorAccessible and an expression that may contain fild references. Calling getObject on the output vector previously gracefully handled nulls as they were passed into the Calciate API to create literals. This process has to be a bit more manual now.
Address Jinfeng's review comments.
A few more review comments.
Disable cost calculation change, complete fix will come in 2553.
Throw a runtime exception of there is an error materializing the expression, as the same materialization will take place at query execution time we should fail early.
Add a test that does prune appropriately, still have a test for the outstanding issue tracked in DRILL-2553.
Small fix for test to properly set session option and set it back after completion.
Fixing comment that was garbled somehow.
small fix for case where expression returns a null result during constant folding.
Add a little defensive code to give a good error message if a type that does not appear in the mapping from Drill to Calcite types attempts to be folded into a null value.