Right now we basically do what you said for the JDBC driver to return the
column headers. Add a special metadata tuple that has the fields info.
For Calcite (and more SQL support), we need to know information about the
fields ahead of time. Off the top of my head it is used for:
- Knowing which fields are available
- Which field data types are available
- Generate a plan on how to evaluate
- ie: do things need to be casted
Right now we aren't doing any of that, so we are lazily determining fields.
The mismatch is between SQL being strongly typed with a schema and Solr not
requiring that.
This is only an issue right now for dynamic fields. For fields that are
defined in the schema, a single call to the schema API makes it easy to
determine fields that are there. Dynamic fields could end up being anything
which makes it slightly harder.
Kevin Risden
On Fri, Nov 18, 2016 at 11:06 AM, Yonik Seeley <[email protected]> wrote:
> On Fri, Nov 18, 2016 at 11:46 AM, Kevin Risden <[email protected]>
> wrote:
> >> Out of curiosity, how is this used (and in what contexts)?
> >> I'm wondering the implications of new fields appearing when new
> >> documents are added. Will this mess up the JDBC driver?
> >
> >
> > Currently its not being used. Select * isn't supported yet.
>
> Does "select *" need to know ahead of time what fields there will be?
> Although retrieving the set of stored fields (or the set of used
> fields) should be easy to implement, it doesn't seem like the most
> efficient way to implement things (at least at the streaming API
> level..)
>
> If we need to know the set of fields that match a wildcard before
> streaming all of the documents, we could easily add that info
> on-demand at the head (sort of like column headers).
>
> So currently we have:
>
> {
> "response": {
> "docs": [...]
> }
> }
>
> And we could insert "fields" inside the response object:
>
> {
> "response": {
> "fields":["field1","field2","field3","field4"]
> "docs": [...]
> }
> }
>
> Or alternately outside of the "response" object:
>
> {
> "fields":["field1","field2","field3","field4"],
> "response": {
> "docs": [...]
> }
> }
>
> Or is there some reason we need the full set of fields before we even
> send the request?
>
> -Yonik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>