Skip to content

Commit

Permalink
feat: better error messages (#203)
Browse files Browse the repository at this point in the history
* feat: small tweaks
* fix: fix clippy
  • Loading branch information
tshauck authored Oct 6, 2023
1 parent 7a8bc9f commit ef11a78
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
4 changes: 2 additions & 2 deletions exon/src/datasources/bam/table_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ impl TableProvider for ListingBAMTable {
}

if regions.is_empty() && self.options.indexed {
return Err(DataFusionError::Execution(
"INDEXED_BAM table type requires a region filter".to_string(),
return Err(DataFusionError::Plan(
"INDEXED_BAM table type requires a region filter. See the 'bam_region_filter' function.".to_string(),
));
}

Expand Down
15 changes: 9 additions & 6 deletions exon/src/datasources/vcf/file_opener/indexed_file_opener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ impl FileOpener for IndexedVCFOpener {
async_reader
} else {
// Otherwise, we read the compressed range from the object store.
tracing::debug!(
"Reading compressed range: {}..{} of {}",
vp_start.compressed(),
vp_end.compressed(),
file_meta.location()
);

let start = vp_start.compressed() as usize;
let end = if vp_start.compressed() == vp_end.compressed() {
Expand All @@ -116,6 +110,15 @@ impl FileOpener for IndexedVCFOpener {
vp_end.compressed() as usize
};

tracing::info!(
"Reading compressed range: {}..{} (uncompressed {}..{}) of {}",
vp_start.compressed(),
vp_end.compressed(),
start,
end,
file_meta.location()
);

let get_options = GetOptions {
range: Some(Range { start, end }),
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions exon/src/datasources/vcf/table_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ pub struct ListingVCFTableOptions {
impl ListingVCFTableOptions {
/// Create a new set of options
pub fn new(file_compression_type: FileCompressionType, indexed: bool) -> Self {
let file_compression_type = file_compression_type;
let file_extension = ExonFileType::VCF.get_file_extension(file_compression_type);

Self {
Expand Down Expand Up @@ -321,8 +320,9 @@ impl TableProvider for ListingVCFTable {
}

if regions.is_empty() && self.options.indexed {
return Err(DataFusionError::NotImplemented(
"INDEXED_VCF table reuires a region filter".to_string(),
return Err(DataFusionError::Plan(
"INDEXED_VCF table requires a region filter. See the UDF 'vcf_region_filter'."
.to_string(),
));
}

Expand Down
11 changes: 10 additions & 1 deletion exon/src/exome/proto/exome.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ pub struct Organization {
#[prost(string, tag = "4")]
pub updated_at: ::prost::alloc::string::String,
}
/// Association between a use and an organization.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserOrganization {
#[prost(message, optional, tag = "1")]
pub organization: ::core::option::Option<Organization>,
#[prost(string, tag = "2")]
pub role: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrganizationRequest {
Expand All @@ -64,7 +73,7 @@ pub struct GetUserOrganizationsRequest {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUserOrganizationsResponse {
#[prost(message, repeated, tag = "1")]
pub organizations: ::prost::alloc::vec::Vec<Organization>,
pub organizations: ::prost::alloc::vec::Vec<UserOrganization>,
}
/// User
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
5 changes: 1 addition & 4 deletions exon/src/physical_optimizer/file_repartitioner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ fn optimize_file_partitions(
.children()
.iter()
.map(|child| {
let optimized = optimize_file_partitions(child.clone(), target_partitions)
.map(Transformed::into);

optimized
optimize_file_partitions(child.clone(), target_partitions).map(Transformed::into)
})
.collect::<Result<_>>()?;

Expand Down

0 comments on commit ef11a78

Please sign in to comment.