[ 
https://issues.apache.org/jira/browse/CALCITE-2960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16804519#comment-16804519
 ] 

Lai Zhou edited comment on CALCITE-2960 at 3/29/19 1:59 AM:
------------------------------------------------------------

[~danny0405], it is really a part of issue 2928. 

In my case ,I use the FrameworkConfig to create a sql planner,the config is 
like:
{code:java}
Frameworks
    .newConfigBuilder()
    .defaultSchema(rootSchema)
    .parserConfig(sqlParserConfig)
    .operatorTable(sqlOperatorTable)
    .context(Contexts.of(calciteConnectionConfig))
    .build();
{code}
User-defined functions will be  added into the rootSchema ,  and a  
CalciteCatalogReader will be created based on this rootSchema.
{code:java}
new CalciteCatalogReader( CalciteSchema.from(rootSchema), 
CalciteSchema.from(rootSchema).path(null), new JavaTypeFactoryImpl(typeSystem), 
calciteConnectionConfig);
{code}
Then the FrameworkConfig will add the  CalciteCatalogReader to it's 
ChainedSqlOperatorTable.
{code:java}
createFrameworkConfig(sqlParserConfig,
    ChainedSqlOperatorTable.of(sqlStdOperatorTable,
        calciteCatalogReader), calciteConnectionConfig);
{code}
So in the runtime , the sql planner will  look up operators from the 
CalciteCatalogReader .

 

 

 

 


was (Author: hhlai1990):
[~danny0405], it is really a part of issue 2928. 

In my case ,I use the FrameworkConfig to create a sql planner,the config is 
like:
{code:java}
Frameworks
    .newConfigBuilder()
    .defaultSchema(rootSchema)
    .parserConfig(sqlParserConfig)
    .operatorTable(sqlStdOperatorTable)
    .context(Contexts.of(calciteConnectionConfig))
    .build();
{code}
User-defined functions will be  added into the rootSchema ,  and a  
CalciteCatalogReader will be created based on this rootSchema.
{code:java}
new CalciteCatalogReader( CalciteSchema.from(rootSchema), 
CalciteSchema.from(rootSchema).path(null), new JavaTypeFactoryImpl(typeSystem), 
calciteConnectionConfig);
{code}
Then the FrameworkConfig will add the  CalciteCatalogReader to it's 
ChainedSqlOperatorTable.
{code:java}
createFrameworkConfig(sqlParserConfig,
    ChainedSqlOperatorTable.of(sqlStdOperatorTable,
        calciteCatalogReader), calciteConnectionConfig);
{code}
So in the runtime , the sql planner will  look up operators from the 
CalciteCatalogReader .

 

 

 

 

> CalciteCatalogReader use a hard-coding config to get functions
> --------------------------------------------------------------
>
>                 Key: CALCITE-2960
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2960
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.18.0
>            Reporter: Lai Zhou
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> CalciteCatalogReader use a hard-coding config to get functions
> {code:java}
> functions2.addAll(schema.getFunctions(name, true));
> {code}
> the right way is:
> {code:java}
> functions2.addAll(schema.getFunctions(name, config.caseSensitive()));
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to