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

Ignite TC Bot commented on IGNITE-24358:
----------------------------------------

{panel:title=Branch: [pull/11851/head] Base: [master] : No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
{panel:title=Branch: [pull/11851/head] Base: [master] : New Tests 
(1)|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}
{color:#00008b}Calcite SQL{color} [[tests 
1|https://ci2.ignite.apache.org/viewLog.html?buildId=8299088]]
* {color:#013220}IgniteCalciteTestSuite: 
UserDefinedFunctionsIntegrationTest.testSystemFunctionOverriding - PASSED{color}

{panel}
[TeamCity *--> Run :: All* 
Results|https://ci2.ignite.apache.org/viewLog.html?buildId=8299173&buildTypeId=IgniteTests24Java8_RunAll]

> Calcite. User is able to override standard SQL functions.
> ---------------------------------------------------------
>
>                 Key: IGNITE-24358
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24358
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Vladimir Steshin
>            Assignee: Vladimir Steshin
>            Priority: Major
>              Labels: calcite, ignite-2, ise
>             Fix For: 2.18
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> We should not allow user to override standard and systems (Inginte's) SQL 
> fucntions with UDF.
> Reproducer:
> {code:java}
>     public static class OverrideSystemFunctionLibrary {
>         /** Overwrites standard 'UPPER(VARCHAR)'. */
>         @QuerySqlFunction
>         public static int upper(String s) {
>             return F.isEmpty(s) ? 0 : s.length();
>         }
>         /** Overwrites standard 'UNIX_SECONDS(Timestamp)'. */
>         @QuerySqlFunction
>         public static int unix_seconds(Timestamp ts) {
>             return 1;
>         }
>         /** Overwrites Ignite's 'TYPEOF(Object)'. */
>         @QuerySqlFunction
>         public static int typeof(Object o) {
>             return 1;
>         }
>     }
>     /** */
>     @Test
>     public void testOverrideSystemFunction() {
>         assertQuery("SELECT 
> UPPER(?)").withParams("abc").returns("ABC").check();
>         assertQuery("select UNIX_SECONDS(TIMESTAMP '2021-01-01 
> 00:00:00')").returns(1609459200L).check();
>         assertQuery("select 
> TYPEOF(?)").withParams(1L).returns("BIGINT").check();
>         client.getOrCreateCache(new CacheConfiguration<Integer, 
> Employer>("testCache")
>             .setSqlFunctionClasses(OverrideSystemFunctionLibrary.class)
>             .setSqlSchema("PUBLIC")
>             .setQueryEntities(F.asList(new QueryEntity(Integer.class, 
> Employer.class).setTableName("emp")))
>         );
>         // Fails with 'Expected: [[ABC]], Actual:   [[3]]'
>         assertQuery("SELECT 
> UPPER(?)").withParams("abc").returns("ABC").check();
>         // Fails with 'Expected: [[1609459200]], Actual:   [[1]]'
>         assertQuery("select UNIX_SECONDS(TIMESTAMP '2021-01-01 
> 00:00:00')").returns(1609459200L).check();
>         // Fails with 'Expected: [[BIGINT]], Actual:   [[1]]' or even with 
> other assertion with '-ea'.
>         assertQuery("select 
> TYPEOF(?)").withParams(1L).returns("BIGINT").check();
>     }
> {code}



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

Reply via email to