Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed May 8, 2024
1 parent 0e7a546 commit 7f988dc
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 118 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/validation-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ on:
name: Rust Validation

env:
# RUSTDOCFLAGS: -D warnings
# RUSTFLAGS: -D warnings -C debuginfo=1
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings -C debuginfo=1
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

Expand Down
6 changes: 3 additions & 3 deletions udf-examples/src/avg2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Aggregate cost window function
//! Example average function
//!
//! Takes a quantity and a real to return the average value within the window.
//! This is just a reimplemenation of builtin `AVG`
//!
//! ```sql
//! CREATE FUNCTION avg2 RETURNS integer SONAME 'libudf_examples.so';
//! SELECT avg2(int_column, real_column);
//! SELECT avg2(value);
//! ```
// Ignore loss of precision when we cast i64 to f64
#![allow(clippy::cast_precision_loss)]
Expand Down
2 changes: 1 addition & 1 deletion udf-examples/tests/avgcost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SETUP: &[&str] = &[
fn test_empty() {
let conn = &mut get_db_connection(&SETUP);

let res: Vec<f64> = conn
let res: Vec<f32> = conn
.query("SELECT avg_cost(qty, cost) FROM test_avgcost GROUP BY class")
.unwrap();

Expand Down
5 changes: 5 additions & 0 deletions udf-examples/tests/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ pub fn get_db_connection(init: &[&str]) -> PooledConn {

conn
}

pub fn approx_eq(a: f32, b: f32) -> bool {
const TOLERANCE: f32 = 0.001;
(a - b).abs() < TOLERANCE
}
23 changes: 0 additions & 23 deletions udf-examples/tests/lookup.txt

This file was deleted.

10 changes: 5 additions & 5 deletions udf-examples/tests/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use backend::get_db_connection;
use mysql::prelude::*;

const SETUP: &[&str] = &[
"create or replace function udf_sequence
returns integer
soname 'libudf_examples.so'",
"create or replace table test_seq (
"CREATE OR REPLACE FUNCTION udf_sequence
RETURNS integer
SONAME 'libudf_examples.so'",
"CREATE OR REPLACE TABLE test_seq (
id int
)",
"insert into test_seq (id) values (1), (2), (3), (4), (5), (6)",
"INSERT INTO test_seq (id) VALUES (1), (2), (3), (4), (5), (6)",
];

#[test]
Expand Down
68 changes: 0 additions & 68 deletions udf-examples/tests/sequence.txt

This file was deleted.

16 changes: 0 additions & 16 deletions udf-examples/tests/sum_int.txt

This file was deleted.

0 comments on commit 7f988dc

Please sign in to comment.