apache-spark - 是否可以删除 IgniteRDD 的共享缓存中的单个值?
问题描述
是否可以从 Ignite 共享缓存 (IgniteRDD) 中删除特定项目?
例如,在下面的代码中,如何删除唯一的项目 (21, 21)?
val cacheRdd = igniteContext.fromCache("partitioned")
cacheRdd.savePairs(sparkContext.parallelize(1 to 10000, 10).map(i => (i, i)))
IgniteRDD 提供了一个名为clear()
从缓存中删除所有内容的方法。是否有类似删除特定项目的东西?
解决方案
我知道几种方法:
1)使用SQL删除命令
val cacheRdd = igniteContext.fromCache("Person")
val result = cacheRdd.sql(
"DELETE FROM PERSON WHERE ID=1")
2)使用JCache API:
// Creates Ignite context with specific configuration and runs Ignite in the embedded mode.
JavaIgniteContext<Integer, Integer> igniteContext = new JavaIgniteContext<Integer, Integer>(
sparkContext,"examples/config/spark/example-shared-rdd.xml", false);
IgniteCache<Long, Person> personIgniteCache = igniteContext.ignite().getOrCreateCache("Person");
personIgniteCache.remove(1L);
来自scala的相同:
val igniteContext = new IgniteContext(sparkContext, CONFIG, false)
igniteContext.ignite().getOrCreateCache("Person");
您也可以在驱动程序应用程序中启动 Ignite 节点。
BR,安德烈
推荐阅读
- python - IP2Location 记录到 Pandas DataFrame
- javascript - 组件异常:重新渲染过多
- fastapi - 如何在 python dot env 文件中定义列表?
- javascript - 使用循环显示卡引导中的每个 json 数据
- python - 使用 pandas 在同一行中获得 3 年平均值
- database - 跨环境管理多个数据库 ID
- c# - 中断模式下 C# 应用程序中的 XAMLParseException
- sql - 查找 min(records) 和 max(records)
- parallel-processing - 雪花复制到并行 Parquet 文件加载
- c++ - QuickFix C++ 和 SSL:使用 sTunnel 连接到 LMAX 的问题