parquet 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794d11142b73d13b665ecdb4ffd46df6ab7d97e5f99336e2bc91b79dbb55a514
|
4
|
+
data.tar.gz: eb2843d724e7aad70445a8b992a527e3bee0a79055fdeab7f2ebd2cdfb6247d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b97550fb18f2ab4db0b5fbb170d12448237665d9372242d4027760f1c697be0d1e7a8bb47d43886f704e0923ddf57544961fe5af29c596b49aac188f714b9e6
|
7
|
+
data.tar.gz: 1ea56a23e39a084d40690d4e7bd108ec2a4cb20b61714bd564e68600d3f3edda3ffd5c3e646d49d4bb85632ad14f2c7d5735e645610e7a863d9e25d6f1d2b90d
|
@@ -157,6 +157,10 @@ impl IntoValue for ParquetValue {
|
|
157
157
|
|
158
158
|
impl ParquetValue {
|
159
159
|
pub fn from_value(value: Value, type_: &ParquetSchemaType) -> Result<Self, MagnusError> {
|
160
|
+
if value.is_nil() {
|
161
|
+
return Ok(ParquetValue::Null);
|
162
|
+
}
|
163
|
+
|
160
164
|
match type_ {
|
161
165
|
ParquetSchemaType::Int8 => {
|
162
166
|
let v = NumericConverter::<i8>::convert_with_string_fallback(value)?;
|
@@ -592,12 +592,12 @@ pub fn convert_parquet_values_to_arrow(
|
|
592
592
|
};
|
593
593
|
|
594
594
|
let mut list_builder = ListBuilder::new(value_builder);
|
595
|
+
|
595
596
|
for value in values {
|
596
597
|
match value {
|
597
598
|
ParquetValue::List(items) => {
|
598
|
-
list_builder.append(true);
|
599
599
|
for item in items {
|
600
|
-
match list_field.item_type {
|
600
|
+
match &list_field.item_type {
|
601
601
|
ParquetSchemaType::Int8 => append_list_value_copy!(
|
602
602
|
list_builder,
|
603
603
|
ParquetSchemaType::Int8,
|
@@ -185,6 +185,11 @@ impl ColumnCollector {
|
|
185
185
|
NumericConverter,
|
186
186
|
};
|
187
187
|
|
188
|
+
if value.is_nil() {
|
189
|
+
self.values.push(ParquetValue::Null);
|
190
|
+
return Ok(());
|
191
|
+
}
|
192
|
+
|
188
193
|
let parquet_value = match &self.type_ {
|
189
194
|
ParquetSchemaType::Int8 => {
|
190
195
|
let v = NumericConverter::<i8>::convert_with_string_fallback(value)?;
|
data/ext/parquet/src/utils.rs
CHANGED
@@ -39,7 +39,7 @@ pub fn parse_parquet_rows_args(ruby: &Ruby, args: &[Value]) -> Result<ParquetRow
|
|
39
39
|
let parsed_args = scan_args::<(Value,), (), (), (), _, ()>(args)?;
|
40
40
|
let (to_read,) = parsed_args.required;
|
41
41
|
|
42
|
-
let kwargs = get_kwargs::<_, (), (Option<Value
|
42
|
+
let kwargs = get_kwargs::<_, (), (Option<Option<Value>>, Option<Option<Vec<String>>>), ()>(
|
43
43
|
parsed_args.keywords,
|
44
44
|
&[],
|
45
45
|
&["result_type", "columns"],
|
@@ -48,6 +48,7 @@ pub fn parse_parquet_rows_args(ruby: &Ruby, args: &[Value]) -> Result<ParquetRow
|
|
48
48
|
let result_type: ParserResultType = match kwargs
|
49
49
|
.optional
|
50
50
|
.0
|
51
|
+
.flatten()
|
51
52
|
.map(|value| parse_string_or_symbol(ruby, value))
|
52
53
|
{
|
53
54
|
Some(Ok(Some(parsed))) => parsed.try_into().map_err(|e| {
|
@@ -75,7 +76,7 @@ pub fn parse_parquet_rows_args(ruby: &Ruby, args: &[Value]) -> Result<ParquetRow
|
|
75
76
|
Ok(ParquetRowsArgs {
|
76
77
|
to_read,
|
77
78
|
result_type,
|
78
|
-
columns: kwargs.optional.1,
|
79
|
+
columns: kwargs.optional.1.flatten(),
|
79
80
|
})
|
80
81
|
}
|
81
82
|
|
@@ -95,7 +96,16 @@ pub fn parse_parquet_columns_args(
|
|
95
96
|
let parsed_args = scan_args::<(Value,), (), (), (), _, ()>(args)?;
|
96
97
|
let (to_read,) = parsed_args.required;
|
97
98
|
|
98
|
-
let kwargs = get_kwargs::<
|
99
|
+
let kwargs = get_kwargs::<
|
100
|
+
_,
|
101
|
+
(),
|
102
|
+
(
|
103
|
+
Option<Option<Value>>,
|
104
|
+
Option<Option<Vec<String>>>,
|
105
|
+
Option<Option<usize>>,
|
106
|
+
),
|
107
|
+
(),
|
108
|
+
>(
|
99
109
|
parsed_args.keywords,
|
100
110
|
&[],
|
101
111
|
&["result_type", "columns", "batch_size"],
|
@@ -104,6 +114,7 @@ pub fn parse_parquet_columns_args(
|
|
104
114
|
let result_type: ParserResultType = match kwargs
|
105
115
|
.optional
|
106
116
|
.0
|
117
|
+
.flatten()
|
107
118
|
.map(|value| parse_string_or_symbol(ruby, value))
|
108
119
|
{
|
109
120
|
Some(Ok(Some(parsed))) => parsed.try_into().map_err(|e| {
|
@@ -131,7 +142,7 @@ pub fn parse_parquet_columns_args(
|
|
131
142
|
Ok(ParquetColumnsArgs {
|
132
143
|
to_read,
|
133
144
|
result_type,
|
134
|
-
columns: kwargs.optional.1,
|
135
|
-
batch_size: kwargs.optional.2,
|
145
|
+
columns: kwargs.optional.1.flatten(),
|
146
|
+
batch_size: kwargs.optional.2.flatten(),
|
136
147
|
})
|
137
148
|
}
|
@@ -28,7 +28,7 @@ pub fn parse_parquet_write_args(args: &[Value]) -> Result<ParquetWriteArgs, Magn
|
|
28
28
|
let parsed_args = scan_args::<(Value,), (), (), (), _, ()>(args)?;
|
29
29
|
let (read_from,) = parsed_args.required;
|
30
30
|
|
31
|
-
let kwargs = get_kwargs::<_, (Value, Value), (Option<usize
|
31
|
+
let kwargs = get_kwargs::<_, (Value, Value), (Option<Option<usize>>,), ()>(
|
32
32
|
parsed_args.keywords,
|
33
33
|
&["schema", "write_to"],
|
34
34
|
&["batch_size"],
|
@@ -70,7 +70,7 @@ pub fn parse_parquet_write_args(args: &[Value]) -> Result<ParquetWriteArgs, Magn
|
|
70
70
|
read_from,
|
71
71
|
write_to: kwargs.required.1,
|
72
72
|
schema,
|
73
|
-
batch_size: kwargs.optional.0,
|
73
|
+
batch_size: kwargs.optional.0.flatten(),
|
74
74
|
})
|
75
75
|
}
|
76
76
|
|
data/lib/parquet/version.rb
CHANGED