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

Support early out for code generated conjunctive conditions

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, 1.1.4, 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: Table API & SQL
    • Labels:
      None

      Description

      Currently, all nested conditions for a conjunctive predicate are evaluated before the conjunction is checked.

      A condition like (v1 == v2) && (v3 < 5) would be compiled into

      boolean res1;
      if (v1 == v2) {
        res1 = true;
      } else {
        res1 = false;
      }
      
      boolean res2;
      if (v3 < 5) {
        res2 = true;
      } else {
        res2 = false;
      }
      
      boolean res3;
      if (res1 && res2) {
        res3 = true;
      } else {
        res3 = false;
      }
      
      if (res3) {
        // emit something
      }
      

      It would be better to leave the generated code as early as possible, e.g., with a return instead of res1 = false. The code generator needs a bit of context information for that.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ykt836 Kurt Young
                Reporter:
                fhueske Fabian Hueske
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: