prameterize the query engine for selfjoin