问题描述
我在spec:
initContainers:
- name: chown
image: docker.io/library/busyBox:latest
command:
- chown
- -R
- whatever-the-uid-is-for-your-tomcat-image
- /usr/local/tomcat/webapps/ROOT
volumeMounts:
- mountPath: /usr/local/tomcat/webapps/ROOT
name: tomcat
containers:
# ... as before
中有一个ListVector
和一个值[[1,2,3,4,5]]
,在IDEA中可以看到它的值。
我使用以下代码编写VectorSchemaRoot
变量并获取字节数组
VectorSchemaRoot
然后读回
val out = new ByteArrayOutputStream()
val writer = new ArrowStreamWriter(vectorSchemaRoot,null,out)
writer.start()
writer.writeBatch()
writer.end()
out.close()
val byteArr = out.toByteArray
架构正确,但列表为空 val allocator = new RootAllocator(Int.MaxValue)
val reader = new ArrowStreamReader(new ByteArrayInputStream(byteArr),allocator)
while (reader.loadNextBatch()) {
val schemaRoot = reader.getVectorSchemaRoot
schemaRoot
}
但是,我使用其他类型的值,例如char,bit,从[]
读取的结果是正确的(非空)。
如何解决byteArr
空问题?
解决方法
最后我只使用了基础类。
StructVector,ListVector
是复杂的类,根据我的测试,与仅使用基本类相比,它们不会带来速度或内存方面的好处。而且复杂类的文档很少。
因此,建议您使用基本类。只需使用“字段列表”制作它们的架构,就可以得到结构化矢量。