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

Error on clause that should not be evaluated

    XMLWordPrintableJSON

Details

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

    Description

      Some requests failed when evaluate condition which should not be evaluated.

      Example:

      SELECT * FROM (
       SELECT * FROM (
        SELECT '1d28' a ) 
       WHERE regexp_matches(a,'^[0-9]*$')) /* Keep only row on INT format */
      WHERE CAST(a AS INT) < 2000;         /* This CAST should't failed due */ 
                                           /* to filtering in the inner queries */
      =>
      Error: SYSTEM ERROR: NumberFormatException: 1d28
      

      Note that the problem doesn't appear in all situation.

      Examples :

      /* Just adding another row and it's work ! */
      SELECT * FROM (
       SELECT * FROM (
        SELECT '1d28' a UNION SELECT '2a2')
       WHERE regexp_matches(a,'^[0-9]*$'))
      WHERE CAST(a AS INT) < 2000;
      =>
      +---+
      | a |
      +---+
      +---+
      
      // MyFile.csvh
      a,b
      1,2
      a1a,3
      // !MyFile.csvh 
      
      SELECT * FROM (
       SELECT * FROM ....`MyFile.csvh ` WHERE regexp_matches(a,'^[0-9]*$')) AS x WHERE CAST(a AS INT) < 200;
      =>
      +---+---+
      | a | b |
      +---+---+
      | 1 | 2 |
      +---+---+
      

      In this case, there is no error - the cast is never evaluated (as expected) for the row with a='a1a'.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            benj641 benj
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: