crobox / clickhouse-scala-client

Clickhouse Scala Client with Reactive Streams support
GNU Lesser General Public License v3.0
112 stars 24 forks source link

DSL v2 doesn't fully implement equality #71

Open sjoerdmulder opened 5 years ago

sjoerdmulder commented 5 years ago

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)

erdebee commented 5 years ago

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

sjoerdmulder commented 5 years ago

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