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

Implement SQL String functions with documentations #13

Closed
25 of 28 tasks
AmrDeveloper opened this issue Sep 7, 2023 · 28 comments
Closed
25 of 28 tasks

Implement SQL String functions with documentations #13

AmrDeveloper opened this issue Sep 7, 2023 · 28 comments
Labels
good first issue Good for newcomers

Comments

@AmrDeveloper
Copy link
Owner

AmrDeveloper commented Sep 7, 2023

Implement string function in our engine, one per pull request.

Steps:

  • Choose unimplemented function and write I am on <function_name>.
  • Then start implement the function in crates/gitql-ast/function.rs.
  • Add docs for it in docs/function/function.md.
  • Make sure everything is formatted and submit a Pull Request.
  • Don't forget to mention issue number in pull request title.

Text Functions

  • ASCII
  • CHAR
  • CHARINDEX
  • CONCAT
  • DATALENGTH
  • DIFFERENCE
  • FORMAT
  • LEFT
  • LEN
  • LOWER
  • LTRIM
  • NCHAR
  • PATINDEX
  • QUOTENAME
  • REPLACE
  • REPLICATE
  • REVERSE
  • RIGHT
  • RTRIM
  • SOUNDEX
  • SPACE
  • STR
  • STUFF
  • SUBSTRING
  • TRANSLATE
  • TRIM
  • UNICODE
  • UPPER

For more information about implementation and description check https://www.w3schools.com/sql/sql_ref_sqlserver.asp

Note: You can only open max 3 PR at the time

@AmrDeveloper AmrDeveloper added the good first issue Good for newcomers label Sep 7, 2023
@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

I am on ASCII

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

I am on CHAR

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

@AmrDeveloper , the CHARINDEX function might be tricky since the last argument is optional, but the condition checks if the specified arguments match, I mean here .

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

I am on DATALENGTH.
Also, you made a typo for DATALENGTH in the list

@AmrDeveloper
Copy link
Owner Author

@AmrDeveloper , the CHARINDEX function might be tricky since the last argument is optional, but the condition checks if the specified arguments match, I mean here .

You are right some functions we will delay them until do some improvements in type system

AmrDeveloper added a commit that referenced this issue Sep 7, 2023
@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

I am on LEFT

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 7, 2023

@AmrDeveloper, is there a difference between the implementation of NCHAR and CHAR at least in Rust, since all characters are just u32s under the hood and just casting from the number will be the same.

AmrDeveloper added a commit that referenced this issue Sep 8, 2023
AmrDeveloper added a commit that referenced this issue Sep 8, 2023
AmrDeveloper added a commit that referenced this issue Sep 8, 2023
@AmrDeveloper
Copy link
Owner Author

NCHAR

You are right, we can ignore it for now and maybe if needed we can pass the the char function to it

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 8, 2023

NCHAR

You are right, we can ignore it for now and maybe if needed we can pass the the char function to it

Yeahh, that was I planned on doing, wanted to get your approval on it.

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 8, 2023

I am on PATINDEX

@AmrDeveloper
Copy link
Owner Author

NCHAR

You are right, we can ignore it for now and maybe if needed we can pass the the char function to it

Yeahh, that was I planned on doing, wanted to get your approval on it.

I faced the same problem in Date functions too we need to decide if we should duplicate them or take only one

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 9, 2023

NCHAR

You are right, we can ignore it for now and maybe if needed we can pass the the char function to it

Yeahh, that was I planned on doing, wanted to get your approval on it.

I faced the same problem in Date functions too we need to decide if we should duplicate them or take only one

We could just use different names for them but they'll still be the same function. What I mean is:

  map.insert("char", text_char);
  map.insert("nchar", text_char);

And we do the same in the PROTOTYPES hashmap too

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 9, 2023

I am on REPLACE

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 9, 2023

I am on RIGHT

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 9, 2023

I am on STUFF

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 9, 2023

I am on SUBSTRING

AmrDeveloper added a commit that referenced this issue Sep 11, 2023
AmrDeveloper added a commit that referenced this issue Sep 12, 2023
AmrDeveloper added a commit that referenced this issue Sep 12, 2023
AmrDeveloper added a commit that referenced this issue Sep 13, 2023
@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 13, 2023

I am on TRANSLATE

@AmrDeveloper
Copy link
Owner Author

@Lilit0x Lets keep next PR one by one it will be fast to review and merge

@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 13, 2023

Okay, got it.

AmrDeveloper added a commit that referenced this issue Sep 13, 2023
@Lilit0x
Copy link
Contributor

Lilit0x commented Sep 13, 2023

I am on SOUNDEX

@tbro
Copy link
Contributor

tbro commented Sep 14, 2023

I am on CONCAT

tbro added a commit to tbro/GQL that referenced this issue Sep 14, 2023
For Issue AmrDeveloper#13.

cargo fmt
tbro added a commit to tbro/GQL that referenced this issue Sep 14, 2023
@tbro
Copy link
Contributor

tbro commented Sep 14, 2023

I am on UNICODE

AmrDeveloper added a commit that referenced this issue Sep 14, 2023
AmrDeveloper added a commit that referenced this issue Sep 15, 2023
@mobley-trent
Copy link
Contributor

I am on CHARINDEX

@mobley-trent
Copy link
Contributor

Hello @AmrDeveloper how do we handle optional arguments ?

@AmrDeveloper
Copy link
Owner Author

@mobley-trent Optional type is not implemented yet, i just implemented Variant and will implement Option soon

@AmrDeveloper
Copy link
Owner Author

@mobley-trent Now support Optional and varargs types

@frectonz
Copy link
Contributor

@AmrDeveloper NCHAR is already implemented but it's not marked as complete in the task list.

2024-02-26T04:57:57,788529872+03:00

@frectonz
Copy link
Contributor

I am on QUOTENAME

AmrDeveloper added a commit that referenced this issue Feb 26, 2024
add `quotename` string function #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants