Skip to content

Commit

Permalink
Merge branch 'main' into Jira_Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Haddad authored Oct 22, 2024
2 parents fa870f4 + a158ba8 commit afe4f22
Show file tree
Hide file tree
Showing 104 changed files with 2,859 additions and 995 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ jobs:
run: cargo run --example hello_world --no-default-features --features="rayon test"
- name: Run hello_world example (Without Blitzar and Without Rayon)
run: cargo run --example hello_world --no-default-features --features="test"
- name: Run space example
run: cargo run --example space
- name: Run posql_db example (With Blitzar)
run: bash crates/proof-of-sql/examples/posql_db/run_example.sh
- name: Run posql_db example (Without Blitzar)
Expand Down Expand Up @@ -141,8 +143,6 @@ jobs:
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run clippy::pedantic for proof-of-sql-parser
run: cargo clippy --lib -p proof-of-sql-parser -- -D clippy::pedantic

coverage:
name: Code Coverage
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ To contribute to this project, you'll need to have Rust installed on your machin
rustup component add rustfmt
rustup component add clippy
```
- You will also need to install [lld](https://lld.llvm.org/) which will be required for running tests. For example on Debian based systems you can install it using the package manager:
```bash
apt install lld
```
If you run into any issues, please refer to the [official Rust documentation](https://www.rust-lang.org/learn/get-started) for troubleshooting and more detailed installation instructions.
Expand Down
42 changes: 4 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ arrow-csv = { version = "51.0" }
bit-iter = { version = "1.1.1" }
bigdecimal = { version = "0.4.5", default-features = false, features = ["serde"] }
blake3 = { version = "1.3.3", default-features = false }
blitzar = { version = "3.3.0" }
blitzar = { version = "3.4.0" }
bumpalo = { version = "3.11.0" }
bytemuck = {version = "1.16.3", features = ["derive"]}
byte-slice-cast = { version = "1.2.1", default-features = false }
Expand Down Expand Up @@ -53,6 +53,7 @@ rayon = { version = "1.5" }
serde = { version = "1", default-features = false }
serde_json = { version = "1", default-features = false, features = ["alloc"] }
snafu = { version = "0.8.4", default-features = false }
sqlparser = { version = "0.45.0", default-features = false }
tiny-keccak = { version = "2.0.2", features = [ "keccak" ] }
tracing = { version = "0.1.36", default-features = false }
tracing-opentelemetry = { version = "0.22.0" }
Expand All @@ -64,40 +65,5 @@ zerocopy = { version = "0.7.34" }
missing_docs = "warn"

[workspace.lints.clippy]
missing_panics_doc = "deny"
doc_markdown = "deny"
match_same_arms = "deny"
similar_names = "deny"
many_single_char_names = "deny"
explicit_iter_loop = "deny"
implicit_clone = "deny"
uninlined_format_args = "deny"
semicolon_if_nothing_returned = "deny"
unnested_or_patterns = "deny"
unreadable_literal = "deny"
must_use_candidate = "deny"
range_plus_one = "deny"
cloned_instead_of_copied = "deny"
from_iter_instead_of_collect = "deny"
cast_lossless = "deny"
redundant_closure_for_method_calls = "deny"
inconsistent_struct_constructor = "deny"
default_trait_access = "deny"
module_name_repetitions = "deny"
wildcard_imports = "deny"
unused_self = "deny"
manual_let_else = "deny"
struct_field_names = "deny"
unicode_not_nfc = "deny"
manual_string_new = "deny"
large_types_passed_by_value = "deny"
map_unwrap_or = "deny"
if_not_else = "deny"
explicit_deref_methods = "deny"
items_after_statements = "deny"
bool_to_int_with_if = "deny"
ptr_as_ptr = "deny"
match_wildcard_for_single_variants = "deny"
match_bool = "deny"
manual_assert = "deny"
trivially_copy_pass_by_ref = "deny"
missing_errors_doc = "allow"
pedantic = { level = "warn", priority = -1 }
4 changes: 2 additions & 2 deletions crates/proof-of-sql-parser/src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ mod tests {
}

#[test]
#[should_panic]
#[should_panic(expected = "Identifier too long: CapacityError: insufficient capacity")]
fn long_names_panic() {
Identifier::new("t".repeat(65));
}

#[test]
#[should_panic]
#[should_panic(expected = "Identifier too long: CapacityError: insufficient capacity")]
fn long_unicode_names_panic() {
Identifier::new("茶".repeat(22));
}
Expand Down
9 changes: 5 additions & 4 deletions crates/proof-of-sql-parser/src/intermediate_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* https://docs.rs/vervolg/latest/vervolg/ast/enum.Statement.html
***/

use crate::{intermediate_decimal::IntermediateDecimal, posql_time::PoSQLTimestamp, Identifier};
use crate::{posql_time::PoSQLTimestamp, Identifier};
use alloc::{boxed::Box, string::String, vec::Vec};
use bigdecimal::BigDecimal;
use core::{
fmt,
fmt::{Display, Formatter},
Expand Down Expand Up @@ -345,7 +346,7 @@ pub enum Literal {
/// String Literal
VarChar(String),
/// Decimal Literal
Decimal(IntermediateDecimal),
Decimal(BigDecimal),
/// Timestamp Literal
Timestamp(PoSQLTimestamp),
}
Expand Down Expand Up @@ -395,8 +396,8 @@ macro_rules! impl_string_to_literal {
impl_string_to_literal!(&str);
impl_string_to_literal!(String);

impl From<IntermediateDecimal> for Literal {
fn from(val: IntermediateDecimal) -> Self {
impl From<BigDecimal> for Literal {
fn from(val: BigDecimal) -> Self {
Literal::Decimal(val)
}
}
Expand Down
18 changes: 5 additions & 13 deletions crates/proof-of-sql-parser/src/intermediate_ast_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{
intermediate_ast::OrderByDirection::{Asc, Desc},
intermediate_decimal::IntermediateDecimal,
sql::*,
utility::*,
SelectStatement,
Expand All @@ -10,6 +9,7 @@ use alloc::{
string::{String, ToString},
vec,
};
use bigdecimal::BigDecimal;

// Sting parser tests
#[test]
Expand Down Expand Up @@ -143,10 +143,7 @@ fn we_can_parse_a_query_with_constants() {
col_res(lit(3), "bigint"),
col_res(lit(true), "boolean"),
col_res(lit("proof"), "varchar"),
col_res(
lit(IntermediateDecimal::try_from("-2.34").unwrap()),
"decimal",
),
col_res(lit("-2.34".parse::<BigDecimal>().unwrap()), "decimal"),
],
tab(None, "sxt_tab"),
vec![],
Expand Down Expand Up @@ -220,10 +217,7 @@ fn we_can_parse_a_query_with_a_column_equals_a_decimal() {
query(
cols_res(&["a"]),
tab(None, "sxt_tab"),
equal(
col("a"),
lit(IntermediateDecimal::try_from("-0.32").unwrap()),
),
equal(col("a"), lit("-0.32".parse::<BigDecimal>().unwrap())),
vec![],
),
vec![],
Expand Down Expand Up @@ -441,10 +435,7 @@ fn we_can_parse_a_query_with_one_logical_or_filter_expression() {
tab(None, "sxt_tab"),
or(
equal(col("b"), lit(3)),
equal(
col("c"),
lit(IntermediateDecimal::try_from("-2.34").unwrap()),
),
equal(col("c"), lit("-2.34".parse::<BigDecimal>().unwrap())),
),
vec![],
),
Expand Down Expand Up @@ -779,6 +770,7 @@ fn we_can_parse_multiple_order_by() {
// TODO: we should be able to pass this test.
// But due to some lalrpop restriction, we aren't.
// This problem will be addressed in a future PR.
#[allow(clippy::should_panic_without_expect)]
#[test]
#[should_panic]
fn we_cannot_parse_order_by_referencing_reserved_keywords_yet() {
Expand Down
Loading

0 comments on commit afe4f22

Please sign in to comment.