Commit eadeca2
Migrate existing UDFs to PPLFuncImpTable (#3576)
* refactor using timestmap
Signed-off-by: xinyual <xinyual@amazon.com>
* refactor for timestmap
Signed-off-by: xinyual <xinyual@amazon.com>
* transfer basic functions
Signed-off-by: xinyual <xinyual@amazon.com>
* add functions
Signed-off-by: xinyual <xinyual@amazon.com>
* Refactor math UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor text UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix function name resolving when system using Turkic languages
- Problem: FunctionName.of(UPPER_CASE_I) could not be properly resolved since I is converted to dotless ı
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor date part, date/time manipulation UDFs
- date part: hour, hour_of_day, month_of_year, month, dayofweek, day_of_week, day, dayofyear, day_of_year, dayofmonth, day_of_month, minute_of_day, minute_of_hour, minute, quarter, second, second_of_minute, microsecond
- date/time manipulation: addtime, adddate, date_sub, date_add, subtime, subdate, extract
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor current, name, format UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor convert tz, date/timestamp diff UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor date / time functions with non-date/time arguments
by creating an adapt function to convert an expr function to a UDF
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor datetime, sec_to_time, time_to_sec, sysdate, timestampadd, timediff UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor week, nullif, ifnull, if UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Remove BuiltinFunctionUtils and unnecessary UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Patch: throw proper semantic errors for date_part-related udfs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix bugs in datetime UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: move all udf to org.opensearch.sql.expression.function.udf
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* use timestamp to replace post process
Signed-off-by: xinyual <xinyual@amazon.com>
* Add more ITs for last day & restore Prometheus settings
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix euler with UDF instead of directly returning a literal to match its logical plan
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Reimplment last_day UDF with expr methods
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Ignore tests related to parameter validaton temporarily since it's in another PR
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Deprecate timestamp string as data context for function properties
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: unify datetime udf structures
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Apply spotless & fix zone id acquirement
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix unixtimestamp from double when locale uses non-arabic numbers
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Box operands so that relection calls match signatures containing non-primitive types
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Use system default time zone when restoring function properties
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor return types
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Use builtin case and coalesce to implement if, ifnull, nullif UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Replace replace UDF with builtin implementations & add docs for replace, locate
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Correct locate function documents
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Separate adddate and date_add implementations for readability
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Add class documentations for UDFs
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Create PPLReturnTypes class to store common return types that it not covered in calcite ReturnTypes class
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Remove udf operators with the same implementations but different names
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in Add/Sub Date function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: update add/sub time's implementation with adaptExprMethodWithPropertiesToUDF
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in last day function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: implement date function with adaptExprMethodToUDF
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in extract function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in format function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in timestampdiff function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: Move type comparison earlier in weekday function implementation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: split add and sub date to 2 static functions
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Eliminate convertRelDataTypeToSqlTypeName API, replacing it with ExprType comparision
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: pass expr values to udf implementations instead of passing java object and expr type separately
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: unify types in udf to use expr types (deprecating SqlTypeName)
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Refactor: change return types of UDF implementations to their actual return types (instead of Object)
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Add a test to unix_timestamp with microseconds
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Minor: fix calcite datetime tests
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Replace sqrt udf with a call to calcite's power(x, 0.5)
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Replace locate udf with SqlStdOperatorTable.POSITION
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix sqrt logical plan test
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Fix expectedSparkSql in sqrt test
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
---------
Signed-off-by: xinyual <xinyual@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Co-authored-by: xinyual <xinyual@amazon.com>1 parent 1c046a2 commit eadeca2
105 files changed
Lines changed: 3584 additions & 4465 deletions
File tree
- core/src/main/java/org/opensearch/sql
- calcite
- udf
- conditionUDF
- datetimeUDF
- mathUDF
- textUDF
- utils
- datetime
- expression
- datetime
- function
- udf
- datetime
- math
- docs/user/ppl/functions
- integ-test/src/test/java/org/opensearch/sql/calcite/standalone
- ppl/src/test/java/org/opensearch/sql/ppl/calcite
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | | - | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| |||
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | | - | |
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
| |||
60 | 56 | | |
61 | 57 | | |
62 | 58 | | |
63 | | - | |
64 | | - | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
68 | 62 | | |
69 | 63 | | |
70 | 64 | | |
71 | 65 | | |
| 66 | + | |
72 | 67 | | |
73 | 68 | | |
74 | 69 | | |
| |||
220 | 215 | | |
221 | 216 | | |
222 | 217 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | 218 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 219 | + | |
235 | 220 | | |
236 | 221 | | |
237 | 222 | | |
| |||
351 | 336 | | |
352 | 337 | | |
353 | 338 | | |
354 | | - | |
| 339 | + | |
355 | 340 | | |
356 | 341 | | |
357 | 342 | | |
358 | 343 | | |
359 | 344 | | |
360 | 345 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 346 | + | |
374 | 347 | | |
375 | 348 | | |
376 | 349 | | |
| |||
Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 0 additions & 34 deletions
This file was deleted.
0 commit comments