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

[CALCITE-6800] Enable a few existing functions to HIVE library #4165

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

xuzifu666
Copy link
Member

@xuzifu666 xuzifu666 commented Jan 24, 2025

Enable some methods to hive which had already been implemented for other libraries.
issue: https://issues.apache.org/jira/browse/CALCITE-6800
supported functions as follow:

  1. DATE_ADD
  2. DATE_SUB
  3. DECODE
  4. LPAD
  5. RPAD
  6. LTRIM
  7. RTRIM
  8. SPACE
  9. GREATEST
  10. LEAST
  11. REGEXP_REPLACE_3
  12. REPEAT
  13. SOUNDEX
  14. TO_DATE
  15. MD5
  16. SHA1
  17. LOG_MYSQL

Copy link
Member

@caicancai caicancai left a comment

Choose a reason for hiding this comment

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

It seems that the bounds test of the function is not considered for the time being.

LGTM

@xuzifu666 xuzifu666 force-pushed the calcite-6241 branch 2 times, most recently from 79cfb54 to 440101a Compare January 24, 2025 06:14
@ILuffZhe
Copy link
Contributor

@xuzifu666 The CI failed ,please make sure your change can pass on your machine, then push it so we can go forward.

@xuzifu666 xuzifu666 force-pushed the calcite-6241 branch 3 times, most recently from f54e426 to dc885b1 Compare January 24, 2025 11:11
@xuzifu666 xuzifu666 closed this Jan 24, 2025
@xuzifu666 xuzifu666 reopened this Jan 24, 2025
@xuzifu666
Copy link
Member Author

@xuzifu666 The CI failed ,please make sure your change can pass on your machine, then push it so we can go forward.

@ILuffZhe CI is success, PTAL when you are free time, thanks~

Copy link
Contributor

@ILuffZhe ILuffZhe left a comment

Choose a reason for hiding this comment

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

It's really close now, could you please take a look? @xuzifu666

site/_docs/reference.md Show resolved Hide resolved
@xuzifu666
Copy link
Member Author

@ILuffZhe addressed,thanks for your review,PTAL

@@ -2852,7 +2852,7 @@ In the following:
| b | DATE(string) | Equivalent to `CAST(string AS DATE)`
| b | DATE(year, month, day) | Returns a DATE value for *year*, *month*, and *day* (all of type INTEGER)
| q r f | DATEADD(timeUnit, integer, datetime) | Equivalent to `TIMESTAMPADD(timeUnit, integer, datetime)`
| q r f | DATEDIFF(timeUnit, datetime, datetime2) | Equivalent to `TIMESTAMPDIFF(timeUnit, datetime, datetime2)`
| q r f h | DATEDIFF(timeUnit, datetime, datetime2) | Equivalent to `TIMESTAMPDIFF(timeUnit, datetime, datetime2)`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a unintentional mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Had removed it.

@ILuffZhe
Copy link
Contributor

ILuffZhe commented Jan 25, 2025

Hi @xuzifu666 , you don't need to force-push every time, which makes it not easier to review.
In this case, make sure all the functions enabled in Hive library is document in reference.md, and SqlOperatorTest should also cover those functions (the last commit still missed some tests).
Please take a look and cc me when you are ready.

By the way, I think it might be better to add a new JIRA ticket, CALCITE-6241 is for Spark library.

@ILuffZhe ILuffZhe self-assigned this Jan 25, 2025
@xuzifu666 xuzifu666 changed the title [CALCITE-6241] Enable a few existing functions to hive library [CALCITE-6800] Enable a few existing functions to hive library Jan 25, 2025
@xuzifu666
Copy link
Member Author

xuzifu666 commented Jan 25, 2025

Hi @xuzifu666 , you don't need to force-push every time, which makes it not easier to review. In this case, make sure all the functions enabled in Hive library is document in reference.md, and SqlOperatorTest should also cover those functions (the last commit still missed some tests). Please take a look and cc me when you are ready.

By the way, I think it might be better to add a new JIRA ticket, CALCITE-6241 is for Spark library.

Very thanks for your remind, I had add all changes in doc and add all cases in Test, I also make a new jira https://issues.apache.org/jira/browse/CALCITE-6800 about the pr, due to had a keyword 'hive' in title which not pass for ut, so I had rebase for the error, PTAL when you free time. @ILuffZhe

