Open uosis opened 1 year ago
Fixed on tablesaw-parquet side with v0.11.0.
While this is great and probably the most expedient solution (thanks @ccleva for a quick fix!), the underlying problem of broken init is still there.
I am not aware of any practical issues it is causing at this point however, so this is probably not a very high priority.
There is a circular dependency between singleton fields in ColumnType and singleton fields in its implementations. This makes correct initialization impossible.
Observe the following peculiar behavior (using Scala REPL for ease of illustration;
eq
in Scala is==
in Java, i.e. reference equality):This fails because static init of
ColumnType
is called from within static init ofDoubleColumnType
, whileDoubleColumnType.INSTANCE
field is still null, soColumnType.DOUBLE
receives a new instance from here, instead of the singleton value that eventually ends up inDoubleColumnType.INSTANCE
field.Let's try the other way:
Now static init of
DoubleColumnType
is called from within static init ofColumnType
, whileColumnType.DOUBLE
is still null, so we get null here.This breaks tablesaw-parquet here because it's doing reference equality comparisons.
I am not sure what is the correct solution here. Should tablesaw-parquet not assume singleton instances and use
equals
instead of==
? I am guessing most things are generally working because in most casesDoubleColumnType.instance()
will run first, causingDoubleColumnType.instance()
andColumnType.DOUBLE
to have different instances, but nothing getting null value.Possibly similar to https://github.com/jtablesaw/tablesaw/issues/430.