Skip to content

Commit 111d659

Browse files
authored
fix(query): stick the created_by infos in parquet writer (#17220)
* fix(query): stick the created_by infos in parquet writer * fix(query): stick the created_by infos in parquet writer * fix(query): stick the created_by infos in parquet writer * fix(query): stick the created_by infos in parquet writer * fix(query): stick the created_by infos in parquet writer
1 parent 2a6c198 commit 111d659

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/query/storages/stage/src/append/parquet_file/writer_processor.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,35 @@ pub struct ParquetFileWriter {
7171
const MAX_BUFFER_SIZE: usize = 64 * 1024 * 1024;
7272
// this is number of rows, not size
7373
const MAX_ROW_GROUP_SIZE: usize = 1024 * 1024;
74+
const CREATE_BY_LEN: usize = 24; // "Databend 1.2.333-nightly".len();
7475

7576
fn create_writer(
7677
arrow_schema: Arc<Schema>,
7778
targe_file_size: Option<usize>,
7879
) -> Result<ArrowWriter<Vec<u8>>> {
80+
// example: 1.2.333-nightly
81+
// tags may contain other items like `1.2.680-p2`, we will fill it with `1.2.680-p2.....`
82+
let mut create_by = format!(
83+
"Databend {}.{}.{}-{:.<7}",
84+
DATABEND_SEMVER.major,
85+
DATABEND_SEMVER.minor,
86+
DATABEND_SEMVER.patch,
87+
DATABEND_SEMVER.pre.as_str()
88+
);
89+
90+
if create_by.len() != CREATE_BY_LEN {
91+
create_by = format!("{:.<24}", create_by);
92+
create_by.truncate(24);
93+
}
94+
7995
let props = WriterProperties::builder()
8096
.set_compression(TableCompression::Zstd.into())
8197
.set_max_row_group_size(MAX_ROW_GROUP_SIZE)
8298
.set_encoding(Encoding::PLAIN)
8399
.set_dictionary_enabled(false)
84100
.set_statistics_enabled(EnabledStatistics::Chunk)
85101
.set_bloom_filter_enabled(false)
86-
.set_created_by(format!("Databend {}", *DATABEND_SEMVER))
102+
.set_created_by(create_by)
87103
.build();
88104
let buf_size = match targe_file_size {
89105
Some(n) if n < MAX_BUFFER_SIZE => n,

0 commit comments

Comments
 (0)