[ 
https://issues.apache.org/jira/browse/DRILL-4963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15767219#comment-15767219
 ] 

ASF GitHub Bot commented on DRILL-4963:
---------------------------------------

GitHub user arina-ielchiieva opened a pull request:

    https://github.com/apache/drill/pull/701

    DRILL-4963: Sync remote and local function registries before query ex…

    …ecution
    
    Lazy-init was performed only when function was not found during Calcite 
parsing but DRILL-4963 shows different cases when Calcite parsing can pass 
(usually during function overloading) but still function is not found. To 
handle such cases, we need to sync remote and local function registries before 
query execution. To make this sync as much light-weight as possible we first 
compare remote and local function registries versions and start looking for 
missing jars only when versions do not match. Under local function registry is 
implied remote function registry version with which local function registry was 
synchronized last time.
    
    Changes:
    1. Add `consists` method to PersistentStore interface which can return true 
if key exists in store, false otherwise. This method is needed to return only 
remote function registry version without its content (unlike method `get`). 
We'll pull remote function registry content only if versions are different.
    2. Added check if remote and local function registries are in sync before 
query execution on planning and execution stages.
    3. Removed unused methods and changes connected with lazy-init 
implementation on failure only.
    4. Added additional debug messages for `CreateFunctionHandler` and 
`DropFunctionHandler`.
    5. Updated unit tests to reflect new changes.
    
    
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/arina-ielchiieva/drill DRILL-4963

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/701.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 #701
    
----
commit 51ef6614a2c27cb6bb58fb0de875952f99e9b102
Author: Arina Ielchiieva <arina.yelchiy...@gmail.com>
Date:   2016-12-20T16:57:15Z

    DRILL-4963: Sync remote and local function registries before query execution

----


> Issues when overloading Drill native functions with dynamic UDFs
> ----------------------------------------------------------------
>
>                 Key: DRILL-4963
>                 URL: https://issues.apache.org/jira/browse/DRILL-4963
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.9.0
>            Reporter: Roman
>            Assignee: Arina Ielchiieva
>             Fix For: Future
>
>         Attachments: subquery_udf-1.0-sources.jar, subquery_udf-1.0.jar, 
> test_overloading-1.0-sources.jar, test_overloading-1.0.jar
>
>
> I created jar file which overloads 3 DRILL native functions 
> (LOG(VARCHAR-REQUIRED), CURRENT_DATE(VARCHAR-REQUIRED) and 
> ABS(VARCHAR-REQUIRED,VARCHAR-REQUIRED)) and registered it as dynamic UDF.
> If I try to use my functions I will get errors:
> {code:xml}
> SELECT CURRENT_DATE('test') FROM (VALUES(1));
> {code}
> Error: FUNCTION ERROR: CURRENT_DATE does not support operand types (CHAR)
> SQL Query null
> {code:xml}
> SELECT ABS('test','test') FROM (VALUES(1));
> {code}
> Error: FUNCTION ERROR: ABS does not support operand types (CHAR,CHAR)
> SQL Query null
> {code:xml}
> SELECT LOG('test') FROM (VALUES(1));
> {code}
> Error: SYSTEM ERROR: DrillRuntimeException: Failure while materializing 
> expression in constant expression evaluator LOG('test').  Errors: 
> Error in expression at index -1.  Error: Missing function implementation: 
> castTINYINT(VARCHAR-REQUIRED).  Full expression: UNKNOWN EXPRESSION.
> But if I rerun all this queries after "DrillRuntimeException", they will run 
> correctly. It seems that Drill have not updated the function signature before 
> that error. Also if I add jar as usual UDF (copy jar to 
> /drill_home/jars/3rdparty and restart drillbits), all queries will run 
> correctly without errors.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to