Hi,

I am in the process of trying out the Ignite Cassandra integration feature.
I was able to setup a Java project to launch an ignite node using the
configuration files presented in the Cassandra Integration- Example page (
https://apacheignite.readme.io/docs/examples
<https://apacheignite.readme.io/docs/examples>  ) with a little changes
specific to my environment. One of my caches is configured as following in
order to try POJO persistence strategy:

                
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache3"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
                    <property name="indexedTypes" value="java.lang.Long,
org.apache.ignite.tests.pojos.Person"/>
                    <property name="cacheStoreFactory">
                        <bean
class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean"
value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean"
value="cache3_persistence_settings"/>
                        </bean>
                    </property>
                </bean>

Noted that I have indexedTypes defined in order to run query against this
cache with following codes:

                        IgniteCache<Long, Person> cache3 = 
ignite.cache("cache3");                      

                        SimpleDateFormat ft = new SimpleDateFormat 
("yyyy-MM-dd");                      
                        Person p1 = new Person(1, "Tom", "Zhang", 30, false, 
170, 150,
ft.parse("1970-12-01"), Arrays.asList("123", "234", "456"));
                        Person p2 = new Person(2, "Frank", "Lee", 35, false, 
170, 150,
ft.parse("1978-12-01"), Arrays.asList("123", "234", "456"));
                        Person p3 = new Person(3, "Bob", "Liu", 40, false, 170, 
150,
ft.parse("1976-12-01"), Arrays.asList("123", "234", "456"));

                        cache3.put((long)1, p1);
                        cache3.put((long)2, p2);
                        cache3.put((long)3, p3);
                        
                        //All persons with age greater than 30
                        //=======================================
                        SqlQuery<Long, Person> qry1 =
                                        new SqlQuery<>(Person.class, "select * 
from Person where age > ?");
                
                        qry1.setArgs(30);
                        List<Entry&lt;Long, Person>> res1 = 
cache3.query(qry1).getAll();
                
                        ExamplesUtils.printQueryResults(res1);


Then, I got following exceptions:

Exception in thread "main" javax.cache.CacheException: Failed to parse
query: SELECT "cache3".Person._key, "cache3".Person._val from Person where
age > ?
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1137)
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1043)
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:758)
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:756)
        at
org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1666)
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:756)
        at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:687)
        at 
com.sumumind.ignite_test.igniteCassandra.main(igniteCassandra.java:86)
Caused by: org.h2.jdbc.JdbcSQLException: Column "AGE" not found; SQL
statement:
SELECT "cache3".Person._key, "cache3".Person._val from Person where age > ?
[42122-191]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
        at org.h2.message.DbException.get(DbException.java:179)
        at org.h2.message.DbException.get(DbException.java:155)
        at 
org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:147)
        at org.h2.expression.Comparison.optimize(Comparison.java:178)
        at org.h2.command.dml.Select.prepare(Select.java:855)
        at org.h2.command.Parser.prepareCommand(Parser.java:257)
        at org.h2.engine.Session.prepareLocal(Session.java:560)
        at org.h2.engine.Session.prepareCommand(Session.java:501)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
        at 
org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
        at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:406)
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1121)
        ... 8 more

My question is how to make the cache3 or Person table queryable? Did I do
anything wrong in either the configuration or Java code?

Thanks!

Guang





--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to