写入nebula数据超长

nebula 2.6.1, Spark Connector 2.6.0

对应代码

 val sc = spark.sparkContext
    spark.sql("use ods_xsyx_risk")
    //    val dateTime = "20190718"
    //从hive中读取数据,数据是在hdfs上,hive是个外部表,你也可以用内部表,都有一样
    val df = spark.sql("SELECT store_id, store_code,area_id,area_name,station_code,reserve_bank,status,online_day,first_order_day,is_blacklist" +
      " from dwd_risk_control_nebula_vertex_store ")
    println("打印行数·······")
    df.show(10)
    println("打印结束·······")

    val config = NebulaConnectionConfig
      .builder()
      .withMetaAddress("10.67.0.198:9559")
      .withGraphAddress("10.67.0.198:9669")
      .build()
    val nebulaWriteVertexConfig = WriteNebulaVertexConfig
      .builder()
      .withSpace("gangs_excavate")
      .withTag("store_ven")
      .withVidField("store_id")
      .withVidAsProp(true)
      .withBatch(1000)
      .withWriteMode(WriteMode.UPDATE)
      .build()
    df.write.nebula(config, nebulaWriteVertexConfig).writeVertices()

执行错误

manticError: The maximum number of statements allowed has been exceeded | com.vesoft.nebula.connector.writer.NebulaVertexWriter.submit(NebulaWriter.scala:52)

把 Nebula 版本和 Spark Connector 版本都补充下

nebula 2.6.1, Spark Connector 2.6.0

nebula允许的一次请求中的最大语句数量是512, update模式下多少个batch size就多少个语句。你把batch数改小,小于512。 我们也加一下限制,文档中说明一下 @lzy

2 个赞

update模式支持upsert吗

我现在的需求是,每天会跑一下全量覆盖,用什么方案会更好

覆盖就用insert模式就好

如果想把之前的数据删除,重新插入呢,因为每天要保持最新的快照

先针对之前的数据跑一遍delete模式, 然后再insert。

1 个赞

再问下,2.6.1 用nGQL怎么删除点和边的所有数据
image

https://docs.nebula-graph.com.cn/2.6.1/3.ngql-guide/9.space-statements/1.create-space/#_4

可以用

create space new_space as old_space

这样会创建一个新的 space,里面的 tag 和 edge 是和就的一样的,但是没有数据

2 个赞

如果就想删除原 space 下所有的点和边,暂时我们还不支持。

而且如果数据量大的话,lookup 查出来再 delete 有可能会超时


在控制台查询一直报运行时没有索引是什么原因

因为没有建索引===

你好,如果我想检索一个tag属性做为的索引,找出该索引所在的所有点的另外一个属性的sum值,用什么语句合适呢

这个 sum 是这个 tag 的一个属性吗

是的

match v:tag return v.sum AS Sum

2.6.1 spark 谢nebula 总报 com.vesoft.nebula.client.graph.exception.NotValidConnectionException: No extra connection: Unable to activate objectcom.vesoft.nebula.client.graph.exception.NotValidConnectionException: No extra connection: Unable to activate object这个异常是什么原因

好的,感谢 ,spark 写入nebula总报这个com.vesoft.nebula.client.graph.exception.NotValidConnectionException: No extra connection: Unable to activate object异常,知道是什么原因吗