Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for data type specific methods #1535

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yoavcloud
Copy link
Contributor

This PR adds support for static method invocations of data type-specific methods. For example:
SELECT geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656 )', 4326)

See more here: https://learn.microsoft.com/en-us/sql/t-sql/spatial-geography/spatial-types-geography?view=sql-server-ver16

Comment on lines +1228 to +1236
let namespace = w.value;
self.expect_token(&Token::DoubleColon)?;
let name_with_namespace = match self.next_token().token {
Token::Word(func_name) => {
ObjectName(vec![Ident::new(format!("{}::{}", namespace, func_name.value))])
},
_ => return self.expected("identifier", self.peek_token())
};
Ok(self.parse_function(name_with_namespace)?)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the body to a self.parse_namespaced_method(w)? or similar function? Also if we can add an example syntax to the function doc with the link to clarify the syntax

@@ -11550,6 +11550,14 @@ fn parse_method_expr() {
}
_ => unreachable!(),
}

dialects.verified_stmt(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a scenario in the style of a::b::c().d()?

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