Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
741bbf6
bump `tonic` to 0.12 and `prost` to 0.13 for `arrow-flight` (#6041)
BugenZhao Jul 16, 2024
8f76248
Remove `impl<T: AsRef<[u8]>> From<T> for Buffer` that easily acciden…
XiangpengHao Jul 16, 2024
bb5f12b
Make display of interval types more pretty (#6006)
Rachelint Jul 16, 2024
756b1fb
Update snafu (#5930)
Jesse-Bakker Jul 16, 2024
fe04e09
Update Parquet thrift generated structures (#6045)
etseidl Jul 16, 2024
2e7f7ef
Revert "Revert "Write Bloom filters between row groups instead of the…
alamb Jul 16, 2024
effccc1
Revert "Update snafu (#5930)" (#6069)
alamb Jul 16, 2024
649d09d
Update pyo3 requirement from 0.21.1 to 0.22.1 (fixed) (#6075)
crepererum Jul 17, 2024
05e681d
remove repeated codes to make the codes more concise. (#6080)
Rachelint Jul 18, 2024
e40b311
Add `unencoded_byte_array_data_bytes` to `ParquetMetaData` (#6068)
etseidl Jul 19, 2024
81c34ac
Update pyo3 requirement from 0.21.1 to 0.22.2 (#6085)
dependabot[bot] Jul 23, 2024
3bc9987
Deprecate read_page_locations() and simplify offset index in `Parquet…
etseidl Jul 23, 2024
20e11ec
no longer write inline column metadata
etseidl Jul 25, 2024
095130f
Merge remote-tracking branch 'apache/master' into 53.0.0-dev
alamb Jul 25, 2024
a6353d1
Update parquet/src/column/writer/mod.rs
alamb Jul 25, 2024
d122b1f
Merge remote-tracking branch 'origin/53.0.0-dev' into no_column_meta
etseidl Jul 25, 2024
957499d
suggestion from review
etseidl Jul 26, 2024
a033e43
add some more documentation
etseidl Jul 26, 2024
571ce65
Merge remote-tracking branch 'origin/master' into no_column_meta
etseidl Jul 26, 2024
07f9a1d
Merge remote-tracking branch 'origin/master' into no_column_meta
etseidl Jul 26, 2024
444b14f
remove write_metadata from PageWriter
etseidl Jul 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove repeated codes to make the codes more concise. (#6080)
  • Loading branch information
Rachelint authored Jul 18, 2024
commit 05e681d7669acc0f91facf621a98c00f3d985c71
121 changes: 40 additions & 81 deletions arrow-cast/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,17 @@ impl<'a> DisplayIndex for &'a PrimitiveArray<IntervalYearMonthType> {
impl<'a> DisplayIndex for &'a PrimitiveArray<IntervalDayTimeType> {
fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult {
let value = self.value(idx);
let mut first_part = true;
let mut prefix = "";

if value.days != 0 {
write!(f, "{} days", value.days)?;
first_part = false;
write!(f, "{prefix}{} days", value.days)?;
prefix = " ";
}

if value.milliseconds != 0 {
let millis_fmt = MillisecondsFormatter {
milliseconds: value.milliseconds,
first_part,
prefix,
};

f.write_fmt(format_args!("{millis_fmt}"))?;
Expand All @@ -685,26 +685,22 @@ impl<'a> DisplayIndex for &'a PrimitiveArray<IntervalDayTimeType> {
impl<'a> DisplayIndex for &'a PrimitiveArray<IntervalMonthDayNanoType> {
fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult {
let value = self.value(idx);
let mut first_part = true;
let mut prefix = "";

if value.months != 0 {
write!(f, "{} mons", value.months)?;
first_part = false;
write!(f, "{prefix}{} mons", value.months)?;
prefix = " ";
}

if value.days != 0 {
if first_part {
write!(f, "{} days", value.days)?;
first_part = false;
} else {
write!(f, " {} days", value.days)?;
}
write!(f, "{prefix}{} days", value.days)?;
prefix = " ";
}

if value.nanoseconds != 0 {
let nano_fmt = NanosecondsFormatter {
nanoseconds: value.nanoseconds,
first_part,
prefix,
};
f.write_fmt(format_args!("{nano_fmt}"))?;
}
Expand All @@ -713,14 +709,14 @@ impl<'a> DisplayIndex for &'a PrimitiveArray<IntervalMonthDayNanoType> {
}
}

struct NanosecondsFormatter {
struct NanosecondsFormatter<'a> {
nanoseconds: i64,
first_part: bool,
prefix: &'a str,
}

impl Display for NanosecondsFormatter {
impl<'a> Display for NanosecondsFormatter<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut first_part = self.first_part;
let mut prefix = self.prefix;

let secs = self.nanoseconds / 1_000_000_000;
let mins = secs / 60;
Expand All @@ -732,57 +728,38 @@ impl Display for NanosecondsFormatter {
let nanoseconds = self.nanoseconds % 1_000_000_000;

if hours != 0 {
if first_part {
write!(f, "{} hours", hours)?;
first_part = false;
} else {
write!(f, " {} hours", hours)?;
}
write!(f, "{prefix}{} hours", hours)?;
prefix = " ";
}

if mins != 0 {
if first_part {
write!(f, "{} mins", mins)?;
first_part = false;
} else {
write!(f, " {} mins", mins)?;
}
write!(f, "{prefix}{} mins", mins)?;
prefix = " ";
}

if secs != 0 || nanoseconds != 0 {
let secs_sign = if secs < 0 || nanoseconds < 0 { "-" } else { "" };

if first_part {
write!(
f,
"{}{}.{:09} secs",
secs_sign,
secs.abs(),
nanoseconds.abs()
)?;
} else {
write!(
f,
" {}{}.{:09} secs",
secs_sign,
secs.abs(),
nanoseconds.abs()
)?;
}
write!(
f,
"{prefix}{}{}.{:09} secs",
secs_sign,
secs.abs(),
nanoseconds.abs()
)?;
}

Ok(())
}
}

struct MillisecondsFormatter {
struct MillisecondsFormatter<'a> {
milliseconds: i32,
first_part: bool,
prefix: &'a str,
}

impl Display for MillisecondsFormatter {
impl<'a> Display for MillisecondsFormatter<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut first_part = self.first_part;
let mut prefix = self.prefix;

let secs = self.milliseconds / 1_000;
let mins = secs / 60;
Expand All @@ -794,21 +771,13 @@ impl Display for MillisecondsFormatter {
let milliseconds = self.milliseconds % 1_000;

if hours != 0 {
if first_part {
write!(f, "{} hours", hours,)?;
first_part = false;
} else {
write!(f, " {} hours", hours,)?;
}
write!(f, "{prefix}{} hours", hours,)?;
prefix = " ";
}

if mins != 0 {
if first_part {
write!(f, "{} mins", mins,)?;
first_part = false;
} else {
write!(f, " {} mins", mins,)?;
}
write!(f, "{prefix}{} mins", mins,)?;
prefix = " ";
}

if secs != 0 || milliseconds != 0 {
Expand All @@ -818,23 +787,13 @@ impl Display for MillisecondsFormatter {
""
};

if first_part {
write!(
f,
"{}{}.{:03} secs",
secs_sign,
secs.abs(),
milliseconds.abs()
)?;
} else {
write!(
f,
" {}{}.{:03} secs",
secs_sign,
secs.abs(),
milliseconds.abs()
)?;
}
write!(
f,
"{prefix}{}{}.{:03} secs",
secs_sign,
secs.abs(),
milliseconds.abs()
)?;
}

Ok(())
Expand Down