且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL查询针对Apache Ignite缓存返回空结果

更新时间:2022-12-03 12:03:42

这里的问题是您使用创建缓存并将数据插入其中的不同类。
即使这两个类的字段匹配,但它们的完全限定名称是不同的,因此它们是两个不同的类。

The problem here is that you use different classes to create cache and insert data into it. Even though fields of these two classes match, their fully-qualified names are different, so these are two different classes.

如果您希望能够从SQL查询数据,您应该在创建缓存和插入数据的过程中使用同一类。

If you want to be able to query data from SQL, you should use the same class during cache creation and insertion of data.

跳过缓存创建可以解决问题的原因是Spark应用程序创建了缓存本身,而不是使用现有的。因此,当Spark创建它时,将在创建缓存时使用实际对象的类。

The reason why skipping cache creation solves the problem is that Spark app creates a cache itself instead of using an existing one. So, when Spark creates it, the class of the actual objects is used during cache creation.