[ 
https://issues.apache.org/jira/browse/CALCITE-7477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joseph Grogan updated CALCITE-7477:
-----------------------------------
    Description: 
Currently, CalciteMetaImpl loads all sub-schemas from 
rootSchema.getSubSchemaMap() and then filters them in-memory via a 
Predicate1<MetaSchema> (the namedMatcher). This is inefficient when the schema 
map is large or lazily-loaded, because every sub-schema must be materialized 
before the LIKE pattern can be applied.

The proposed fix is to add an overloaded schemas(String catalog, LikePattern 
pattern) method that passes the LikePattern directly to 
root.subSchemas().getNames(pattern), allowing the schema source to filter at 
the map level rather than post-hoc. This would act in the same way as tables() 
does today.

  was:
Currently, CalciteMetaImpl loads all sub-schemas from 
rootSchema.getSubSchemaMap() and then filters them in-memory via a 
Predicate1<MetaSchema> (the namedMatcher). This is inefficient when the schema 
map is large or lazily-loaded, because every sub-schema must be materialized 
before the LIKE pattern can be applied.

The proposed fix is to add an overloaded schemas(String catalog, LikePattern 
pattern) method that passes the LikePattern directly to 
root.subSchemas().getNames(pattern), allowing the schema source to filter at 
the map level rather than post-hoc.


> Push schema pattern filter into sub-schema map lookup to avoid loading all 
> schemas
> ----------------------------------------------------------------------------------
>
>                 Key: CALCITE-7477
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7477
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Joseph Grogan
>            Priority: Minor
>              Labels: pull-request-available
>
> Currently, CalciteMetaImpl loads all sub-schemas from 
> rootSchema.getSubSchemaMap() and then filters them in-memory via a 
> Predicate1<MetaSchema> (the namedMatcher). This is inefficient when the 
> schema map is large or lazily-loaded, because every sub-schema must be 
> materialized before the LIKE pattern can be applied.
> The proposed fix is to add an overloaded schemas(String catalog, LikePattern 
> pattern) method that passes the LikePattern directly to 
> root.subSchemas().getNames(pattern), allowing the schema source to filter at 
> the map level rather than post-hoc. This would act in the same way as 
> tables() does today.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to