Support numeric keys in MAP type
This commit is contained in:
Родитель
d5172cbbf1
Коммит
ce0ff04e6b
|
@ -330,3 +330,4 @@ ASALocalRun/
|
|||
.mfractor/
|
||||
|
||||
target/
|
||||
.vscode/
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,7 +1,7 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"pq2json"
|
||||
]
|
||||
"pq2json"
|
||||
]
|
||||
|
||||
[profile.dev]
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<package >
|
||||
<metadata>
|
||||
<id>pq2json</id>
|
||||
<version>0.1.6</version>
|
||||
<version>0.1.7</version>
|
||||
<authors>Evgeney Ryzhyk</authors>
|
||||
<owners>Evgeney Ryzhyk</owners>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/Azure/azure-kusto-parquet-conv</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Parquet to JSON (line delimited) converter tool.</description>
|
||||
<releaseNotes>Add --cslschema option for returning Kusto-compatible schema.</releaseNotes>
|
||||
<releaseNotes>Support numeric keys in MAP type</releaseNotes>
|
||||
<copyright>Copyright 2020</copyright>
|
||||
<tags></tags>
|
||||
<dependencies></dependencies>
|
||||
|
|
|
@ -2,11 +2,7 @@ Parquet to JSON (line delimited) converter tool.
|
|||
|
||||
# Building
|
||||
|
||||
Requires nightly Rust, tested with `1.37.0-nightly (de7c4e423 2019-06-23)`:
|
||||
|
||||
`rustup toolchain add nightly`
|
||||
|
||||
`cargo +nightly build --release`
|
||||
`cargo build --release`
|
||||
|
||||
# Running
|
||||
|
||||
|
|
|
@ -13,4 +13,4 @@ serde_json = "1"
|
|||
num-bigint = "0.2"
|
||||
chrono = "0.4"
|
||||
csv = "1.1.4"
|
||||
ryu = "1.0"
|
||||
ryu = "1.0"
|
||||
|
|
|
@ -215,9 +215,19 @@ fn map_to_value(settings: &Settings, map: &Map) -> Result<Value, Box<dyn Error>>
|
|||
for i in 0..map.len() {
|
||||
let key_ty = keys.get_element_type(i);
|
||||
let key = match key_ty {
|
||||
FieldType::Null => String::from("null"),
|
||||
FieldType::Bool => keys.get_bool(i)?.to_string(),
|
||||
FieldType::Byte => keys.get_byte(i)?.to_string(),
|
||||
FieldType::Short => keys.get_short(i)?.to_string(),
|
||||
FieldType::Int => keys.get_int(i)?.to_string(),
|
||||
FieldType::Long => keys.get_long(i)?.to_string(),
|
||||
FieldType::UByte => keys.get_ubyte(i)?.to_string(),
|
||||
FieldType::UShort => keys.get_ushort(i)?.to_string(),
|
||||
FieldType::UInt => keys.get_uint(i)?.to_string(),
|
||||
FieldType::ULong => keys.get_ulong(i)?.to_string(),
|
||||
FieldType::Str => keys.get_string(i)?.to_string(),
|
||||
// TODO: return error here
|
||||
_ => panic!("Non-string key"),
|
||||
_ => panic!("Unsupported map key"),
|
||||
};
|
||||
|
||||
let val_ty = values.get_element_type(i);
|
||||
|
|
Загрузка…
Ссылка в новой задаче