-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Replace predicate pushdown in the Faker connector with column properties #24323
Replace predicate pushdown in the Faker connector with column properties #24323
Conversation
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerColumnHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerColumnHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerConnector.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerConnector.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerConnector.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerPageSource.java
Outdated
Show resolved
Hide resolved
import static java.util.Objects.requireNonNull; | ||
|
||
public record FakerColumnHandle( | ||
int columnIndex, | ||
String name, | ||
Type type, | ||
double nullProbability, | ||
String generator) | ||
String generator, | ||
String min, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use Optionals please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? We handle all cases when the value is null.
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments. looks nice
This pull request has gone a while without any activity. Tagging for triage help: @mosabua |
I'm still working on this. |
f40d354
to
b2f98a5
Compare
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerColumnHandle.java
Show resolved
Hide resolved
plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java
Outdated
Show resolved
Hide resolved
90ee9b7
to
67d40c5
Compare
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerConnector.java
Outdated
Show resolved
Hide resolved
67d40c5
to
ca22d61
Compare
Allow constraining generated values by setting the min, max, or allowed_values column properties.
Predicate pushdown in the Faker connector violates the SQL semantics, because when applied to separate columns, correlation between columns is not preserved, and returned results are not deterministic. The `min`, `max`, and `options` column properties should be used instead.
ca22d61
to
2e7ea07
Compare
2e7ea07
to
383869e
Compare
@@ -166,7 +175,7 @@ Faker supports the following non-character types: | |||
- `UUID` | |||
|
|||
You can not use generator expressions for non-character-based columns. To limit | |||
their data range, specify constraints in the `WHERE` clause - see | |||
their data range, set the `min` and/or `max` column properties - see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use "and" ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in #24585, I haven't updated the docs there yet.
@@ -102,6 +102,15 @@ The following table details all supported column properties. | |||
sentence from the | |||
[Lorem](https://javadoc.io/doc/net.datafaker/datafaker/latest/net/datafaker/providers/base/Lorem.html) | |||
provider. | |||
* - `min` | |||
- Minimum generated value (inclusive). Cannot be set for character-based type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does it work for numeric and also date types?
Description
Predicate pushdown in the Faker connector violates the SQL semantics,
because when applied to separate columns, correlation between columns is
not preserved, and returned results are not deterministic. The
min
,max
, andallowed_values
column properties should be used instead.Fixes #24147
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: