Skip to content

Commit de4b777

Browse files
authored
Fix clippy warnings + symbolize ASAN stack traces (#490)
1 parent 79417fb commit de4b777

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

.github/workflows/rust.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,15 @@ jobs:
128128
with:
129129
toolchain: nightly
130130
components: 'rust-src'
131-
131+
# Install LLVM tools
132+
- name: Install LLVM
133+
run: |
134+
sudo apt-get install -y llvm
132135
- name: Tests with asan
133136
env:
134137
RUSTFLAGS: -Zsanitizer=address -C debuginfo=0
135138
RUSTDOCFLAGS: -Zsanitizer=address
136-
ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=1"
139+
ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=1:symbolize=1"
137140
# Work around https://github.com/rust-lang/rust/issues/59125 by
138141
# disabling backtraces. In an ideal world we'd probably suppress the
139142
# leak sanitization, but we don't care about backtraces here, so long
@@ -142,6 +145,8 @@ jobs:
142145
# We cannot run "modern-full" with asan as the chrono feature will auto-load relase binaries of
143146
# the ICU-extension, which are not built with ASAN and will cause a crash.
144147
run: |
148+
export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer)
149+
echo $ASAN_SYMBOLIZER_PATH
145150
cargo -Z build-std test --features "serde_json url r2d2 uuid polars extensions-full" --target x86_64-unknown-linux-gnu --package duckdb
146151
- name: publish crates --dry-run
147152
uses: katyo/publish-crates@v2

crates/duckdb/src/appender_params.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ use sealed::Sealed;
4444
/// - a reference to an array of references, as in `thing.query(&["foo",
4545
/// "bar", "baz"])` or `thing.query(&[&1i32, &2, &3])`.
4646
///
47-
/// (Note: in this case we don't implement this for slices for coherence
48-
/// reasons, so it really is only for the "reference to array" types —
49-
/// hence why the number of parameters must be <= 32 or you need to
50-
/// reach for `duckdb::params!`)
51-
///
52-
/// Unfortunately, in the current design it's not possible to allow this for
53-
/// references to arrays of non-references (e.g. `&[1i32, 2, 3]`). Code like
54-
/// this should instead either use `params!`, an array literal, a `&[&dyn
55-
/// ToSql]` or if none of those work, [`ParamsFromIter`].
47+
/// (Note: in this case we don't implement this for slices for coherence
48+
/// reasons, so it really is only for the "reference to array" types —
49+
/// hence why the number of parameters must be <= 32 or you need to
50+
/// reach for `duckdb::params!`)
51+
///
52+
/// Unfortunately, in the current design it's not possible to allow this for
53+
/// references to arrays of non-references (e.g. `&[1i32, 2, 3]`). Code like
54+
/// this should instead either use `params!`, an array literal, a `&[&dyn
55+
/// ToSql]` or if none of those work, [`ParamsFromIter`].
5656
///
5757
/// - As a slice of `ToSql` trait object references, e.g. `&[&dyn ToSql]`. This
5858
/// is mostly useful for passing parameter lists around as arguments without

crates/duckdb/src/params.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ use sealed::Sealed;
4444
/// - a reference to an array of references, as in `thing.query(&["foo",
4545
/// "bar", "baz"])` or `thing.query(&[&1i32, &2, &3])`.
4646
///
47-
/// (Note: in this case we don't implement this for slices for coherence
48-
/// reasons, so it really is only for the "reference to array" types —
49-
/// hence why the number of parameters must be <= 32 or you need to
50-
/// reach for `duckdb::params!`)
51-
///
52-
/// Unfortunately, in the current design it's not possible to allow this for
53-
/// references to arrays of non-references (e.g. `&[1i32, 2, 3]`). Code like
54-
/// this should instead either use `params!`, an array literal, a `&[&dyn
55-
/// ToSql]` or if none of those work, [`ParamsFromIter`].
47+
/// (Note: in this case we don't implement this for slices for coherence
48+
/// reasons, so it really is only for the "reference to array" types —
49+
/// hence why the number of parameters must be <= 32 or you need to
50+
/// reach for `duckdb::params!`)
51+
///
52+
/// Unfortunately, in the current design it's not possible to allow this for
53+
/// references to arrays of non-references (e.g. `&[1i32, 2, 3]`). Code like
54+
/// this should instead either use `params!`, an array literal, a `&[&dyn
55+
/// ToSql]` or if none of those work, [`ParamsFromIter`].
5656
///
5757
/// - As a slice of `ToSql` trait object references, e.g. `&[&dyn ToSql]`. This
5858
/// is mostly useful for passing parameter lists around as arguments without

crates/duckdb/src/vtab/arrow.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
use super::{BindInfo, DataChunkHandle, InitInfo, LogicalTypeHandle, TableFunctionInfo, VTab};
2-
use std::sync::Arc;
3-
use std::sync::{atomic::AtomicBool, Mutex};
2+
use std::sync::{atomic::AtomicBool, Arc, Mutex};
43

54
use crate::{
65
core::{ArrayVector, FlatVector, Inserter, ListVector, LogicalTypeId, StructVector, Vector},
76
types::DuckString,
87
};
98

10-
use arrow::array::as_map_array;
119
use arrow::{
1210
array::{
13-
as_boolean_array, as_generic_binary_array, as_large_list_array, as_list_array, as_primitive_array,
14-
as_string_array, as_struct_array, Array, ArrayData, AsArray, BinaryArray, BinaryViewArray, BooleanArray,
15-
Date32Array, Decimal128Array, FixedSizeBinaryArray, FixedSizeListArray, GenericBinaryBuilder, GenericListArray,
16-
GenericStringArray, IntervalMonthDayNanoArray, LargeBinaryArray, LargeStringArray, OffsetSizeTrait,
17-
PrimitiveArray, StringArray, StringViewArray, StructArray, TimestampMicrosecondArray, TimestampNanosecondArray,
11+
as_boolean_array, as_generic_binary_array, as_large_list_array, as_list_array, as_map_array,
12+
as_primitive_array, as_string_array, as_struct_array, Array, ArrayData, AsArray, BinaryArray, BinaryViewArray,
13+
BooleanArray, Date32Array, Decimal128Array, FixedSizeBinaryArray, FixedSizeListArray, GenericBinaryBuilder,
14+
GenericListArray, GenericStringArray, IntervalMonthDayNanoArray, LargeBinaryArray, LargeStringArray,
15+
OffsetSizeTrait, PrimitiveArray, StringArray, StringViewArray, StructArray, TimestampMicrosecondArray,
16+
TimestampNanosecondArray,
1817
},
1918
buffer::{BooleanBuffer, NullBuffer},
2019
compute::cast,
@@ -1714,11 +1713,7 @@ mod test {
17141713

17151714
let mut stmt = db.prepare("SELECT * FROM arrow(?, ?)").unwrap();
17161715

1717-
let res = match stmt.execute(arrow_recordbatch_to_query_params(batch)) {
1718-
Ok(..) => None,
1719-
Err(e) => Some(e),
1720-
}
1721-
.unwrap();
1716+
let res = stmt.execute(arrow_recordbatch_to_query_params(batch)).err().unwrap();
17221717

17231718
assert_eq!(
17241719
res,

0 commit comments

Comments
 (0)