Enum arrow_odbc::ColumnFailure
source · pub enum ColumnFailure {
ZeroSizedColumn {
sql_type: OdbcDataType,
},
UnknownStringLength {
sql_type: OdbcDataType,
source: Error,
},
UnsupportedArrowType(ArrowDataType),
FailedToDescribeColumn(Error),
TooLarge {
num_elements: usize,
element_size: usize,
},
}Expand description
Read error related to a specific column
Variants§
ZeroSizedColumn
Fields
§
sql_type: OdbcDataTypeWe are getting a display or column size from ODBC but it is not larger than 0.
UnknownStringLength
Unable to retrieve the column display size for the column.
UnsupportedArrowType(ArrowDataType)
The type specified in the arrow schema is not supported to be fetched from the database.
FailedToDescribeColumn(Error)
At ODBC api calls gaining information about the columns did fail.
TooLarge
Implementations§
source§impl ColumnFailure
impl ColumnFailure
sourcepub fn into_crate_error(self, name: String, index: usize) -> Error
pub fn into_crate_error(self, name: String, index: usize) -> Error
Provides the error with additional context of Error with column name and index.
Examples found in repository?
src/odbc_reader.rs (line 162)
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
pub fn with(
mut cursor: C,
max_batch_size: usize,
schema: Option<SchemaRef>,
buffer_allocation_options: BufferAllocationOptions,
) -> Result<Self, Error> {
// Infer schema if not given by the user
let schema = if let Some(schema) = schema {
schema
} else {
Arc::new(arrow_schema_from(&mut cursor)?)
};
let column_strategies: Vec<Box<dyn ReadStrategy>> = schema
.fields()
.iter()
.enumerate()
.map(|(index, field)| {
let col_index = (index + 1).try_into().unwrap();
choose_column_strategy(field, &mut cursor, col_index, buffer_allocation_options)
.map_err(|cause| cause.into_crate_error(field.name().clone(), index))
})
.collect::<Result<_, _>>()?;
let descs = column_strategies.iter().map(|cs| cs.buffer_desc());
let row_set_buffer = if buffer_allocation_options.fallibale_allocations {
ColumnarAnyBuffer::try_from_descs(max_batch_size, descs)
.map_err(|err| map_allocation_error(err, &schema))?
} else {
ColumnarAnyBuffer::from_descs(max_batch_size, descs)
};
let cursor = cursor.bind_buffer(row_set_buffer).unwrap();
Ok(Self {
column_strategies,
schema,
cursor,
})
}Trait Implementations§
source§impl Debug for ColumnFailure
impl Debug for ColumnFailure
source§impl Display for ColumnFailure
impl Display for ColumnFailure
source§impl Error for ColumnFailure
impl Error for ColumnFailure
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()