Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-3631

CodeGenerator does not check type compatibility for equality expressions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • Table SQL / API
    • None

    Description

      The following Table API query does not fail but produces an empty result:

          val env = ExecutionEnvironment.getExecutionEnvironment
          val ds = CollectionDataSets.get3TupleDataSet(env).as('a, 'b, 'c)
      
          // must fail. Field 'a is not a string.
          ds.filter( 'a === "nope" ).collect()
      

      The generated flatMap code looks like this:

      @Override
      public void flatMap(Object _in1, org.apache.flink.util.Collector c) throws Exception {
        org.apache.flink.api.table.Row in1 = (org.apache.flink.api.table.Row) _in1;
        
        java.lang.String result$17 = (java.lang.String) in1.productElement(2);
        int result$11 = (java.lang.Integer) in1.productElement(0);
        long result$14 = (java.lang.Long) in1.productElement(1);
      
        java.lang.String result$19 = "nope";
        
        boolean result$21 = result$19.equals(result$11);
        
        if (result$21) {
          out.setField(0, result$11);
        	out.setField(1, result$14);
        	out.setField(2, result$17);
          c.collect(out);
        }
      }
      

      I would expect the query to fail due to a Integer/String type conflict.

      Attachments

        Activity

          People

            ram_krish ramkrishna.s.vasudevan
            fhueske Fabian Hueske
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: