mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-03 18:55:39 +00:00
feat(s3select): add JSON handling and flattening for EcObjectStore (#1930)
Signed-off-by: 0xdx2 <xuedamon2@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -218,7 +218,16 @@ impl SimpleQueryDispatcher {
|
||||
(ListingOptions::new(Arc::new(file_format)).with_file_extension(".parquet"), false, false)
|
||||
} else if self.input.request.input_serialization.json.is_some() {
|
||||
let file_format = JsonFormat::default();
|
||||
(ListingOptions::new(Arc::new(file_format)).with_file_extension(".json"), false, false)
|
||||
// Use the actual file extension from the object key so that files stored
|
||||
// with a `.jsonl` suffix (newline-delimited JSON) are also matched by
|
||||
// DataFusion's listing/schema-inference logic. Falling back to ".json"
|
||||
// preserves behaviour for keys that have no extension.
|
||||
let file_ext = std::path::Path::new(&self.input.key)
|
||||
.extension()
|
||||
.and_then(|e| e.to_str())
|
||||
.map(|e| format!(".{e}"))
|
||||
.unwrap_or_else(|| ".json".to_string());
|
||||
(ListingOptions::new(Arc::new(file_format)).with_file_extension(file_ext), false, false)
|
||||
} else {
|
||||
return Err(QueryError::NotImplemented {
|
||||
err: "not support this file type".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user