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

Table function escape handling does not handle lone backslash

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.11.0
    • None
    • None
    • None

    Description

      Consider the following query from the test framework (Functional/table_function/positive/drill-3149_10.q):

      select * from table(`table_function/colons.txt`(type=>'text',lineDelimiter=>'\\'))
      

      Notice the double-backslash. Drill translates this into a single backslash. But, what happens if the user provides just a single backslash? Drill translates that into the empty string. Drill passes the empty string to the text reader, which fails with the error described in DRILL-5929.

      Better would be to either:

      • Leave lone back-slashes unchanged, or
      • Fail a query with an lone backslash.

      The fix for this bug prefers the first (because it is easiest.) However, this fix does not handle a triple backslash, which will be translated to a single backslash:

      • \ \ --> \
      • \ --> (nothing)

      The code in question:

      class FormatPluginOp ...
        FormatPluginConfig createConfigForTable(TableInstance t) {
      ...
                param = StringEscapeUtils.unescapeJava(param);
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: