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

JDBC-all excludes files required for date/time vectors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.12.0
    • None
    • None
    • None

    Description

      The vector package contains the file org.apache.drill.exec.expr.fn.impl.DateUtility. It contains formatting code along with a set of date constants (such as the number of hours in a day.) The date constants are used in the generated value vector code, such as for the IntervalVector class:

          public StringBuilder getAsStringBuilder(int index) {
            ...
            final int years  = (months / org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
            months = (months % org.apache.drill.exec.expr.fn.impl.DateUtility.yearsToMonths);
      

      Thus, the DateUtility class is required in order for the date/time vectors to work.

      Yet, recent changes to the JDBC driver now excludes the package that contains the DateUtility class. In dependency-reduced-pom.xml:

                      <exclude>org/apache/drill/exec/expr/fn/**</exclude>
      

      A refactoring exercised moved more of the date/time code out of generated code and into the DateUtility class, so that the code can be reused. The result are runtime errors in unit tests.

      Caused by: java.lang.NoClassDefFoundError: oadd/org/apache/drill/exec/expr/fn/impl/DateUtility
      	at oadd.org.apache.drill.exec.vector.IntervalDayVector$Accessor.getObject(IntervalDayVector.java:450)
      	at oadd.org.apache.drill.exec.vector.accessor.IntervalDayAccessor.getObject(IntervalDayAccessor.java:125)
      

      Since the intent is to exclude functions only needed by Drill execution, the solution is to move the code required by vectors out of the fn package. The safe bet is to put it in the org.apache.drill.exec.vector which can't be excluded (it includes the value vector code.)

      The larger issue is that the concept of excluding bits of Drill code is problematic: there is no good way to ensure that the code is not needed.

      The traditional (and reliable) solution is to design a client-only library which is designed to include only the required dependences. Build up the list of dependencies from zero (as is common practice in Maven) rather than try to add things then throw them overboard.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Paul.Rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: