From 1f9b1da6c65c252ae53fb0856e4f2439e6790ce1 Mon Sep 17 00:00:00 2001 From: Geoffrey Yu Date: Wed, 11 Sep 2024 16:38:55 -0400 Subject: [PATCH] Compilation fixes --- sandbox/qe/Cargo.toml | 13 ++++++++++--- sandbox/qe/RadixSplineLib/radixspline.cpp | 2 +- sandbox/qe/{build.rs => build_bindings.rs} | 4 +++- sandbox/qe/src/bin/test_radixspline.rs | 12 ------------ sandbox/qe/src/lib.rs | 3 ++- sandbox/qe/src/radixspline.rs | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) rename sandbox/qe/{build.rs => build_bindings.rs} (97%) delete mode 100644 sandbox/qe/src/bin/test_radixspline.rs diff --git a/sandbox/qe/Cargo.toml b/sandbox/qe/Cargo.toml index f068f020..f02fdada 100644 --- a/sandbox/qe/Cargo.toml +++ b/sandbox/qe/Cargo.toml @@ -2,7 +2,8 @@ name = "brad_qe" version = "0.1.0" edition = "2021" -build = "build.rs" +# NOTE: This currently does not work. (C++ standard library linking error) +# build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -24,5 +25,11 @@ cc = "1.0.96" [[bin]] name = "bench_q3" path = "src/bin/bench_q3.rs" -name = "test_radixspline" -path = "src/bin/test_radixspline.rs" + +[[bin]] +name = "brad_qe_repl" +path = "src/bin/repl.rs" + +# [[bin]] +# name = "test_radixspline" +# path = "src/bin/test_radixspline.rs" diff --git a/sandbox/qe/RadixSplineLib/radixspline.cpp b/sandbox/qe/RadixSplineLib/radixspline.cpp index 8603404b..38b55492 100644 --- a/sandbox/qe/RadixSplineLib/radixspline.cpp +++ b/sandbox/qe/RadixSplineLib/radixspline.cpp @@ -1,4 +1,4 @@ -#include "radixspline.hpp" +#include "radixspline.h" void* build(const uint64_t* ks, uint64_t size) { RSData* rs = new RSData; diff --git a/sandbox/qe/build.rs b/sandbox/qe/build_bindings.rs similarity index 97% rename from sandbox/qe/build.rs rename to sandbox/qe/build_bindings.rs index 482318cf..2b422f74 100644 --- a/sandbox/qe/build.rs +++ b/sandbox/qe/build_bindings.rs @@ -1,6 +1,8 @@ use std::env; use std::path::PathBuf; +// NOTE: This file should be named `build.rs` once it is working. + fn main() { // This is the directory where the `c` library is located. let libdir_path = PathBuf::from("RadixSplineLib") @@ -56,7 +58,7 @@ fn main() { // automatically know it must look for a `libradixspline.a` file. println!("cargo:rustc-link-lib=radixspline"); println!("cargo:rustc-link-lib=stdc++"); - + // The bindgen::Builder is the main entry point // to bindgen, and lets you build up options for // the resulting bindings. diff --git a/sandbox/qe/src/bin/test_radixspline.rs b/sandbox/qe/src/bin/test_radixspline.rs deleted file mode 100644 index 33a406ec..00000000 --- a/sandbox/qe/src/bin/test_radixspline.rs +++ /dev/null @@ -1,12 +0,0 @@ -use brad_qe::radixspline::RadixSpline; - -fn main() -> () { - let input: [u64; 15] = [1,2,3,4,6,7,8,9,11,12,13,15,17,20,21]; - let rspline = RadixSpline::build_simple(input); - println!("7 is in the array: {}", rspline.lookup(7)); - - println!("13 is in the array: {}", rspline.lookup(13)); - - println!("5 is in the array: {}", rspline.lookup(5)); - -} diff --git a/sandbox/qe/src/lib.rs b/sandbox/qe/src/lib.rs index 8af980bf..44aee2e2 100644 --- a/sandbox/qe/src/lib.rs +++ b/sandbox/qe/src/lib.rs @@ -23,7 +23,8 @@ pub mod ops; /// Utilities for rewriting DataFusion `ExecutionPlan`s. pub mod rewrite; -pub mod radixspline; +// RadixSpline bindings. Currently not working. +// pub mod radixspline; /// Represents an "open" IOHTAP database. Eventually, the DB should run as a /// daemon process. For now it is just an embedded DB (similar to SQLite). diff --git a/sandbox/qe/src/radixspline.rs b/sandbox/qe/src/radixspline.rs index dd3f4440..bee9e69a 100644 --- a/sandbox/qe/src/radixspline.rs +++ b/sandbox/qe/src/radixspline.rs @@ -25,7 +25,7 @@ impl RadixSpline { pub fn build(record_batch: &RecordBatch, column_index: usize) -> RadixSpline { let column = record_batch.column(column_index); let u64_array = column.as_any().downcast_ref::().unwrap(); - + let ptr = u64_array.values().as_ptr(); let size = column.len() as u64; unsafe {