parquet 0.2.12-arm64-darwin → 0.3.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +5 -3
- data/README.md +1 -1
- data/Rakefile +16 -0
- data/lib/parquet/3.2/parquet.bundle +0 -0
- data/lib/parquet/3.3/parquet.bundle +0 -0
- data/lib/parquet/3.4/parquet.bundle +0 -0
- data/lib/parquet/version.rb +1 -1
- data/lib/parquet.rb +6 -1
- metadata +14 -45
- data/Cargo.lock +0 -1449
- data/Cargo.toml +0 -3
- data/ext/parquet/Cargo.toml +0 -28
- data/ext/parquet/extconf.rb +0 -4
- data/ext/parquet/src/allocator.rs +0 -13
- data/ext/parquet/src/enumerator.rs +0 -52
- data/ext/parquet/src/header_cache.rs +0 -100
- data/ext/parquet/src/lib.rs +0 -29
- data/ext/parquet/src/reader/mod.rs +0 -44
- data/ext/parquet/src/reader/parquet_column_reader.rs +0 -214
- data/ext/parquet/src/reader/parquet_row_reader.rs +0 -157
- data/ext/parquet/src/ruby_integration.rs +0 -77
- data/ext/parquet/src/ruby_reader.rs +0 -171
- data/ext/parquet/src/types/core_types.rs +0 -75
- data/ext/parquet/src/types/mod.rs +0 -30
- data/ext/parquet/src/types/parquet_value.rs +0 -462
- data/ext/parquet/src/types/record_types.rs +0 -204
- data/ext/parquet/src/types/timestamp.rs +0 -85
- data/ext/parquet/src/types/type_conversion.rs +0 -809
- data/ext/parquet/src/types/writer_types.rs +0 -283
- data/ext/parquet/src/utils.rs +0 -148
- data/ext/parquet/src/writer/mod.rs +0 -575
@@ -1,85 +0,0 @@
|
|
1
|
-
use super::*;
|
2
|
-
|
3
|
-
pub fn parse_zoned_timestamp(value: &ParquetValue) -> jiff::Timestamp {
|
4
|
-
let (ts, tz) = match value {
|
5
|
-
ParquetValue::TimestampSecond(ts, tz) => (jiff::Timestamp::from_second(*ts).unwrap(), tz),
|
6
|
-
ParquetValue::TimestampMillis(ts, tz) => {
|
7
|
-
(jiff::Timestamp::from_millisecond(*ts).unwrap(), tz)
|
8
|
-
}
|
9
|
-
ParquetValue::TimestampMicros(ts, tz) => {
|
10
|
-
(jiff::Timestamp::from_microsecond(*ts).unwrap(), tz)
|
11
|
-
}
|
12
|
-
ParquetValue::TimestampNanos(ts, tz) => {
|
13
|
-
(jiff::Timestamp::from_nanosecond(*ts as i128).unwrap(), tz)
|
14
|
-
}
|
15
|
-
_ => panic!("Invalid timestamp value"),
|
16
|
-
};
|
17
|
-
|
18
|
-
// If timezone is provided, convert to zoned timestamp
|
19
|
-
if let Some(tz) = tz {
|
20
|
-
// Handle fixed offset timezones like "+09:00" first
|
21
|
-
if tz.starts_with('+') || tz.starts_with('-') {
|
22
|
-
// Parse the offset string into hours and minutes
|
23
|
-
let (hours, minutes) = if tz.len() >= 5 && tz.contains(':') {
|
24
|
-
// Format: "+09:00" or "-09:00"
|
25
|
-
let h = tz[1..3].parse::<i32>().unwrap_or(0);
|
26
|
-
let m = tz[4..6].parse::<i32>().unwrap_or(0);
|
27
|
-
(h, m)
|
28
|
-
} else if tz.len() >= 3 {
|
29
|
-
// Format: "+09" or "-09"
|
30
|
-
let h = tz[1..3].parse::<i32>().unwrap_or(0);
|
31
|
-
(h, 0)
|
32
|
-
} else {
|
33
|
-
(0, 0)
|
34
|
-
};
|
35
|
-
|
36
|
-
// Apply sign
|
37
|
-
let total_minutes = if tz.starts_with('-') {
|
38
|
-
-(hours * 60 + minutes)
|
39
|
-
} else {
|
40
|
-
hours * 60 + minutes
|
41
|
-
};
|
42
|
-
|
43
|
-
// Create fixed timezone
|
44
|
-
let tz = jiff::tz::TimeZone::fixed(jiff::tz::offset((total_minutes / 60) as i8));
|
45
|
-
ts.to_zoned(tz).timestamp()
|
46
|
-
} else {
|
47
|
-
// Try IANA timezone
|
48
|
-
match ts.intz(&tz) {
|
49
|
-
Ok(zoned) => zoned.timestamp(),
|
50
|
-
Err(_) => ts, // Fall back to UTC if timezone is invalid
|
51
|
-
}
|
52
|
-
}
|
53
|
-
} else {
|
54
|
-
// No timezone provided - treat as UTC
|
55
|
-
ts
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
// Macro for handling timestamp conversions
|
60
|
-
#[macro_export]
|
61
|
-
macro_rules! impl_timestamp_conversion {
|
62
|
-
($value:expr, $unit:ident, $handle:expr) => {{
|
63
|
-
match $value {
|
64
|
-
ParquetValue::$unit(ts, tz) => {
|
65
|
-
let ts = parse_zoned_timestamp(&ParquetValue::$unit(ts, tz));
|
66
|
-
let time_class = $handle.class_time();
|
67
|
-
time_class
|
68
|
-
.funcall::<_, _, Value>("parse", (ts.to_string(),))
|
69
|
-
.unwrap()
|
70
|
-
.into_value_with($handle)
|
71
|
-
}
|
72
|
-
_ => panic!("Invalid timestamp type"),
|
73
|
-
}
|
74
|
-
}};
|
75
|
-
}
|
76
|
-
|
77
|
-
// Macro for handling date conversions
|
78
|
-
#[macro_export]
|
79
|
-
macro_rules! impl_date_conversion {
|
80
|
-
($value:expr, $handle:expr) => {{
|
81
|
-
let ts = jiff::Timestamp::from_second(($value as i64) * 86400).unwrap();
|
82
|
-
let formatted = ts.strftime("%Y-%m-%d").to_string();
|
83
|
-
formatted.into_value_with($handle)
|
84
|
-
}};
|
85
|
-
}
|