Guys, Right, first option is the way to go. Options 2 and 3 are surrogates that do not free you from concept of cache but rather allow you to obtain one.
I believe in near future we'll propose public API for cacheless queries. - Alex 2018-02-01 19:38 GMT+03:00 Valentin Kulichenko <valentin.kuliche...@gmail.com>: > Nikolay, > > I believe the first option is the way to go. However, I'd also like to hear > from other community members. > > Vladimir, Alex P, can you comment on this? I know we currently don't have > public API to execute DDL statement without having a cache. However, looks > like we use private API of GridQueryProcessor to overcome this in JDBC > drivers and Web Console. We now need a similar solution for data frames > integration, can you confirm that we're moving in the right direction? > > -Val > > On Thu, Feb 1, 2018 at 4:04 AM, Nikolay Izhikov <nizhi...@apache.org> wrote: > >> Hello, guys. >> >> I working on support of saving Spark DataFrame to Ignite [1]. >> >> I want to execute "DROP TABLE XXX" query. >> To execute some SQL query in regulary way one need some cache. >> That cache has to differs from table cache to execute "DROP TABLE" >> successfully. >> >> I founded 3 different ways to execute SQL query without explicit cache >> name. >> Please, tell me which way is right? >> Do we need all 3 way to make a query? >> >> 1. JdbcRequestHandler - [2] >> >> ``` >> >> private final GridKernalContext ctx; >> ... >> List<FieldsQueryCursor<List<?>>> results = >> ctx.query().querySqlFields(qry, >> true, protocolVer.compareTo(VER_2_3_0) < 0); >> >> ``` >> >> 2. GridCacheProcessor - [3] >> >> ``` >> >> /** >> * Gets public cache that can be used for query execution. >> * If cache isn't created on current node it will be started. >> */ >> public IgniteCacheProxy<?, ?> getOrStartPublicCache(boolean start, >> boolean inclLoc) throws IgniteCheckedException { >> >> ``` >> >> 3. QueryCommandHandler - [4] >> >> ``` >> >> protected static final String DFLT_CACHE_NAME = "default"; >> ... >> String cacheName = req.cacheName() == null ? DFLT_CACHE_NAME : >> req.cacheName(); >> >> ``` >> >> >> [1] https://issues.apache.org/jira/browse/IGNITE-7337 >> [2] https://github.com/apache/ignite/blob/master/modules/ >> core/src/main/java/org/apache/ignite/internal/processors/ >> odbc/jdbc/JdbcRequestHandler.java#L310 >> [3] https://github.com/apache/ignite/blob/master/modules/ >> core/src/main/java/org/apache/ignite/internal/processors/ >> cache/GridCacheProcessor.java#L1648 >> [4] https://github.com/apache/ignite/blob/master/modules/ >> core/src/main/java/org/apache/ignite/internal/processors/ >> rest/handlers/query/QueryCommandHandler.java#L318