[jira] [Created] (FLINK-3631) CodeGenerator does not check type compatibility for equality expressions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-3631) CodeGenerator does not check type compatibility for equality expressions

Shang Yuanchun (Jira)
Fabian Hueske created FLINK-3631:
------------------------------------

             Summary: CodeGenerator does not check type compatibility for equality expressions
                 Key: FLINK-3631
                 URL: https://issues.apache.org/jira/browse/FLINK-3631
             Project: Flink
          Issue Type: Bug
          Components: Table API
    Affects Versions: 1.1.0
            Reporter: Fabian Hueske


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

{code}
    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()
{code}

The generated flatMap code looks like this:

{code}
@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);
  }
}
{code}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)