clickhouse-scala-client icon indicating copy to clipboard operation
clickhouse-scala-client copied to clipboard

DSL v2 doesn't fully implement equality

Open sjoerdmulder opened this issue 6 years ago • 2 comments

having the following test-case you could expect that this tests passes:

val first = (2 === 2).and(3 === 3)
val second = (2 === 2).and(3 === 3)
first should be(second)

but somehow it seems object equality is not implemented fully in the new DSL v2 and fails with a

LogicalFunction(com.crobox.clickhouse.dsl.column.Magnets$$anon$36@62a60260,And,com.crobox.clickhouse.dsl.column.Magnets$$anon$36@664f03cb) was not equal to LogicalFunction(com.crobox.clickhouse.dsl.column.Magnets$$anon$36@30c9e27,And,com.crobox.clickhouse.dsl.column.Magnets$$anon$36@72663249)

sjoerdmulder avatar Nov 06 '18 14:11 sjoerdmulder

Scala implements implicit conversions as anonymous function instances. Therefor these objects are not considered equal.
We could implement equals in the magnets traits, I think it will be a tedious but easy task

erdebee avatar Nov 16 '18 12:11 erdebee

Failing tests on an internal project written by a certain person ;-)

sjoerdmulder avatar Nov 16 '18 12:11 sjoerdmulder