use crate::files_source::models::FileColumn;
use crate::store_paths::models::StoreKind;
pub(crate) fn custom_endpoint(store: &StoreKind) -> Option<String> {
let from_env = std::env::var_os("AWS_ENDPOINT").is_some()
|| std::env::var_os("AWS_ENDPOINT_URL").is_some();
match store {
StoreKind::S3 {
endpoint: Some(_), ..
} => Some("the S3 connection sets a custom endpoint".to_owned()),
StoreKind::S3 { .. } if from_env => {
Some("AWS_ENDPOINT or AWS_ENDPOINT_URL sets a custom S3 endpoint".to_owned())
}
_ => None,
}
}
pub(crate) fn reserved_name(column: &FileColumn) -> Option<String> {
["filename", "file_row_number", "file_index"]
.iter()
.any(|reserved| column.name.eq_ignore_ascii_case(reserved))
.then(|| {
format!(
"the files have a column named {}, which DuckDB's file reader adds itself",
column.name
)
})
}