使用 cqlsh 复制非常大的 cassandra 表时出现 PicklingError

2023-11-24

当我尝试使用以下命令将表复制到 cassandra 时:

copy images from 'images.csv'

我收到错误:

'PicklingError: Can't pickle <class 'cqlshlib.copyutil.ImmutableDict'>: attribute lookup cqlshlib.copyutil.ImmutableDict failed'

我已成功导入所有其他表,但这个表不起作用。与此唯一的区别是它包含图像的大型二进制 blob。

以下是 csv 文件中的示例行:

b267ba01-5420-4be5-b962-7e563dc245b0,,0x89504e...[large binary blob]...426082,0,7e700538-cce3-495f-bfd2-6a4fa968bdf6,pentium_e6600,01fa819e-3425-47ca-82aa-a3eec319a998,0,7e700538-cce3-495f-bfd2-6a4fa968bdf6,,,png,0

这是导致错误的文件:https://www.dropbox.com/s/5mrl6nuwelpf3lz/images.csv?dl=0

这是我的架构:

CREATE TABLE dealtech.images (
    id uuid PRIMARY KEY,
    attributes map<text, text>,
    data blob,
    height int,
    item_id uuid,
    name text,
    product_id uuid,
    scale double,
    seller_id uuid,
    text_bottom int,
    text_top int,
    type text,
    width int
)

这些表是使用导出的cassandra 2.x我目前正在使用cassandra 3.0.9导入它们。


我在 apache cassandra 3.9 中遇到了同样的问题,尽管我的数据集相当小(一个表中有 46 行,另一个表中有 262 行)。

PicklingError: Can't pickle <class 'cqlshlib.copyutil.link'>: attribute lookup cqlshlib.copyutil.link failed

PicklingError: Can't pickle <class 'cqlshlib.copyutil.attribute'>: attribute lookup cqlshlib.copyutil.attribute failed

Where link and attribute是我定义的类型。

COPY 命令是 .cql 脚本的一部分,该脚本作为其设置过程的一部分在 Docker 容器内运行。

我在一些地方看到人们在 Windows 上看到这个 PicklingError(似乎与 NTFS 有关),但本例中的 Docker 容器使用的是 Alpine Linux。

解决方法是将这些选项添加到我的 COPY 命令的末尾:

WITH MINBATCHSIZE=1 AND MAXBATCHSIZE=1 AND PAGESIZE=10;

http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlshCopy.html

我没有看到 PicklingError 在本地运行这些包含 COPY 命令的 .cql 脚本,因此这似乎是一个仅在内存不足的情况下出现的问题。

相关问题:

  • 在 Windows 上运行 COPY 命令时发生酸洗错误:CQLShell
  • Cassandra 多处理无法 pickle _thread.lock 对象
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 cqlsh 复制非常大的 cassandra 表时出现 PicklingError 的相关文章

随机推荐