我正在尝试
cqlsh:my_keyspace> CREATE FUNCTION IF NOT EXISTS len(input blob)
CALLED ON NULL INPUT
RETURNS int LANGUAGE java AS '
return input.length();';
错误:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Java source compilation failed:
Line 2: The method length() is undefined for the type ByteBuffer
如果我将输入更改为文本,它将正常工作。是否为字节缓冲区类型定义了任何内容?我需要从表中找到Blob列的长度。]
有没有办法用cassandra spark或任何工具找出它?我是Cassandra世界的新手,请为此提供帮助。.
[在幕后,Cassandra将ByteBuffer
Java类型用作其blob
数据类型。此类型没有length
方法,因此您需要使用position
或remaining
来确定缓冲区(depending on what you're doing with it)中有多少数据。