LucaCappelletti94 commented on PR #1707:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1707#issuecomment-2676141068

   Sure, so:
   
   In a GIN index, there MAY be an operator class from a provided limited set, 
in the following example `gin_trgm_ops`
   
   ```sql
   CREATE INDEX documents_content_trgm_idx ON documents USING GIN (content 
gin_trgm_ops);
   ```
   
   In a BRIN index, instead, to the best of my knowledge there are no such 
operator classes. I base this claim on having read the [actual postgres source 
code](https://github.com/postgres/postgres), as unfortunately the documentation 
is rather scarse in regard of which operator classes are available.
   
   ```sql
   CREATE INDEX logs_event_time_brin_idx ON logs USING BRIN (event_time);
   ```
   
   One more important thing is that the actual index type, in these cases 
respectively `GIN` and `BRIN`, while currently modeled as an enumeration, is 
actually something as customizable as a table since I could always introduce a 
new index via a custom extension.
   
   If the Operator classes are to be treated as generic strings, it may be the 
case that also index types should be treated as such, if the goal is to make 
the library generically future-proofed. I am not certain it is necessarily the 
best way forward, as it may become exceedingly generic, but most likely this is 
my need to validate the semantics of the SQL that sneaks in.
   
   Summarizing, let me know your opinion of these three questions:
   
   1) Should there be an enumeration of index types (plus maybe a 
`CustomIndexType(String)` variant? Or should that too be replaced with a 
simpler `IndexType(String)`?
   2) If we keep the index enum, should there be a check on whether the 
provided index type is known to support Operator classes (which is how I 
implemented it now, with the generic dispatch)?
   3) If we keep the dispatch for validating the operator classes, maybe it 
would be reasonable to still keep the enumeration of the operator classes PLUS 
a `CustomOperatorClass(String)` thing? Or, if we remove any of the above, 
switch to a `Option<OperatorClass(String)>` and be done with it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to