Memory error - any solutions?

Hello, is there any chance to prevent this error?

omnisci.exceptions.Error: Hash join failed, reason(s): Ran out of memory while building hash tables for equijoin | OutOfMemory: Failed to allocate 240000000 bytes | No equijoin expression found | No equijoin expression found | Cannot fall back to loop join for intermediate join quals


Could you share the Query and the DDLs of the two tables involved in the join?
Also, MIN and MAX values and the Cardinalities of the column used in the join would be useful.