Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxiaoying committed Jan 22, 2025
1 parent ce973e5 commit d880fb7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 34 deletions.
30 changes: 7 additions & 23 deletions connectorx-python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions connectorx-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fn connectorx(_: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
}

#[pyfunction]
#[pyo3(signature = (conn, return_type, protocol=None, queries=None, partition_query=None))]
pub fn read_sql<'py>(
py: Python<'py>,
conn: &str,
Expand All @@ -64,6 +65,7 @@ pub fn partition_sql(
}

#[pyfunction]
#[pyo3(signature = (sql, db_map, strategy=None))]
pub fn read_sql2<'py>(
py: Python<'py>,
sql: &str,
Expand All @@ -87,6 +89,7 @@ pub fn read_sql2<'py>(
}

#[pyfunction]
#[pyo3(signature = (conn, query, protocol=None))]
pub fn get_meta<'py>(
py: Python<'py>,
conn: &str,
Expand Down
2 changes: 1 addition & 1 deletion connectorx-python/src/pandas/pandas_columns/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<'a, V> ArrayBlock<'a, V> {
view = rest;
ret.push(ArrayColumn::<V> {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted FloatArray data"))?
.as_mut_ptr(),
Expand Down
6 changes: 3 additions & 3 deletions connectorx-python/src/pandas/pandas_columns/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ impl<'a> ExtractBlockFromBound<'a> for BooleanBlock<'a> {
} else {
// if extension array
let tuple = ob.downcast::<PyTuple>()?;
let data = tuple.as_slice().get(0).unwrap();
let mask = tuple.as_slice().get(1).unwrap();
let data = &tuple.as_slice()[0];
let mask = &tuple.as_slice()[1];
check_dtype(data, "bool")?;
check_dtype(mask, "bool")?;

Expand Down Expand Up @@ -64,7 +64,7 @@ impl<'a> BooleanBlock<'a> {
view = rest;
ret.push(BooleanColumn {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted Boolean data"))?
.as_mut_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion connectorx-python/src/pandas/pandas_columns/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'a> BytesBlock<'a> {
view = rest;
ret.push(BytesColumn {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted String data"))?
.as_mut_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion connectorx-python/src/pandas/pandas_columns/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'a> DateTimeBlock<'a> {
view = rest;
ret.push(DateTimeColumn {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted DateTime data"))?
.as_mut_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion connectorx-python/src/pandas/pandas_columns/float64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'a> Float64Block<'a> {
view = rest;
ret.push(Float64Column {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted Float64 data"))?
.as_mut_ptr(),
Expand Down
6 changes: 3 additions & 3 deletions connectorx-python/src/pandas/pandas_columns/int64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl<'a> ExtractBlockFromBound<'a> for Int64Block<'a> {
} else {
let tuple = ob.downcast::<PyTuple>()?;
// let data = tuple.get_borrowed_item(0)?;
let data = tuple.as_slice().get(0).unwrap();
let mask = tuple.as_slice().get(1).unwrap();
let data = &tuple.as_slice()[0];
let mask = &tuple.as_slice()[1];
check_dtype(data, "int64")?;
check_dtype(mask, "bool")?;
Ok(Int64Block::Extention(
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<'a> Int64Block<'a> {
view = rest;
ret.push(Int64Column {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted Int64 data"))?
.as_mut_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion connectorx-python/src/pandas/pandas_columns/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> StringBlock<'a> {
view = rest;
ret.push(StringColumn {
data: col
.into_shape(nrows)?
.into_shape_with_order(nrows)?
.into_slice()
.ok_or_else(|| anyhow!("get None for splitted String data"))?
.as_mut_ptr(),
Expand Down

0 comments on commit d880fb7

Please sign in to comment.