Skip to content

Commit 8ac2922

Browse files
committed
Use nullable strings rather than NULL
1 parent 7e1ca8f commit 8ac2922

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

datafusion-cli/src/functions.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,13 @@ impl TableFunctionImpl for StatisticsCacheFunc {
703703
}
704704
}
705705

706-
// Implementation of the `list_files_cache` table function in datafusion-cli.
706+
/// Implementation of the `list_files_cache` table function in datafusion-cli.
707+
///
708+
/// This function returns the cached results of running a LIST command on a
709+
/// particular object store path for a table. The object metadata is returned as
710+
/// a List of Structs, with one Struct for each object. DataFusion uses these
711+
/// cached results to plan queries against external tables.
707712
///
708-
/// This function returns the cached results of running a LIST command on a particular object store path for a table. The object metadata is returned as a List of Structs, with one Struct for each object.
709-
/// DataFusion uses these cached results to plan queries against external tables.
710713
/// # Schema
711714
/// ```sql
712715
/// > describe select * from list_files_cache();
@@ -788,7 +791,7 @@ impl TableFunctionImpl for ListFilesCacheFunc {
788791
Field::new("metadata", DataType::Struct(nested_fields.clone()), true);
789792

790793
let schema = Arc::new(Schema::new(vec![
791-
Field::new("table", DataType::Utf8, false),
794+
Field::new("table", DataType::Utf8, true),
792795
Field::new("path", DataType::Utf8, false),
793796
Field::new("metadata_size_bytes", DataType::UInt64, false),
794797
// expires field in ListFilesEntry has type Instant when set, from which we cannot get "the number of seconds", hence using Duration instead of Timestamp as data type.
@@ -821,7 +824,7 @@ impl TableFunctionImpl for ListFilesCacheFunc {
821824
let mut current_offset: i32 = 0;
822825

823826
for (path, entry) in list_files_cache.list_entries() {
824-
table_arr.push(path.table.map_or("NULL".to_string(), |t| t.to_string()));
827+
table_arr.push(path.table.map(|t| t.to_string()));
825828
path_arr.push(path.path.to_string());
826829
metadata_size_bytes_arr.push(entry.size_bytes as u64);
827830
// calculates time left before entry expires

0 commit comments

Comments
 (0)