Skip to content

Commit

Permalink
fix doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
shbhmrzd committed Apr 19, 2024
1 parent 1a709df commit 06417f6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/services/hdfs_native/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +39,7 @@ impl HdfsNativeLister {

impl oio::List for HdfsNativeLister {
async fn next(&mut self) -> Result<Option<Entry>> {
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)),
Expand All @@ -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.
Expand Down

0 comments on commit 06417f6

Please sign in to comment.