【发布时间】:2018-03-19 16:06:10
【问题描述】:
我试图更好地理解在 cassandra 中创建表条目时的设计决策选择以及何时选择 blob 类型是一个不错的选择。
我意识到我真的不知道何时选择 blob 作为数据类型,因为我不确定 blob 到底是什么(或首字母缩略词代表什么)。因此,我决定阅读以下有关数据类型 blob 的文档:
http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/blob_r.html
斑点
Cassandra 1.2.3 still supports blobs as string constants for input (to allow smoother transition to blob constant). Blobs as strings are现已弃用,近期将不再支持。如果你 使用字符串作为 blob,更新您的客户端代码以切换到 blob 常数。 Blob 常量是一个十六进制数,定义为 0xX+ 其中 hex 是十六进制字符,例如 [0-9a-fA-F]。例如,0xcafe。
Blob conversion functions A number of functions convert the native types into binary data (blob). For every <native-type> nonblob type supported by CQL3, thetypeAsBlob 函数接受类型类型的参数并将其作为 斑点。相反,blobAsType 函数采用 64 位 blob 参数 并将其转换为 bigint 值。例如,bigintAsBlob(3) 是 0x0000000000000003 和 blobAsBigint(0x0000000000000003) 为 3。
我从中得到的是,它只是一个长的十六进制/二进制。但是,当我将它用作潜在表的列类型以及它与其他类型相比如何更好或更差时,我并不真正欣赏。此外,了解它的一些属性可能是确定 blob 适用于哪些情况的好方法。
【问题讨论】: