perf: parquet based data export
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use bincode::{Decode, Encode};
|
||||
use parquet_derive::ParquetRecordWriter;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
@@ -13,6 +14,42 @@ impl From<u32> for GetUserRegionApi {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GetUserRegionApiResp> for Vec<UserRegionFlatten> {
|
||||
fn from(
|
||||
GetUserRegionApiResp {
|
||||
user_id,
|
||||
user_region_list,
|
||||
..
|
||||
}: GetUserRegionApiResp,
|
||||
) -> Self {
|
||||
user_region_list
|
||||
.into_iter()
|
||||
.map(
|
||||
|UserRegion {
|
||||
region_id,
|
||||
play_count,
|
||||
created,
|
||||
}| {
|
||||
UserRegionFlatten {
|
||||
user_id,
|
||||
region_id,
|
||||
play_count,
|
||||
created,
|
||||
}
|
||||
},
|
||||
)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, ParquetRecordWriter)]
|
||||
pub struct UserRegionFlatten {
|
||||
pub user_id: u32,
|
||||
pub region_id: u32,
|
||||
pub play_count: i64,
|
||||
pub created: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GetUserRegionApiResp {
|
||||
|
||||
Reference in New Issue
Block a user