Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/701#discussion_r102920945
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlWorker.java
 ---
    @@ -50,13 +47,56 @@
       private DrillSqlWorker() {
       }
     
    +  /**
    +   * Converts sql query string into query physical plan.
    +   *
    +   * @param context query context
    +   * @param sql sql query
    +   * @return query physical plan
    +   */
       public static PhysicalPlan getPlan(QueryContext context, String sql) 
throws SqlParseException, ValidationException,
           ForemanSetupException {
         return getPlan(context, sql, null);
       }
     
    +  /**
    +   * Converts sql query string into query physical plan.
    +   * In case of any errors (that might occur due to missing function 
implementation),
    +   * checks if local function registry should be synchronized with remote 
function registry.
    +   * If sync took place, reloads drill operator table
    +   * (since functions were added to / removed from local function registry)
    +   * and attempts to converts sql query string into query physical plan 
one more time.
    +   *
    +   * @param context query context
    +   * @param sql sql query
    +   * @param textPlan text plan
    +   * @return query physical plan
    +   */
       public static PhysicalPlan getPlan(QueryContext context, String sql, 
Pointer<String> textPlan)
           throws ForemanSetupException {
    +    Pointer<String> textPlanCopy = textPlan == null ? null : new 
Pointer<>(textPlan.value);
    +    try {
    +      return getQueryPlan(context, sql, textPlan);
    +    } catch (Exception e) {
    --- End diff --
    
    Not to be engaged into enumerating possible exceptions (which can added in 
the code later), we are checking if remote and local function registries are in 
sync on any error. Such check may only affect on queries that will fail anyway. 
So if failure time will take a little bit longer, it won't make significant 
difference. But this will be removed when MVCC (multi-version concurrency 
control) will be implemented: when query will fail, we won't check if our 
function registry is up-to-date, since MVCC will ensure we have before query 
startup.


---
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.
---

Reply via email to