GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.36k stars 315 forks source link

Find a better way to deal with mysql's special federated queries #1712

Open MichaelScofield opened 1 year ago

MichaelScofield commented 1 year ago

What type of enhancement is this?

Refactor

What does the enhancement do?

Some mysql tools or protocols will emit special queries upon connection established. For example, sqlalchemy's SHOW VARIABLES LIKE 'sql_mode', DBeaver's SHOW WARNINGS or simply select 1. We are currently using regex to pattern matching these special federated queries, then return static, fake values, just like what Databend does. Instead of really executing them. It seems like a quick and dirty way to resolve the problems, but we are not trying to be compatible with the whole of mysql, so I think we can live with that. So I'm hesitating to label this issue as "wont fix" ...

Implementation challenges

No response

tisonkun commented 11 months ago

An issue I found for the regex matching way is that it's too tight to tolerate whitespace. So perhaps a special handle after tokenizer is needed instead of matching plain text.