Git Product home page Git Product logo

Comments (10)

LYZJU2019 avatar LYZJU2019 commented on September 26, 2024 2

Can I have a try?

from greptimedb.

killme2008 avatar killme2008 commented on September 26, 2024 1

Hi @killme2008 ,

Sorry for delay reply. After searching the mysql cli source code and trying mysql cli myself, I find it seems hard to just display headers without data. Maybe we should add a simple status or an empty row as a placeholder to display the header.

Here is the mysql cli output.

MySQL [(none)]> select VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.4.1     |
+-----------+
1 row in set (0.001 sec)

MySQL [(none)]> show status where Variable_name='non-existed';
Empty set (0.002 sec)

Here is mysql cli code in display data.

https://github.com/mysql/mysql-server/blob/527c12ed611f3fe072c3043734319edb2c733099/client/mysql.cc#L3702-L3714

      if (!mysql_num_rows(result) && !quick && !column_types_flag) {
        my_stpcpy(buff, "Empty set");
        if (opt_xml) {
          /*
            We must print XML header and footer
            to produce a well-formed XML even if
            the result set is empty (Bug#27608).
          */
          init_pager();
          print_table_data_xml(result);
          end_pager();
        }
  }

It will directly print fixed string "Empty set" as response. The column_types_flag is a mysql-cli flag. After enabling it with mysql --column-type-info -h **** -P **** -u **** -p, I got below output.

MySQL [(none)]> show status where Variable_name='non-existed';
Field   1:  `Variable_name`
Org_field:  `Variable_name`
Catalog:    `def`
Database:   `performance_schema`
Table:      `session_status`
Org_table:  `session_status`
Type:       VAR_STRING
Collation:  utf8mb3_general_ci (33)
Length:     192
Max_length: 0
Decimals:   0
Flags:      NOT_NULL NO_DEFAULT_VALUE

Field   2:  `Value`
Org_field:  `Value`
Catalog:    `def`
Database:   `performance_schema`
Table:      `session_status`
Org_table:  `session_status`
Type:       VAR_STRING
Collation:  utf8mb3_general_ci (33)
Length:     3072
Max_length: 0
Decimals:   0
Flags:


0 rows in set (0.008 sec)

The column info should have been contained in response data and just doesn't be displayed in mysql cli.

Could we have a simple status for Variable_name and make the response not empty to display column headers?

Best Regards, Edward

Thank you for your investigation. Looks like the MySQL CLI doesn't display the header when the records are empty.

It already set the correct schema at

let schema = Arc::new(Schema::new(vec![
ColumnSchema::new("Variable_name", ConcreteDataType::string_datatype(), false),
ColumnSchema::new("Value", ConcreteDataType::string_datatype(), true),
]));

So i think this issue can be closed.

from greptimedb.

LYZJU2019 avatar LYZJU2019 commented on September 26, 2024

I am confused about where to get the value of server status variables. It seems that Greptime does not have a performance_schema table, which is used to inspect the internal execution of the server at runtime. The information_schema table provides metadata about the database but does not reflect the current state of the server.

from greptimedb.

WenyXu avatar WenyXu commented on September 26, 2024

... but does not reflect the current state of the server

Yes, we may need a place(a global status registry or something else) to track all related info. cc @killme2008 @MichaelScofield

from greptimedb.

MichaelScofield avatar MichaelScofield commented on September 26, 2024

I am confused about where to get the value of server status variables. It seems that Greptime does not have a performance_schema table, which is used to inspect the internal execution of the server at runtime. The information_schema table provides metadata about the database but does not reflect the current state of the server.

Fow now, it doesn't matter what variables should be returned by "show status". All we want is to make Navicat not complained. So I think we can simply add a regex rule in federated.rs for "show status" first, returning empty contents, and see how Navicat satisfy about it. If Navicat then still complains some variables are missing, we can "fake" them (at last we are not really mysql, don't need to fully comply to it).

from greptimedb.

MichaelScofield avatar MichaelScofield commented on September 26, 2024

Just tried the "show status", it prints empty set. However, I think we'd better print the table header as well even there's indeed no value. Like this:

+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
+--------------------+----------+

So this issue is still opened.

from greptimedb.

LindaSummer avatar LindaSummer commented on September 26, 2024

Hi @MichaelScofield ,

I'm a newbie of GreptimeDB and want to make some contribution.
Can this task be assigned to me?

Best Regards,
Edward

from greptimedb.

killme2008 avatar killme2008 commented on September 26, 2024

Hi @MichaelScofield ,

I'm a newbie of GreptimeDB and want to make some contribution. Can this task be assigned to me?

Best Regards, Edward

Of course, thank you.

from greptimedb.

LindaSummer avatar LindaSummer commented on September 26, 2024

Hi @killme2008 ,

Sorry for delay reply.
After searching the mysql cli source code and trying mysql cli myself, I find it seems hard to just display headers without data.
Maybe we should add a simple status or an empty row as a placeholder to display the header.

Here is the mysql cli output.

MySQL [(none)]> select VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.4.1     |
+-----------+
1 row in set (0.001 sec)

MySQL [(none)]> show status where Variable_name='non-existed';
Empty set (0.002 sec)

Here is mysql cli code in display data.

https://github.com/mysql/mysql-server/blob/527c12ed611f3fe072c3043734319edb2c733099/client/mysql.cc#L3702-L3714

      if (!mysql_num_rows(result) && !quick && !column_types_flag) {
        my_stpcpy(buff, "Empty set");
        if (opt_xml) {
          /*
            We must print XML header and footer
            to produce a well-formed XML even if
            the result set is empty (Bug#27608).
          */
          init_pager();
          print_table_data_xml(result);
          end_pager();
        }
  }

It will directly print fixed string "Empty set" as response.
The column_types_flag is a mysql-cli flag.
After enabling it with mysql --column-type-info -h **** -P **** -u **** -p, I got below output.

MySQL [(none)]> show status where Variable_name='non-existed';
Field   1:  `Variable_name`
Org_field:  `Variable_name`
Catalog:    `def`
Database:   `performance_schema`
Table:      `session_status`
Org_table:  `session_status`
Type:       VAR_STRING
Collation:  utf8mb3_general_ci (33)
Length:     192
Max_length: 0
Decimals:   0
Flags:      NOT_NULL NO_DEFAULT_VALUE

Field   2:  `Value`
Org_field:  `Value`
Catalog:    `def`
Database:   `performance_schema`
Table:      `session_status`
Org_table:  `session_status`
Type:       VAR_STRING
Collation:  utf8mb3_general_ci (33)
Length:     3072
Max_length: 0
Decimals:   0
Flags:


0 rows in set (0.008 sec)

The column info should have been contained in response data and just doesn't be displayed in mysql cli.

Could we have a simple status for Variable_name and make the response not empty to display column headers?

Best Regards,
Edward

from greptimedb.

killme2008 avatar killme2008 commented on September 26, 2024

Just tried the "show status", it prints empty set. However, I think we'd better print the table header as well even there's indeed no value. Like this:

+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
+--------------------+----------+

So this issue is still opened.

This is a blank record with the name and value are both empty strings. It's unnecessary.

from greptimedb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.