-
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
Use statistics in Faker CTAS #24585
base: master
Are you sure you want to change the base?
Use statistics in Faker CTAS #24585
Conversation
@raunaqmorarka this is the last one, I promise :-) |
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
8af4d29
to
c40b9fa
Compare
@raunaqmorarka and @losipiuk this is ready for a review. It's the last one about Faker, I don't have anything else planned for it. |
@raunaqmorarka @losipiuk a gentle reminder |
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/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
Show resolved
Hide resolved
properties.put(ALLOWED_VALUES_PROPERTY, columnValues.get(column.name()).stream() | ||
.map(value -> Literal.format(column.type(), value)) | ||
.collect(toImmutableList())); |
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.
what is property size limit?
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 don't know, but the max number of values is configurable, with a reasonable default of 1000. This might throw a some exception for big values, but I don't think we have to prevent that.
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
Show resolved
Hide resolved
plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java
Outdated
Show resolved
Hide resolved
plugin/trino-faker/src/main/java/io/trino/plugin/faker/FakerConnector.java
Show resolved
Hide resolved
When creating a table in the Faker connector from an existing table, gather column statistics to determine range constraints, set them as column properties.
When creating a table in the Faker connector from an existing table, using column statistics determine low cardinality columns, and generate values from a randomly generated set.
c40b9fa
to
c2f5400
Compare
Description
Use statistics when using
CREATE TABLE AS SELECT
in the Faker connector to:default_limit
table property to the estimated number of rows from the source tablemin
andmax
column properties based on the statisticsAdditional context and related issues
Previous attempt #24098 was abandoned after #24147 was reported. This time we only use views for sequence columns, and if this is not very useful, we can avoid creating the views automatically. Or this could be yet another column property.
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: