Skip to content

feat(optimizer)!: annotate compress for mysql - #8018

Merged
geooo109 merged 4 commits into
tobymao:mainfrom
PiyaDaswadkar:piya/annotate-fun-compress
Aug 3, 2026
Merged

feat(optimizer)!: annotate compress for mysql#8018
geooo109 merged 4 commits into
tobymao:mainfrom
PiyaDaswadkar:piya/annotate-fun-compress

Conversation

@PiyaDaswadkar

Copy link
Copy Markdown
Contributor

Comment thread sqlglot/typing/mysql.py Outdated
@geooo109 geooo109 self-assigned this Aug 3, 2026
@PiyaDaswadkar

Copy link
Copy Markdown
Contributor Author

One thing I'm unsure about is the implementation: the existing generic type groups don't seem to match the COMPRESS() mapping exactly (for example, TEXT_TYPES includes CHAR, VARCHAR, and TINYTEXT, which have different output types here). Would you prefer that I add new reusable groups in datatypes.py, or should I list the types explicitly in _annotate_compress?

@geooo109

geooo109 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@PiyaDaswadkar let's create sets in the mysql typing file.

@PiyaDaswadkar

Copy link
Copy Markdown
Contributor Author

Updated the COMPRESS annotation based on the MySQL type mappings you provided. I added dedicated input type sets in mysql.py and moved COMPRESS from the fixed return type mapping to a custom annotator. Also added fixture coverage for LONGBLOB, BLOB, and VARBINARY output cases.

Comment thread sqlglot/typing/mysql.py Outdated
Comment thread sqlglot/typing/mysql.py Outdated
@PiyaDaswadkar

Copy link
Copy Markdown
Contributor Author

Done, I updated the implementation to reuse TEXT_TYPES where appropriate and removed the unnecessary single-type set. I also updated the tests accordingly.

@geooo109 geooo109 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@PiyaDaswadkar I will take this PR to the finish line, thanks!

@geooo109
geooo109 merged commit 760acbb into tobymao:main Aug 3, 2026
8 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.

2 participants