code: private Set<String> getConditionsSharedVariables(Set<Variable> vars, AliasIndex index) {
  		/*
  		 * For each variable we collect all the columns that should be equated
  		 * (due to repeated positions of the variable)
  		 * then we create atoms of the form "COL1 = COL2"
  		 */
  		Set<String> equalities = new LinkedHashSet<>();
  		for (Variable var : vars) {
  			Set<QualifiedAttributeID> columns = index.getColumns(var);
  			if (columns.size() >= 2) {
  				// if 1, then no need for equality
  				Iterator<QualifiedAttributeID> iterator = columns.iterator();
  				QualifiedAttributeID leftColumn = iterator.next();
  				while (iterator.hasNext()) {
  					QualifiedAttributeID rightColumn = iterator.next();
  					String equality = String.format("(%s = %s)",
  							leftColumn.getSQLRendering(),
  							rightColumn.getSQLRendering());
  					equalities.add(equality);
  					leftColumn = rightColumn;
  				}
  			}
  		}
  		return equalities;
  	}
docs: Returns a list of equality conditions that reflect the semantics of the
  shared variables in the list of atoms.
  <p>
  When generating equalities recursively, we will also generate a minimal
  number of equalities. E.g., if we have A(x), Join(R(x,y), Join(R(y,
  x),B(x))