apache / apache/arrow-java

[C++][Java] When i use DatasetFileWriter::write method write a file, I can't specify a file name

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

説明

### Describe the usage question you have. Please include as many useful details as possible.

I use this static method to write a parquet file into fs, I give empty partition array, so it will be in a file; and i give the `baseNameTemplate` arg is "test.parquet" to specify the filename, but it leads to an error: `basename_template did not contain '{i}'`.
```java
public static void write(BufferAllocator allocator, ArrowReader reader, FileFormat format, String uri,
String[] partitionColumns, int maxPartitions, String baseNameTemplate) {
try (final ArrowArrayStream stream = ArrowArrayStream.allocateNew(allocator)) {
Data.exportArrayStream(allocator, reader, stream);
JniWrapper.get().writeFromScannerToFile(stream.memoryAddress(),
format.id(), uri, partitionColumns, maxPartitions, baseNameTemplate);
}
}
```
read the cpp jni code and cpp dataset's code, the FileSystemDatasetWriteOptions::basename_template seems not supported to specify the file name without `{i}`.
```cpp
/// \brief Options for writing a dataset.
struct ARROW_DS_EXPORT FileSystemDatasetWriteOptions {
.
.
.
/// Template string used to generate fragment basenames.
/// {i} will be replaced by an auto incremented integer.
std::string basename_template;
.
.
.
}
```
If there is any method to specify the filename when none partition?

### Component(s)

Java

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

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

調査の方向性

Java DatasetFileWriter::write と writeFromScannerToFile への JNI 呼び出しから始め、次に C++ FileSystemDatasetWriteOptions::basename_template を調べます。非パーティション書き込みで {i} のない正確なファイル名を受け入れられるかを判断します。対応している動作が確立され、Java/C++ パスがそのケースを処理するか、明確に文書化していれば完了です。

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

評価

技術スタック
cpp, java
領域
data-engineering
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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