we have static data conbination use cases , reflective shcema  is the best 
choice!



---Original---
From: "Gavin Ray"<ray.gavi...@gmail.com&gt;
Date: Mon, Feb 21, 2022 01:52 AM
To: "dev"<dev@calcite.apache.org&gt;;
Subject: Re: dynamic reflective schema


Ah, you don't want to use ReflectiveSchema, it's a simple schema type meant
for easily making test schemas

You want to extend from "AbstractSchema" and override the function
"Map<String, Table&gt; getTableMap()"
For the "Table" type, you probably want to use "JsonScannableTable"

The CsvSchema example does exactly this, if you want to see an example
implementation:
https://github.com/apache/calcite/blob/4bc916619fd286b2c0cc4d5c653c96a68801d74e/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvSchema.java#L69-L106

Hope this helps =)



On Sat, Feb 19, 2022 at 11:03 PM xiaobo <guxiaobo1...@qq.com.invalid&gt; wrote:

&gt; Hi,
&gt; When using&nbsp; reflectiveSchema we must define a static Java class for 
the
&gt; schema object, but in our use case the actual data to query is dynamic,
&gt; define JAVA class for each data combination is impossible, we have an idea
&gt; that can we make a JSONSchema which accepts a Map<String,
&gt; List<JSONObject&gt;&gt;, so that each List will be mapped to a table , and 
each
&gt; JSONObject mapped to a row, JSONObject keys will be column names. Is there
&gt; anything similar with this?
&gt;
&gt;
&gt; Regards

Reply via email to