Skip to content

Commit

Permalink
Merge branch 'main' into refactor/blitzar-metadata-table-signed-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtrombetta authored Nov 4, 2024
2 parents 6ca629a + 36d9ae3 commit c125542
Show file tree
Hide file tree
Showing 61 changed files with 2,946 additions and 711 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,10 @@ jobs:
run: cargo run --example dog_breeds
- name: Run wood types example
run: cargo run --example wood_types
- name: Run dinosaurs example
run: cargo run --example dinosaurs
- name: Run books example
run: cargo run --example books
- name: Run brands example
run: cargo run --example brands
- 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)
run: bash crates/proof-of-sql/examples/posql_db/run_example.sh --no-default-features --features="rayon"

clippy:
name: Clippy
runs-on: large-8-core-32gb-22-04
Expand Down Expand Up @@ -238,4 +231,4 @@ jobs:
- name: Install solhint
run: npm install -g solhint
- name: Run tests
run: solhint -c 'crates/proof-of-sql/.solhint.json' 'crates/proof-of-sql/**/*.sol' -w 0
run: solhint -c 'crates/proof-of-sql/.solhint.json' 'crates/proof-of-sql/**/*.sol' -w 0
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ ark-poly = { version = "0.4.0" }
ark-serialize = { version = "0.4.0" }
ark-std = { version = "0.4.0", default-features = false }
arrayvec = { version = "0.7", default-features = false }
arrow = { version = "51.0" }
arrow-csv = { version = "51.0" }
arrow = { version = "51.0.0" }
arrow-csv = { version = "51.0.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 }
Expand Down
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ chrono = { workspace = true, features = ["serde"] }
lalrpop-util = { workspace = true, features = ["lexer", "unicode"] }
serde = { workspace = true, features = ["serde_derive", "alloc"] }
snafu = { workspace = true }
sqlparser = { workspace = true }

[build-dependencies]
lalrpop = { workspace = true }
Expand Down
21 changes: 21 additions & 0 deletions crates/proof-of-sql-parser/src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{sql::IdentifierParser, ParseError, ParseResult};
use alloc::{format, string::ToString};
use arrayvec::ArrayString;
use core::{cmp::Ordering, fmt, ops::Deref, str::FromStr};
use sqlparser::ast::Ident;

/// Top-level unique identifier.
#[derive(Debug, PartialEq, Eq, Clone, Hash, Ord, PartialOrd, Copy)]
Expand Down Expand Up @@ -71,6 +72,16 @@ impl fmt::Display for Identifier {
}
}

// TryFrom<Ident> for Identifier
impl TryFrom<Ident> for Identifier {
type Error = ParseError;

fn try_from(ident: Ident) -> ParseResult<Self> {
// Convert Ident's value to Identifier
Identifier::try_new(ident.value)
}
}

impl PartialEq<str> for Identifier {
fn eq(&self, other: &str) -> bool {
other.eq_ignore_ascii_case(&self.name)
Expand Down Expand Up @@ -278,4 +289,14 @@ mod tests {
Identifier::new("t".repeat(64));
Identifier::new("茶".repeat(21));
}

#[test]
fn try_from_ident() {
let ident = Ident::new("ValidIdentifier");
let identifier = Identifier::try_from(ident).unwrap();
assert_eq!(identifier.name(), "valididentifier");

let invalid_ident = Ident::new("INVALID$IDENTIFIER");
assert!(Identifier::try_from(invalid_ident).is_err());
}
}
29 changes: 29 additions & 0 deletions crates/proof-of-sql-parser/src/resource_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use crate::{impl_serde_from_str, sql::ResourceIdParser, Identifier, ParseError,
use alloc::{
format,
string::{String, ToString},
vec::Vec,
};
use core::{
fmt::{self, Display},
str::FromStr,
};
use sqlparser::ast::Ident;

/// Unique resource identifier, like `schema.object_name`.
#[derive(Debug, PartialEq, Eq, Clone, Hash, Copy)]
Expand Down Expand Up @@ -110,6 +112,22 @@ impl FromStr for ResourceId {
}
impl_serde_from_str!(ResourceId);

impl TryFrom<Vec<Ident>> for ResourceId {
type Error = ParseError;

fn try_from(identifiers: Vec<Ident>) -> ParseResult<Self> {
if identifiers.len() != 2 {
return Err(ParseError::ResourceIdParseError {
error: "Expected exactly two identifiers for ResourceId".to_string(),
});
}

let schema = Identifier::try_from(identifiers[0].clone())?;
let object_name = Identifier::try_from(identifiers[1].clone())?;
Ok(ResourceId::new(schema, object_name))
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -233,4 +251,15 @@ mod tests {
serde_json::from_str(r#""good_identifier.bad!identifier"#);
assert!(deserialized.is_err());
}

#[test]
fn test_try_from_vec_ident() {
let identifiers = alloc::vec![Ident::new("schema_name"), Ident::new("object_name")];
let resource_id = ResourceId::try_from(identifiers).unwrap();
assert_eq!(resource_id.schema().name(), "schema_name");
assert_eq!(resource_id.object_name().name(), "object_name");

let invalid_identifiers = alloc::vec![Ident::new("only_one_ident")];
assert!(ResourceId::try_from(invalid_identifiers).is_err());
}
}
63 changes: 54 additions & 9 deletions crates/proof-of-sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,43 +89,88 @@ required-features = ["test"]

[[example]]
name = "posql_db"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "space"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "dog_breeds"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "wood_types"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "dinosaurs"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "books"
required-features = [ "arrow" ]
required-features = ["arrow"]

[[example]]
name = "programming_books"
required-features = ["arrow"]

[[example]]
name = "brands"
required-features = ["arrow"]

[[example]]
name = "census"
required-features = [ "arrow" ]

[[example]]
name = "plastics"
required-features = ["arrow"]

[[example]]
name = "avocado-prices"
required-features = ["arrow"]

[[example]]
name = "sushi"
required-features = ["arrow"]

[[example]]
name = "stocks"
required-features = ["arrow"]

[[example]]
name = "tech_gadget_prices"
required-features = [ "arrow" ]

[[example]]
name = "albums"
required-features = [ "arrow" ]

[[example]]
name = "vehicles"
required-features = [ "arrow" ]

[[example]]
name = "countries"
required-features = [ "arrow" ]

[[example]]
name = "rockets"
required-features = [ "arrow" ]


[[bench]]
name = "posql_benches"
harness = false
required-features = [ "blitzar" ]
required-features = ["blitzar"]

[[bench]]
name = "bench_append_rows"
harness = false
required-features = [ "test" ]
required-features = ["test"]

[[bench]]
name = "jaeger_benches"
harness = false
required-features = [ "blitzar" ]
required-features = ["blitzar"]
100 changes: 100 additions & 0 deletions crates/proof-of-sql/examples/albums/albums.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
artist,year,genre,album
Michael Jackson,1982,Pop,Thriller
The Beatles,1969,Rock,Abbey Road
Pink Floyd,1973,Progressive Rock,Dark Side of the Moon
Eagles,1976,Rock,Hotel California
Fleetwood Mac,1977,Rock,Rumours
AC/DC,1980,Hard Rock,Back in Black
Whitney Houston,1992,Pop/R&B,The Bodyguard
Bee Gees,1977,Disco,Saturday Night Fever
Queen,1975,Rock,A Night at the Opera
Bruce Springsteen,1984,Rock,Born in the U.S.A.
Nirvana,1991,Grunge,Nevermind
Adele,2011,Pop/Soul,21
Bob Marley & The Wailers,1977,Reggae,Exodus
Metallica,1991,Metal,Metallica
Prince,1984,Pop/Funk,Purple Rain
Led Zeppelin,1971,Rock,Led Zeppelin IV
The Rolling Stones,1972,Rock,Exile on Main St.
David Bowie,1972,Rock,The Rise and Fall of Ziggy Stardust and the Spiders from Mars
Stevie Wonder,1976,Soul/R&B,Songs in the Key of Life
Madonna,1984,Pop,Like a Virgin
Amy Winehouse,2006,Soul/R&B,Back to Black
Carole King,1971,Folk/Rock,Tapestry
Dr. Dre,1992,Hip-Hop,The Chronic
Bruce Springsteen,1975,Rock,Born to Run
The Beach Boys,1966,Rock,Pet Sounds
Joni Mitchell,1971,Folk,Blue
Miles Davis,1959,Jazz,Kind of Blue
The Clash,1979,Punk Rock,London Calling
Simon & Garfunkel,1970,Folk Rock,Bridge Over Troubled Water
Paul Simon,1986,World/Pop,Graceland
U2,1987,Rock,The Joshua Tree
Marvin Gaye,1971,Soul/R&B,What's Going On
Radiohead,1997,Alternative Rock,OK Computer
The Who,1971,Rock,Who's Next
Bob Dylan,1965,Folk Rock,Highway 61 Revisited
Guns N' Roses,1987,Hard Rock,Appetite for Destruction
The Doors,1967,Rock,The Doors
Elton John,1973,Rock/Pop,Goodbye Yellow Brick Road
R.E.M.,1992,Alternative Rock,Automatic for the People
Kendrick Lamar,2015,Hip-Hop,To Pimp a Butterfly
The Strokes,2001,Indie Rock,Is This It
Kanye West,2010,Hip-Hop,My Beautiful Dark Twisted Fantasy
Beyoncé,2016,R&B/Pop,Lemonade
Arcade Fire,2004,Indie Rock,Funeral
Oasis,1995,Britpop,(What's the Story) Morning Glory?
Daft Punk,2001,Electronic,Discovery
Nas,1994,Hip-Hop,Illmatic
Green Day,1994,Punk Rock,Dookie
Jay-Z,2001,Hip-Hop,The Blueprint
Taylor Swift,2014,Pop,1989
Arctic Monkeys,2013,Alternative Rock,AM
The Weeknd,2020,Pop/R&B,After Hours
Lana Del Rey,2012,Alternative/Pop,Born to Die
Tame Impala,2015,Psychedelic Rock,Currents
Frank Ocean,2012,R&B/Soul,Channel Orange
Coldplay,2002,Alternative Rock,A Rush of Blood to the Head
Lady Gaga,2011,Pop,Born This Way
Black Keys,2010,Blues Rock,Brothers
Ed Sheeran,2014,Pop,x
Tyler The Creator,2019,Hip-Hop,IGOR
Billie Eilish,2019,Pop/Alternative,When We All Fall Asleep
Tool,2019,Progressive Metal,Fear Inoculum
SZA,2022,R&B/Soul,SOS
Rosalía,2022,Flamenco Pop,Motomami
Harry Styles,2022,Pop,Harry's House
Bad Bunny,2022,Reggaeton/Latin Trap,Un Verano Sin Ti
Pearl Jam,1991,Grunge,Ten
Red Hot Chili Peppers,1991,Alternative Rock,Blood Sugar Sex Magik
Björk,1997,Art Pop,Homogenic
The Weeknd,2022,Pop/R&B,Dawn FM
Kendrick Lamar,2022,Hip-Hop,Mr. Morale & the Big Steppers
Taylor Swift,2022,Pop,Midnights
Arctic Monkeys,2022,Alternative Rock,The Car
Beyoncé,2022,Dance/Pop,Renaissance
Drake,2022,Hip-Hop/R&B,Honestly
Post Malone,2022,Pop/Hip-Hop,Twelve Carat Toothache
Florence + The Machine,2022,Art Rock,Dance Fever
Jack Harlow,2022,Hip-Hop,Come Home the Kids Miss You
Lizzo,2022,Pop/R&B,Special
Olivia Rodrigo,2023,Pop/Rock,GUTS
Lorde,2013,Art Pop,Pure Heroine
Talking Heads,1980,New Wave,Remain in Light
The Velvet Underground,1967,Art Rock,The Velvet Underground & Nico
Kate Bush,1985,Art Pop,Hounds of Love
Stevie Nicks,1981,Rock,Bella Donna
Travis Scott,2018,Hip-Hop,Astroworld
Portishead,1994,Trip Hop,Dummy
The Smiths,1986,Alternative Rock,The Queen Is Dead
Calvin Harris,2012,Electronic Dance,18 Months
Rihanna,2016,Pop/R&B,Anti
Dua Lipa,2020,Pop,Future Nostalgia
The Cure,1989,Gothic Rock,Disintegration
Foo Fighters,1997,Alternative Rock,The Colour and the Shape
A Tribe Called Quest,1991,Hip-Hop,The Low End Theory
Massive Attack,1998,Trip Hop,Mezzanine
Gorillaz,2001,Alternative/Hip-Hop,Gorillaz
Depeche Mode,1990,Electronic,Violator
Rage Against The Machine,1992,Rap Metal,Rage Against The Machine
Joy Division,1979,Post-Punk,Unknown Pleasures
Loading

0 comments on commit c125542

Please sign in to comment.