@xuzifu666 xuzifu666 changed the title [CALCITE-6800] Enable a few existing functions to hive library [CALCITE-6800] Enable a few existing functions to HIVE library Jan 25, 2025
@ILuffZhe
Copy link
Contributor

It seems your changes in PR is not consistent with what described in JIRA.

@xuzifu666
Copy link
Member Author

xuzifu666 commented Jan 26, 2025

It seems your changes in PR is not consistent with what described in JIRA.

This pr is aim to enable some existing functions to Hive library, I had changed update jira for all functions. Would you please give a review again please. Thanks~ @ILuffZhe

@ILuffZhe
Copy link
Contributor

It seems your changes in PR is not consistent with what described in JIRA.

This pr is aim to enable some existing functions to Hive library, I had changed purpose about it. Would you give some advice if it is not fitable. Thanks~ @ILuffZhe

This case should only enable existing functions which have the same behavior in Hive.
If not, maybe we should file a new JIRA ticket and implement it if you want.

@xuzifu666
Copy link
Member Author

xuzifu666 commented Jan 26, 2025

It seems your changes in PR is not consistent with what described in JIRA.

This pr is aim to enable some existing functions to Hive library, I had changed purpose about it. Would you give some advice if it is not fitable. Thanks~ @ILuffZhe

This case should only enable existing functions which have the same behavior in Hive.
If not, maybe we should file a new JIRA ticket and implement it if you want.

This case is only enable existing functions which have the same behavior in Hive,not implement for new functions,so keep it can be fine without file a new jira ticket or can merge this pr firstly? @ILuffZhe

@xuzifu666 xuzifu666 requested a review from ILuffZhe January 27, 2025 10:06
@xuzifu666
Copy link
Member Author

@rubenada could you give a final review,thanks~

@caicancai caicancai added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jan 29, 2025
@rubenada
Copy link
Contributor

Overall looks good, one minor comment:

  • SPACE is missing from the list of functions on the PR / Jira description, but it was added in the code
  • INSTR is part of the list; however this function was already defined for Hive

@ILuffZhe
Copy link
Contributor

It seems your changes in PR is not consistent with what described in JIRA.

This pr is aim to enable some existing functions to Hive library, I had changed purpose about it. Would you give some advice if it is not fitable. Thanks~ @ILuffZhe

This case should only enable existing functions which have the same behavior in Hive.
If not, maybe we should file a new JIRA ticket and implement it if you want.

This case is only enable existing functions which have the same behavior in Hive,not implement for new functions,so keep it can be fine without file a new jira ticket or can merge this pr firstly? @ILuffZhe

Sorry for the delay, been a little busy these days.

Copy link
Contributor

@ILuffZhe ILuffZhe left a comment

Choose a reason for hiding this comment

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

LGTM. Just s few comments @rubenada left should be addressed.

@xuzifu666
Copy link
Member Author

Overall looks good, one minor comment:

  • SPACE is missing from the list of functions on the PR / Jira description, but it was added in the code
  • INSTR is part of the list; however this function was already defined for Hive

@rubenada Thanks for your reminder, 2 is fixed now, and 1 I had added a space in the funtion list of PR / Jira description.

@rubenada
Copy link
Contributor

@xuzifu666 sorry, but IIANM the list of functions in the description of the Jira/PR is still inaccurate: it mentions INSTR function (and it shouldn't, since this function was already defined for Hive); and it does not mention the SPACE function (and it should, since the changes consider it). Basically INSTR should be replaced by SPACE in the list, or am I missing something?

@xuzifu666
Copy link
Member Author

xuzifu666 commented Jan 30, 2025

@xuzifu666 sorry, but IIANM the list of functions in the description of the Jira/PR is still inaccurate: it mentions INSTR function (and it shouldn't, since this function was already defined for Hive); and it does not mention the SPACE function (and it should, since the changes consider it). Basically INSTR should be replaced by SPACE in the list, or am I missing something?

Oh, it's my mistake, very sorry and I had removed INSTR and added SPACE to description of JIRA/PR and addressed all comments, very thanks for your review.@rubenada

@caicancai caicancai merged commit f10d0ce into apache:main Jan 31, 2025
20 checks passed
@caicancai
Copy link
Member

@rubenada @ILuffZhe thanks for your review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM-will-merge-soon Overall PR looks OK. Only minor things left.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants