apache / incubator-hugegraph-toolchain

HugeGraph toolchain - include a series useful graph modules
https://hugegraph.apache.org/
Apache License 2.0
88 stars 92 forks source link

[Bug] MySQL 后端导入自带的测试 NULL 数据报转换错误 #435

Open kanppa opened 1 year ago

kanppa commented 1 year ago

Bug Type (问题类型)

exception / error (异常报错)

Before submit

Environment (环境信息)

Expected & Actual behavior (期望与实际表现)

使用的是hugegraph-loader 下面static/example/mysql 的配置导入的 第6个person tom 的数据 age通过mysql reader读进去是 NULL_STR = "NULL"

会触发异常 java.lang.IllegalArgumentException: Failed to convert value(key=age) 'NULL'(class java.lang.String) to Number

Vertex/Edge example (问题点 / 边数据举例)

(1,'marko',29,'Beijing'),(2,'vadas',27,'HongKong'),(3,'josh',32,'Beijing'),(4,'peter',35,'Shanghai'),(5,'li,nary',26,'Wu,han'),(6,'tom',NULL,NULL)

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

{
  "vertices": [
    {
      "label": "person",
      "input": {
        "type": "jdbc",
        "vendor": "mysql",
        "driver": "com.mysql.cj.jdbc.Driver",
        "url": "jdbc:mysql://127.0.0.1:3306",
        "database": "example",
        "table": "person",
        "username": "root",
        "password": "",
        "batch_size": 500
      },
      "id": "id",
      "null_values": ["NULL"]
    },
    {
      "label": "software",
      "input": {
        "type": "jdbc",
        "vendor": "mysql",
        "driver": "com.mysql.cj.jdbc.Driver",
        "url": "jdbc:mysql://127.0.0.1:3306",
        "database": "example",
        "table": "software",
        "username": "root",
        "password": "",
        "batch_size": 500
      },
      "id": "id"
    }
  ],
  "edges": [
    {
      "label": "knows",
      "source": ["source_id"],
      "target": ["target_id"],
      "input": {
        "type": "jdbc",
        "vendor": "mysql",
        "driver": "com.mysql.cj.jdbc.Driver",
        "url": "jdbc:mysql://127.0.0.1:3306",
        "database": "example",
        "table": "knows",
        "username": "root",
        "password": "",
        "batch_size": 500
      },
      "ignored": ["id"]
    },
    {
      "label": "created",
      "source": ["source_id"],
      "target": ["target_id"],
      "input": {
        "type": "jdbc",
        "vendor": "mysql",
        "driver": "com.mysql.cj.jdbc.Driver",
        "url": "jdbc:mysql://127.0.0.1:3306",
        "database": "example",
        "table": "created",
        "username": "root",
        "password": "",
        "batch_size": 500
      },
      "ignored": ["id"]
    }
  ]
}
kanppa commented 1 year ago

testFillMissingColumnWithEmpy里面从空字符串转成Int似乎也会有问题?

imbajin commented 1 year ago

null 的 NPE 问题

尝试把测试数据中的 (6,'tom',NULL,NULL) -> (6,'tom',"NULL","NULL") 是否可以正常导入? (或者是去掉这两个值)

testFillMissingColumnWithEmpy里面从空字符串转成Int似乎也会有问题?

这个具体的例子是什么, 可以把报错信息和复现数据也贴一下, @z7658329 可以尝试 MySQL 下确认?