private void validateDeleteOp(RelRoot relRoot) throws SamzaSqlValidatorException {
    LogicalProject project = (LogicalProject) relRoot.rel;
    RelRecordType projectRecord = (RelRecordType) project.getRowType();

    // In the case of DELETE op, only the key and DELETE op are required.

    if (projectRecord.getFieldCount() != 2) {
      throw new SamzaSqlValidatorException(String.format("Only two select query fields are expected for DELETE op."
          + " But there are %d fields given in the query.", projectRecord.getFieldCount()));
    }

    RelDataTypeField keyField = projectRecord.getField(SamzaSqlRelMessage.KEY_NAME, true, true);
    if (keyField == null) {
      throw new SamzaSqlValidatorException(String.format("Select query needs to specify '%s' field while using DELETE"
              + " op. Eg: 'SELECT myKey AS %s, '%s' AS %s FROM myTable'", SamzaSqlRelMessage.KEY_NAME,
          SamzaSqlRelMessage.KEY_NAME, SamzaSqlRelMessage.DELETE_OP, SamzaSqlRelMessage.OP_NAME));
    }
    int keyIdx = projectRecord.getFieldList().indexOf(keyField);
    // Get the node corresponding to the special op.
    RexNode node = project.getProjects().get(1 - keyIdx);
    if (!node.toString().equals(String.format("'%s'", SamzaSqlRelMessage.DELETE_OP))) {
      throw new SamzaSqlValidatorException(String.format("%s op is not supported. Please note that only '%s' op is"
              + " currently supported. Eg:'SELECT myKey AS %s, '%s' AS %s FROM myStream'", node.toString(),
          SamzaSqlRelMessage.DELETE_OP, SamzaSqlRelMessage.KEY_NAME, SamzaSqlRelMessage.DELETE_OP,
          SamzaSqlRelMessage.OP_NAME));
    }
  }
Determine if validation needs to be done on Calcite plan based on the schema provider and schema converter.
@param relRoot
@param sink
@param outputSchemaProvider
@param ouputRelSchemaConverter
@return if the validation needs to be skipped
samza-sql/src/main/java/org/apache/samza/sql/planner/SamzaSqlValidator.java