Skip to content

Conversation

@morningman
Copy link
Contributor

morningman and others added 2 commits June 29, 2025 21:55
…che#51471)

Add new jdbc catalog property: `function_rules`.
This property will enable user to customize which function can be pushed
down to jdbc datasource,
and which function should be rewrote to function in jdbc datasource:

eg:
```
create catalog jdbc properties (
    ...
    'function_rules' = '{"pushdown" : {"supported": ["to_date"], "unsupported" : ["abs"]}, "rewrite" : {"to_date" : "date2"}}'
)
```
The value is a json format config:
- `pushdown`: the value of `pushdown` is a map, the `supported` array
indicate the function that can be pushed down to datasource. the
`unsupported` array indicate the function that can not.
- `rewrite`: the value of `rewrite` is map, if the function can be
pushed down to datasource, it will be renamed to the value in rewrite
map.

eg:
```
select * from jdbc_table where abs(k1) > 0 and to_date("k2") = "2022-10-10"
```
will generate sql:
```
select * from jdbc_table where date2("k2") = "2022-10-10"
```

You can see the `abs()` is not pushed down, and `to_date()` is rewrote
to `date2()`.

-------
This change is compatible with previous version.
Previously, there are some hard coded function rules, and also a FE
config `jdbc_mysql_unsupported_pushdown_functions`.

Doris will merge the user specified `function_rules` and the above
rules.
@morningman morningman requested a review from morrySnow as a code owner June 29, 2025 13:58
@Thearas
Copy link
Contributor

Thearas commented Jun 29, 2025

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morningman morningman changed the title branch-3.1: [feat](jdbc) support custom function rules in catalog properties (#51471)(#51787) branch-3.1: [feat][fix](jdbc) support custom function rules in catalog properties (#51471)(#51787) Jun 29, 2025
@morningman
Copy link
Contributor Author

run buildall

@morrySnow morrySnow changed the title branch-3.1: [feat][fix](jdbc) support custom function rules in catalog properties (#51471)(#51787) branch-3.1: [feat][fix](jdbc) support custom function rules in catalog properties #51471 #51787 Jun 30, 2025
@morrySnow morrySnow merged commit 7d372b1 into apache:branch-3.1 Jun 30, 2025
20 of 22 checks passed
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.

4 participants