Skip to content

feat: Allow idents to contain . with backticks - #1079

Merged
aljazerzen merged 6 commits into
semanticfrom
semantic-ident
Oct 25, 2022
Merged

aljazerzen merged 6 commits into
semanticfrom
semantic-ident

Conversation

@max-sixty

Copy link
Copy Markdown
Member

RIP Ident, long live Ident!

I suggested namespace & name as the two fields; is that reasonable?

(We should merge this soon to prevent conflicts)

@max-sixty
max-sixty requested a review from aljazerzen October 25, 2022 05:38
impl From<String> for Ident {
fn from(name: String) -> Self {
impl Ident {
pub fn new_name<S: ToString>(name: S) -> Self {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK nice, thanks. Maybe I call this from_name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I look at new_name I don't know what I was thinking when choosing it! from_name is much better.

Comment thread prql-compiler/src/sql/codegen.rs Resolved
Comment thread prql-compiler/src/lib.rs
use insta::{assert_display_snapshot, assert_snapshot};

#[test]
#[ignore]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We can run with --ignored to get all the tests (though I'm not sure it's like python which will flag xfail tests that pass)

Comment on lines 97 to 104

if let Some(tid) = self.columns_loc.get(cid) {
let table = self.columns_loc.get(cid).map(|tid| {
let table = self.table_defs.get(tid).unwrap();

format!("{}.{}", table.name, col_name)
} else {
col_name
}
table.name.clone()
});
(table, col_name)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, materialize_name was concatinating table name and var name. We separated them for the whole pipeline, but merged them together as a last step before split them back up in translate_ident.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much nicer!

(also fine to point me towards things like this, also fine to DIY like this tho)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry I took over your PR :D I was excited to see it mostly done, because I knew it composes well with other parts of translator.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prob at all — thanks for finishing it!

Comment thread prql-compiler/src/sql/codegen.rs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants