Skip to content
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

[FEAT]: sql image_encode and image_resize #2764

Merged

Conversation

universalmind303
Copy link
Collaborator

depends on #2757

@github-actions github-actions bot added the enhancement New feature or request label Aug 29, 2024
Copy link

codspeed-hq bot commented Aug 29, 2024

CodSpeed Performance Report

Merging #2764 will degrade performances by 51.78%

Comparing universalmind303:sql-image-functions-2 (7462a78) with main (734c13f)

Summary

❌ 2 regressions
✅ 14 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main universalmind303:sql-image-functions-2 Change
test_count[1 Small File] 11.2 ms 23.2 ms -51.78%
test_show[100 Small Files] 49.6 ms 57 ms -12.9%

@universalmind303 universalmind303 changed the title [FEAT]: sql image_encode [FEAT]: sql image_encode and image_resize Aug 29, 2024
arg,
operator: FunctionArgOperator::Assignment,
} => match name.value.as_ref() {
"w" | "width" => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm how would be document this behavior? I'm guessing we're going to need a separate documentation page for SQL (or at least some kind of unified documentation across SQL and Python expressions) in which we should also document the argument naming behavior?

Copy link
Member

@kevinzwang kevinzwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

}

#[typetag::serde]
impl ScalarUDF for ImageEncode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not relevant to this PR but why do we call this ScalarUDF when it is not user defined? Might be a good item to change when we clean up our expressions during clean up week.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea was that they are "user defined", but these initial ones are managed by us. Eventually exposing an interface for third party udfs using the same underlying system.

src/daft-sql/src/functions.rs Outdated Show resolved Hide resolved
SQLExpr::Tuple(_) => unsupported_sql_err!("TUPLE"),
// Similar to rust and python conventions, tuples always have a fixed size,
// so we convert them to a fixed size list.
SQLExpr::Tuple(exprs) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are tuples in SQL used? As in, do we have a supported SQL query/expression using tuples right now? Just curious

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this here updates our sql support to include support for tuples.

you can use them anywhere exprs are accepted now.

fsl_from_sql = daft.sql_expr('(1, 2, 3)')

this is the functional equivalent of

fsl_from_python = daft.lit(
    (1, 2, 3)
).cast(daft.DataType.fixed_size_list(daft.DataType.int64(), 3))

src/daft-dsl/src/lit.rs Show resolved Hide resolved
@kevinzwang
Copy link
Member

Feel free to merge once you make all the requested changes btw

@universalmind303 universalmind303 merged commit 00528ea into Eventual-Inc:main Sep 4, 2024
32 of 33 checks passed
@universalmind303 universalmind303 deleted the sql-image-functions-2 branch September 4, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants