Skip to content

Commit

Permalink
Start hooking up to Trino
Browse files Browse the repository at this point in the history
A few SQL tests pass, but not many. We added a modular "transforms"
system.

Many thanks to Dave for pairing!
  • Loading branch information
emk committed Oct 18, 2023
1 parent cd2584a commit 65b8c64
Show file tree
Hide file tree
Showing 14 changed files with 873 additions and 172 deletions.
130 changes: 130 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ joinery_macros = { path = "joinery_macros" }
once_cell = "1.18.0"
peg = "0.8.1"
phf = { version = "0.11.2", features = ["macros"] }
# Waiting on https://github.com/nooberfsh/prusto/issues/33
prusto = { git = "https://github.com/nooberfsh/prusto.git" }
regex = "1.10.0"
rusqlite = { version = "0.29.0", features = ["bundled", "functions", "vtab"] }
serde = { version = "1.0.188", features = ["derive"] }
Expand Down
8 changes: 5 additions & 3 deletions joinery_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ pub fn emit_macro_derive(input: TokenStream) -> TokenStream {

fn impl_emit_macro(ast: &syn::DeriveInput) -> TokenStream2 {
let name = &ast.ident;
let (impl_generics, ty_generics, where_clause) = &ast.generics.split_for_impl();
quote! {
impl Emit for #name {
impl #impl_generics Emit for #name #ty_generics #where_clause {
fn emit(&self, t: Target, f: &mut fmt::Formatter<'_>) -> fmt::Result {
<#name as EmitDefault>::emit_default(self, t, f)
<#name #ty_generics as EmitDefault>::emit_default(self, t, f)
}
}
}
Expand All @@ -35,9 +36,10 @@ pub fn emit_default_macro_derive(input: TokenStream) -> TokenStream {
/// TODO: If we see `#[emit(skip)]` on a field, we should skip it.
fn impl_emit_default_macro(ast: &syn::DeriveInput) -> TokenStream2 {
let name = &ast.ident;
let (impl_generics, ty_generics, where_clause) = &ast.generics.split_for_impl();
let implementation = emit_default_body(name, &ast.data);
quote! {
impl EmitDefault for #name {
impl #impl_generics EmitDefault for #name #ty_generics #where_clause {
fn emit_default(&self, t: Target, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#implementation
}
Expand Down
4 changes: 2 additions & 2 deletions src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl FunctionCallCounts {
name.push('*');
} else {
// Push '_' separated by ','.
for i in 0..function_call.args.nodes.len() {
for (i, _) in function_call.args.node_iter().enumerate() {
if i > 0 {
name.push(',');
}
Expand All @@ -62,7 +62,7 @@ impl FunctionCallCounts {
.unescaped_bigquery()
.to_ascii_uppercase(),
);
for i in 0..special_date_function_call.args.nodes.len() {
for (i, _) in special_date_function_call.args.node_iter().enumerate() {
if i > 0 {
name.push(',');
}
Expand Down
Loading

0 comments on commit 65b8c64

Please sign in to comment.