ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilya Kasnacheev <ilya.kasnach...@gmail.com>
Subject Re: ignite.net custom sql functions
Date Thu, 28 Feb 2019 11:57:35 GMT
Hello!

It does not seem that you define any tables for this cache, but

0: jdbc:ignite:thin://localhost> SELECT "wayne".square(4);
+--------------------------------+
|       "wayne".SQUARE(4)        |
+--------------------------------+
| 16                             |
+--------------------------------+
1 row selected (0,096 seconds)

seems to work for me! Note the quotes since cache names/schemas are case
sensitive.

Regards,
-- 
Ilya Kasnacheev


чт, 28 февр. 2019 г. в 14:49, wt <waynetheron@gmail.com>:

> I don't know why i didn't think of that - superb thanks Ilya.
>
> Are you certain the function needs to be in libs\home - It can't seem to
> find the function and i would have expected to at least see something in
> the
> log about loading it.
>
> ENV setup
>
> system variable  IGNITE_HOME = c:\Ignite_2.7
>
> test function code (no FQDN namespace it is just a class at the root):
>
> /public class testfunc {
>
>     @QuerySqlFunction
>     public static int square(int x) {
>         return x * x;
>     }
> }/
>
> I copied the jar file to c:\Ignite_2.7\libs (at the root of that folder)
>
> XML config section
>
>
>  <property name="cacheConfiguration">
>                           <list>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="wayne"/>
>                     <property name="atomicityMode" value="ATOMIC"/>
>                     <property name="backups" value="1"/>
>                                         <property
> name="sqlFunctionClasses">
>                                                 <list>
>
>
> <value>testfunc</value>
>                                                 </list>
>
>                                         </property>
>                 </bean>
>             </list>
>          </property>
>
> I have no data in the cache but if i try run the following from dbbeaver i
> get an error:
>
> SELECT square(10) FROM WAYNE.WAYNE
>
> here is the error and note it is trying to access the public schema.
>
> /11:41:11,859][SEVERE][client-connector-#63][JdbcRequestHandler] Failed to
> execu
> e SQL query [reqId=0, req=JdbcQueryExecuteRequest [schemaName=PUBLIC,
> pageSize=
> 024, maxRows=200, sqlQry=SELECT square(10) FROM WAYNE.WAYNE, args=Object[]
> [],
> tmtType=ANY_STATEMENT_TYPE, autoCommit=true]]
> lass org.apache.ignite.internal.processors.query.IgniteSQLException: Failed
> to
> arse query. Function "SQUARE" not found; SQL statement:/
>
>
> So i created a basic table in public called tes and tried to run this
>
> SELECT wayne.square(10)  FROM tes
>
> Same issue  - function not found
>
> I then tried this
>
> SELECT wayne.wayne.square(10)  FROM tes
>
> and it states database is not found.
>
> Seems to me like the jar file is not being loaded.
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Mime
View raw message