apache / apache/arrow-java

[java] Is there a way to get the length of the data from bytes at a small system cost?

オープン
#138 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Issue にリンクされている Java IPC ドキュメントから始め、そこで示されている ArrowStreamWriter、VectorSchemaRoot、MessageSerializer、ReadChannel、RecordBatch API を調べてください。シリアライズされた byte[] の長さを RecordBatch.length() と比較し、既存の低オーバーヘッド API が必要なのか、ドキュメントの明確化が必要なのかを判断してください。完了の条件は、サポートされているアプローチとそのコストが明確に文書化されていることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
data
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。