Csc 1302, Honors Principles of Computer Science II (Fall 2021)

Week 13 (19 November 2021)

semanticCheckAndSetSchemaAndDataTypes in Expression Tree

During this week you will complete the sections related to "rename", "project" and "select" in the following method from RANode.java:
  public String semanticCheckAndSetSchemaAndDataTypes(Database db) {
    // This method checks for Semantic Errors and returns an error message
    // if there is a semantic error. If there are no semantic errors then this method
    // sets the following 3 instance variables for RANode class:
    // public ArrayList<String> joinColumns; // set this only for join
    // public ArrayList<String> schemaColumns;
    // public ArrayList<String> schemaDataTypes;
    // and returns "OK"

    if(rnodetype.equals("relation")){

    }
    else if(rnodetype.equals("union") ||
            rnodetype.equals("minus") ||
            rnodetype.equals("intersect")){

    }
    else if(rnodetype.equals("times")){

    }
    else if(rnodetype.equals("join")){

    }
    else if(rnodetype.equals("rename")){
      // Week 13
      // SEMANTIC ERROR CHECKS:
      // (1) Not a valid number of attributes

    }
    else if(rnodetype.equals("project")){
      // Week 13
      // SEMANTIC ERROR CHECKS:
      // (1) Not a valid attribute

    }
    else if(rnodetype.equals("select")){
      // week 13
      // SEMANTIC ERROR CHECKS:
      // (1) Left Operand is not a valid operand
      // (2) Right Operand is not a valid operand
      // (3) Data types do not match in comparison
    }
    else {
      return "SOMETHING STRANGE TOOK PLACE!";
    }
  }