I'm experimenting with calcite from scala, and trying to pass a simple scala class for creating a schema at runtime (using ReflectiveSchema
), I'm having some headache.
For example, re-implementing the FoodMart JDBC Example (which works well in Java), I'm calling it as simple as new ReflectiveSchema(new Hr())
, using a Hr
class rewritten in scala as:
class HR { val emps: Array[Employee] = Array(new Employee(100, "Bill")) }
I'm experiencing an error: ...SqlValidatorException: Object 'emps' not found within 'hr'
. This problem seems to be related to the fact that val
fields are actually created private
in bytecode from java, and the implementation in calcite seems to be able to use (by means of java reflection) only fields accessible through the .getFields()
method of a class.
So I suppose this direction requires a lot more hacking than a simple my_field.setAccessible(true)
or similar.
Are there any other way to construct a schema by API, avoiding reflection and the usage of JSON?
thanks in advance for any suggestion