I have a few comments for the code you provided:
- Since in DataContainer is a case class, you need to annotate fields as
@(QuerySqlField @field) to make the value visible for indexing.
Alternatively, you can use the @ScalarCacheQuerySqlField annotation from the
ignite-scalar module (you will need to add the corresponding dependency). We
will try to add a check to detect this case and print a proper warning.
- The actual key type of the key that is put to the Ignite is
java.lang.Integer, so the setIndexedTypes() call should look like this:
ccfg.setIndexedTypes(classOf[Integer], classOf[DataContainer]) I will need
to check if we can also automatically detect and correct such cases.
- Not sure why you used DATACONTAINER_ table name (with the underscore at
the end of the name). For me the table name was DATACONTAINER, as expected
- Finally, the foreach() is executed on the remote spark executor because
the DataFrame is a remote data structure. I used collect to make the output
be printed on the driver: cacheRdd.sql("select * from
C2.DATACONTAINER").collect().foreach(row => println(row.toString()))
After these corrections your code worked fine for me. Can you try this and
check if it works for you?
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/SQL-access-via-Spark-does-not-work-tp1279p1305.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.