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

bug: UNION clause return error: UNION of non-matching columns (column no 0) #1870

Closed
2 of 3 tasks
davidshiz opened this issue Jun 9, 2023 · 6 comments
Closed
2 of 3 tasks
Labels
A-bug Something isn't working

Comments

@davidshiz
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

If the fields use other data type, the same union query is supported, so this problem should be a bug !

mysql> CREATE TABLE cs1 (d1 DECIMAL(17), d2 DECIMAL(17,10), d3 DECIMAL(17,17)) ;
Query OK, 0 rows affected (0.21 sec)

mysql> INSERT INTO cs1 VALUES (125, 1.25, 0.125);
Query OK, 1 row affected (0.03 sec)

mysql> INSERT INTO cs1 VALUES (-125, -1.25, -0.125);
Query OK, 1 row affected (0.00 sec)

mysql> select * from cs1;
+------+---------------+----------------------+
| d1   | d2            | d3                   |
+------+---------------+----------------------+
|  125 |  1.2500000000 |  0.12500000000000000 |
| -125 | -1.2500000000 | -0.12500000000000000 |
+------+---------------+----------------------+
2 rows in set (0.00 sec)

mysql> select * from cs1 union select * from cs1;
+------+---------------+----------------------+
| d1   | d2            | d3                   |
+------+---------------+----------------------+
|  125 |  1.2500000000 |  0.12500000000000000 |
| -125 | -1.2500000000 | -0.12500000000000000 |
+------+---------------+----------------------+
2 rows in set (0.00 sec)


mysql> SELECT d1, d1, d2 FROM cs1 UNION SELECT d2, d3, d3 FROM cs1;
ERROR 1105 (HY000): The query includes syntax that is not supported by the storage engine. Tianmu: UNION of non-matching columns (column no 0) .

Expected behavior

No response

How To Reproduce

No response

Environment

[root@stonedb-test bin]# ./mysqld --version
./mysqld  Ver 5.7.36-StoneDB-v1.0.1 for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 12fa952
        Last commit time: Date:   Sat Jun 3 10:07:20 2023 +0800
        Build time: Date: Mon Jun  5 08:49:16 UTC 2023

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Jun 9, 2023
@davidshiz davidshiz added this to the StoneDB_5.7_v1.0.4 milestone Jun 9, 2023
@adofsauron
Copy link
Collaborator

既然已经成功的解决了客户POC的问题 #1873 , 没有理由不顺带着解决这个类似的问题

@adofsauron
Copy link
Collaborator

但是这个问题的场景又有所不同

(gdb) p type2
$3 = {
  type = Tianmu::common::ColumnType::NUM, 
  unsigned_flag_ = false, 
  precision = 17, 
  scale = 10, 
  internal_size = 8, 
  display_size = 19, 
  collation = {
    collation = 0x446fae0 <my_charset_latin1>, 
    derivation = DERIVATION_NUMERIC, 
    repertoire = 3
  }, 
  fmt = Tianmu::common::PackFmt::DEFAULT, 
  flag = std::bitset
}

@adofsauron adofsauron self-assigned this Jun 14, 2023
@adofsauron
Copy link
Collaborator

decimal在mysql官方的文档做下备忘录

https://dev.mysql.com/doc/refman/5.7/en/fixed-point-types.html

@adofsauron
Copy link
Collaborator

问题就在乎,这个精度,是写了魔数不做支持,但是为什么能创建表属性成功?还能插入数据?
如果依据这样的逻辑,那么在创建临时表的时候,就也不能做限制了

d2 DECIMAL(17,10)

@adofsauron
Copy link
Collaborator

所以根据以上的逻辑,在临时表中做和物理表相同的逻辑对策

@adofsauron
Copy link
Collaborator

问题被成功的解决

64629c49942db8c73bd8a9158ed00fee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working
Projects
Development

No branches or pull requests

3 participants