Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-2805

Throw clear error message when maxdir/mindir UDFs are used in any other part of SQL, but where clause

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.0
    • Future
    • Functions - Drill
    • None

    Description

      This error message is not right. I think the problem here is that we are not allowing to use these UDFs in projection list, group by or order by.
      Can we please have an error message that says that ?

      0: jdbc:drill:schema=dfs> select maxdir('dfs.test', 'bigtable') from smalltable  group by maxdir('dfs.test', 'bigtable');
      
      Query failed: SYSTEM ERROR: The partition explorer interface can only be used in functions that can be evaluated at planning time. Make sure that the planner.enable_constant_folding configuration option is set to true.
      [6c9dd988-0960-4a3a-9495-535e245f0daa on atsqa4-134.qa.lab:31010]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      This is the correct way this error message is used:

      0: jdbc:drill:schema=dfs> select * from smalltable where dir0 = maxdir('dfs.test', 'bigtable') and dir1 = mindir('dfs.test', 'bigtable/2016');
      +------------+------------+------------+
      |  columns   |    dir0    |    dir1    |
      +------------+------------+------------+
      +------------+------------+------------+
      No rows selected (0.943 seconds)
      
      0: jdbc:drill:schema=dfs> alter session set `planner.enable_constant_folding` = false;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | planner.enable_constant_folding updated. |
      +------------+------------+
      1 row selected (0.108 seconds)
      
      0: jdbc:drill:schema=dfs> select * from smalltable where dir0 = maxdir('dfs.test', 'bigtable') and dir1 = mindir('dfs.test', 'bigtable/2016');
      
      Query failed: SYSTEM ERROR: The partition explorer interface can only be used in functions that can be evaluated at planning time. Make sure that the planner.enable_constant_folding configuration option is set to true.
      [c22bad01-f9c7-43ba-b76c-8a11be518b40 on atsqa4-134.qa.lab:31010]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      Btw, I'm not sure I understand why we want to make constant folding configurable. Is the any benefit to not have it turned on ?

      Attachments

        Issue Links

          Activity

            People

              arina Arina Ielchiieva
              vicky Victoria Markman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: