[java] Is there a way to get the length of the data from bytes at a small system cost?
- Lenguaje dominante
- Java
- Estrellas
- 94
- Forks
- 152
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 11
Descripción
### Describe the usage question you have. Please include as many useful details as possible.
[java] Is there a way to get the length of the data from bytes at a small system cost?
Like the arrow doc example, https://arrow.apache.org/docs/java/ipc.html#writing-and-reading-streaming-format
We generate the arrow data to bytes[] and transfer it.
```
ByteArrayOutputStream out = new ByteArrayOutputStream();
// create VectorSchemaRoot
List fields = Arrays.asList(encodedVector.getField());
List vectors = Arrays.asList(encodedVector);
try (VectorSchemaRoot root = new VectorSchemaRoot(fields, vectors)) {
// write data
ArrowStreamWriter writer = new ArrowStreamWriter(root, provider, Channels.newChannel(out));
writer.start();
writer.writeBatch();
writer.end();
}
// gen arrow data as bytep[]
out.toByteArray()
```
I want to get the data length with a small system load(cpu mem).
Now i using this way to get data lengeh:
```
ByteArrayInputStream input = new ByteArrayInputStream(out.toByteArray());
ReadChannel readChannel = new ReadChannel(Channels.newChannel(input));
MessageMetadataResult messageMeta = MessageSerializer.readMessage(readChannel);
RecordBatch recordBatch =
(RecordBatch) messageMeta.getMessage().header(new RecordBatch());
input.close();
readChannel.close();
// get data length
recordBatch.length()
```
Is there documentation to guide me on what to do? thanks~
### Component(s)
Java
Guía de contribución
Línea de trabajo
Comienza con la documentación de Java IPC enlazada en el issue e inspecciona las API mostradas ArrowStreamWriter, VectorSchemaRoot, MessageSerializer, ReadChannel y RecordBatch. Compara la longitud del byte[] serializado con RecordBatch.length() y determina si se necesita una API existente de bajo overhead o una aclaración en la documentación; se considera terminado cuando el enfoque compatible y su coste están documentados claramente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- data
- Tipo de issue
- Documentación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100