Thanks, Justin. For now, it’s enough to know that they have types.
If we hit the requirement that Calcite’s validator needs to know that (say)
there is a variable called ‘FOO’ and its type is ’TIMESTAMP’ then we can use a
plug-in map or even the SqlOperatorTable (modeling variables as functions
Hi,
They are strongly typed. Many are strings that can only be set to certain
legal values (like optmizer_switch). These variables can also be used in
MySQL SET statements. Note that there is no way to easily type the
variables except by examining their values, in the performance_schema (at
We’d be open to adding support, but it must not be the default behavior, so
there will be need to be some kind of flag.
Can you log a JIRA case with the subject ’Support variables with “@" and “@@"
prefixes (like MySQL)’. Then we can write a specification and you can submit a
pull request.
At
A couple more questions. Do these variables have well-defined types? Do they
have to be valid expressions? If the answer to either of these questions is
’no’ then maybe they are what Oracle calls ’substitution variables’.
Substitution variables have a behavior more like C macros than real
Would you be open to a patch to add proper support for this kind of MySQL
variables, or do you consider it to be outside the scope of Calcite?
On 2022/03/22 21:52:09 Justin Swanhart wrote:
> MySQL support two categories of variables, user variables which are
> prefixed with the @character and
MySQL support two categories of variables, user variables which are
prefixed with the @character and session/global SERVER variables which are
prefixed with @@.
You can also access them via:
Select @@session.session_var;
Select @@global.global_var;
select @@session_or_global_var;
for example:
The ‘@@‘ prefix is not standard SQL, and Calcite does not support it.
Can you do some research to find out how MySQL handles it. Is it considered to
be part of the variable name? Or is it a prefix (like $ in bash) that means
‘what comes next is a variable’? In other words, does the parser say
Hi there,
I am writing a MySQL-compatible server that talks the MySQL protocol. Some
clients are sending special queries to autoconfigure themselves, like "SELECT
@@character_set_server". I would like to use calcite to parse such queries, but
parsing fails with an exception, seemingly related