From 06417f6091e0e6ff37d8a869eebc4fc9b47f8f70 Mon Sep 17 00:00:00 2001 From: shbhmrzd Date: Sat, 20 Apr 2024 03:57:58 +0530 Subject: [PATCH] fix doc build --- core/src/services/hdfs_native/lister.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/services/hdfs_native/lister.rs b/core/src/services/hdfs_native/lister.rs index db379143efb..f971eaa362e 100644 --- a/core/src/services/hdfs_native/lister.rs +++ b/core/src/services/hdfs_native/lister.rs @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +use chrono::{DateTime, TimeZone, Utc}; use hdfs_native::client::{FileStatus, ListStatusIterator}; use crate::raw::oio::Entry; @@ -38,7 +39,7 @@ impl HdfsNativeLister { impl oio::List for HdfsNativeLister { async fn next(&mut self) -> Result> { - let de: FileStatus = match self.lsi.next() { + let de: FileStatus = match self.lsi.next().await { Some(res) => match res { Ok(fs) => fs, Err(e) => return Err(parse_hdfs_error(e)), @@ -49,9 +50,19 @@ impl oio::List for HdfsNativeLister { let path = build_rel_path(&self.root, &de.path); let entry = if !de.isdir { + let odt = DateTime::from_timestamp(de.modification_time as i64, 0); + let dt = match odt { + Some(dt) => dt, + None => { + return Err(Error::new( + ErrorKind::Unexpected, + &format!("Failure in extracting modified_time for {}", path), + )) + } + }; let meta = Metadata::new(EntryMode::FILE) .with_content_length(de.length as u64) - .with_last_modified(de.modification_time.into()); + .with_last_modified(dt); oio::Entry::new(&path, meta) } else if de.isdir { // Make sure we are returning the correct path.