GitHub user hsuanyi opened a pull request: https://github.com/apache/drill/pull/397
Drill 4372 review You can merge this pull request into a Git repository by running: $ git pull https://github.com/hsuanyi/incubator-drill DRILL-4372_Review Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/397.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #397 ---- commit 4c75fd6ae22e26dcac37d5da1f41020d25f885d8 Author: Sudheesh Katkam <skat...@maprtech.com> Date: 2015-12-22T04:38:59Z Validate Drill functions (argument and return types). WIP. commit 4aa34bf41982a4491f6eea347165436fe9dfd853 Author: Hsuan-Yi Chu <hsua...@usc.edu> Date: 2015-12-30T22:21:10Z DRILL-4372: Expose the functions return type to Drill - Drill-Calite version update: This commit needs to have Calcite's patch (CALCITE-1062) to plugin customized SqlOperator. - FunctionTemplate Add FunctionArgumentNumber annotation. This annotation element tells if the number of argument(s) is fixed or arbitrary (e.g., String concatenation function). Due to this modification, there are some minor changes in DrillFuncHolder, DrillFunctionRegistry and FunctionAttributes. - Checker Add a new Checker (which Calcite uses to validate the legitimacy of the number of argument(s) for a function) to allow functions with arbitrary arguments to pass Caclite's validation - Type conversion between Drill and Calcite DrillConstExector is given a static method getDrillTypeFromCalcite() to convert Calcite types to Drill's. - Extract function's return type inference Unlike other functions, Extract function's return type can be determined solely based on the first argument. A logic is added in to allow this inference to happen - DrillCalcite wrapper: From the aspects of return type inference and argument type checks, Calcite's mechanism is very different from Drill's. In addition, currently, there is no straightforward way for Drill to plug-in customized mechanisms to Calcite. Thus, wrappers are provided to serve the objective. Except for the mechanisms of type inference and argument type checks, these wrappers just forward any method calls to the wrapped SqlOpertor, SqlFuncion or SqlAggFunction to respond. A interface DrillCalciteSqlWrapper is also added for the callers of the three wrappers to get the wrapped objects easier. Due to these wrappers, UnsupportedOperatorsVisitor is modified in a minor manner. - Calcite's SqlOpertor, SqlFuncion or SqlAggFunction are wrapped in DrillOperatorTable Instead of returning Caclite's native SqlOpertor, SqlFuncion or SqlAggFunction, return the wrapped ones to ensure customized behaviors can be adopted. - Type inference mechanism This mechanism is used across all SqlOpertor, SqlFuncion or SqlAggFunction. Thus, it is factored out as its own method in TypeInferenceUtils - Upgrade Drill-Calcite Bump version number to 1.4.0-drill-test-r15 ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---