[Good First Issue] Support All SQL Functions in Other SQL System
- Dominant language
- Java
- Stars
- 15.9k
- Forks
- 3.9k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 520
Description
UPDATE:
**Hey guys, considering the current capabilities of LLMs, especially for this specific set of cases, we can already generate PRs that meet quality and requirement standards within minutes using the agents available on Github. Therefore, we will no longer invest a lot of effort into this. If you're interested in implementing these cases, I recommend you have in-depth discussions with AI, fully understand the code you need to submit, and then directly submit the PR. PRs involving new functions will automatically request my review, and I will check them in a timely manner. I will no longer reply to specific comments under this issue.**
**Thanks everyone.**
------
### Description
We plan to implement all SQL functions in other famous DBs, like MySQL, PG, Trino, CK, Hive, and more. Facilitate the users to migrate to Doris. They're very suitable for newcomers as your first Doris PR. So here's the list. Feel free to comment to pick anyone! If one is picked, I will tick it.
## Part I. Hive
- [x] sinh(from Trino), asinh, atanh, acosh (Easy) @ChenMiaoi
- [ ] context_ngrams @noixcn
- [x] factorial (Easy) @K-handle-Y
- [ ] levenshtein @whisper33z
- [ ] encode, decode @hacklu-tu
- [x] soundex
See the newest Hive document for these functions' explanation.
## Part II. Spark
- [x] map_concat (been taken for interview @HappenLee )
- [ ] regexp_extract_all for the third argument
## Part III. Trino&Presto
- [x] regexp_count
- [ ] regexp_position @lsy3993
- [ ] hamming_distance (better with levenshtein together)
- [ ] human_readable_seconds
- [ ] timezone_hour, timezone_minute @om2805
- [ ] GEO FUNCTIONS
- [ ] ST_GeomFromKML
- [ ] ST_Equals, ST_Relate
- [x] ST_Intersects, ST_Disjoint, ST_Touches @koi2000
- [ ] ST_Crosses, ST_Overlaps, ST_Relate, ST_Within
- [ ] ST_Buffer, ST_Boundary, ST_Envelope, ST_EnvelopeAsPts, ST_ExteriorRing
- [ ] geometry_nearest_points, geometry_union, ST_Union
- [ ] ST_Difference, ST_Intersection, ST_SymDifference
- [ ] ST_Centroid, ST_ConvexHull
- [ ] ST_CoordDim, ST_Dimension
- [x] ST_Distance, ST_GeometryType, ST_Length @zxc20041
- [ ] ST_InteriorRingN, ST_InteriorRings, ST_NumInteriorRing
- [ ] ST_GeometryType, ST_IsClosed, ST_IsEmpty, ST_IsSimple, ST_IsRing, ST_IsValid
- [ ] ST_PointN, ST_StartPoint, ST_EndPoint, ST_Points, ST_XMax, ST_XMin, ST_YMax, ST_YMin
- [ ] simplify_geometry
- [ ] ST_NumGeometries, ST_Geometries, ST_NumPoints
- [ ] ARRAY FUNCTIONS
- [ ] dot_product @meox3259
- [ ] trim_array @vajaw
- [ ] ngrams @advisedy
- [ ] combinations @daju233
- [ ] reduce (lambda function) @cypppper
- [ ] sort (add the three arguments with lambda functor version) (Hard)
- [ ] merge(HLL)
- [ ] typeof
- [x] Aggregation Functions
- [x] bool_or, bool_and
## Part IV. DuckDB
- [ ] Math Functions
- [x] even @wumeibanfa
- [x] gcd, lcm @wumeibanfa
- [ ] gamma @Patinlove
- [x] signbit @wumeibanfa
- [ ] String Functions
- [ ] ord @CAICAIIs
- [ ] Vector(Array) Functions
- [ ] cross_product @juruo-c
- [ ] cosine_similarity @Pluto340
- [x] Date Functions
- [x] century @robll-v1
- [ ] Aggregation Functions
- [ ] geomean @0AyanamiRei
- [ ] entropy @wrlcke
- [x] sem @wumeibanfa
- [ ] skew_pop, kurt_pop @mickaelli
- [x] Map Functions
- [x] map_contains_entry @DayuanX
- [x] map_entries @DayuanX
## Part V. MySQL (High Priority)
- [x] [POSITION](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_position)(easy, syntax and alias function) @wumeibanfa
- [x] [EXPORT_SET](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_export-set) (easy)
- [x] [INSERT](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_insert) (take care of utf8) @linrrzqqq
- [x] [MAKE_SET](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_make-set) @linrrzqqq
- [x] [MID](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_mid) @linrrzqqq
- [x] [SUBSTR](https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_substr) (more syntax) @wumeibanfa
- [x] [ATAN2](https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_atan2) WITH TWO ARGS @linrrzqqq
- [x] [CURTIME](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_curtime) WITH MICROSECONDS
- [x] DAYNAME with sysvar [LC_TIME_NAMES](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_lc_time_names) (code could copy from mysql, add session variable) @linrrzqqq
- [x] [GET_FORMAT](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_get-format) @linrrzqqq
- [x] [PERIOD_ADD](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_period-add), [PERIOD_DIFF](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_period-diff)
- [x] [MAKE_TIME](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_maketime) @linrrzqqq
- [x] [SUB_TIME](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_subtime) @dwdwqfwe
- [ ] [TIMESTAMP](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_timestamp) WITH TWO ARGS @linrrzqqq
- [ ] [TIME_FORMAT](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_time-format) @linrrzqqq
- [ ] [TO_SECONDS](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_to-seconds) @dwdwqfwe
- [x] [UTC_DATE](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_utc-date), [UTC_TIME](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_utc-time) @linrrzqqq
- [x] [IS_IPV4](https://dev.mysql.com/doc/refman/8.4/en/miscellaneous-functions.html#function_is-ipv4), [IS_IPV6](https://dev.mysql.com/doc/refman/8.4/en/miscellaneous-functions.html#function_is-ipv6) @Dog-Du
- [x] [INTERVAL](https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#function_interval) @linrrzqqq
## Others
- [ ] json_search with 4th and 5th arguments like MySQL @ChenMiaoi
More tasks is coming...
## Solution
**All the guidelines to implement an SQL function are in https://github.com/apache/doris/issues/48201. Please take a carefully look at!**
Contributor guide
Assessment
This issue has not been assessed yet.