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: Update multiple values does not work with WHERE IN clause #781

Closed
3 tasks done
davidshiz opened this issue Oct 24, 2022 · 7 comments · Fixed by #1094
Closed
3 tasks done

bug: Update multiple values does not work with WHERE IN clause #781

davidshiz opened this issue Oct 24, 2022 · 7 comments · Fixed by #1094
Assignees
Labels
A-bug Something isn't working

Comments

@davidshiz
Copy link
Collaborator

davidshiz commented Oct 24, 2022

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

Update multiple values does not work

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

mysql> UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

Expected behavior

the right answer is as follows:

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

mysql> UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   888 |  777 |
|  -125 | -125 |
| 99998 |  998 |
|   888 |  777 |
+-------+------+
4 rows in set (0.01 sec)

How To Reproduce

CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18));
INSERT INTO cs1 VALUES (125, 125);
INSERT INTO cs1 VALUES (-125, -125);
INSERT INTO cs1 values (99998, 998);
INSERT INTO cs1 values (99999, 999);
select * from cs1;
UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
select * from cs1;

Environment

root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

root@ub01:~# /stonedb57/install//bin/mysqld --version
/stonedb57/install//bin/mysqld  Ver 5.7.36-StoneDB 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: 86a7685dc
        Last commit time: Date:   Sat Oct 22 03:38:32 2022 +0800
        Build time: Date: Sat 22 Oct 2022 02:14:05 PM UTC

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 Oct 24, 2022
@davidshiz davidshiz added this to the stonedb_5.7_v1.0.2 milestone Oct 24, 2022
@davidshiz davidshiz added prio: high High priority PR-testing B-testing Testing tools and infrastructure and removed PR-testing prio: high High priority labels Oct 24, 2022
@konghaiya konghaiya self-assigned this Oct 24, 2022
@davidshiz davidshiz removed the B-testing Testing tools and infrastructure label Oct 29, 2022
@konghaiya
Copy link
Collaborator

ACK

@adofsauron
Copy link
Collaborator

ACK

@adofsauron
Copy link
Collaborator

The rnd_next interface of tianmu is called through the plug-in engine interface, but no data is obtained, and the upper layer changes to an error

lALPGSH3JWlAIb3NB1XNDas_3499_1877

lALPGTAtH_xTT77NB1XNDas_3499_1877

@adofsauron
Copy link
Collaborator

When normally updated

C75B4F7F-A796-4fe2-A1A0-8E56BFB239DB

UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (99999);

@adofsauron
Copy link
Collaborator

After the predicate is pushed down, no data is obtained

(gdb) p push_down_result[0].attrs[1][0].no_obj
$15 = 0
(gdb) p push_down_result[0].attrs[1][0].buffer
$16 = (void *) 0x0

(gdb) bt
#0  Tianmu::handler::ha_tianmu::set_cond_iter (this=0x7f291401c6b0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/storage/tianmu/handler/ha_tianmu.cpp:1434
#1  0x0000000002d76464 in Tianmu::handler::ha_tianmu::cond_push (this=0x7f291401c6b0, a_cond=0x7f291401a220)
    at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/storage/tianmu/handler/ha_tianmu.cpp:1511
#2  0x00000000022c9298 in init_read_record (info=0x7f2b04fceb90, thd=0x7f2914014970, table=0x7f291401d590, qep_tab=0x7f2b04fce978, use_record_cache=0, print_error=true, disable_rr_cache=false)
    at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/records.cc:360
#3  0x000000000245da20 in mysql_update (thd=0x7f2914014970, fields=..., values=..., limit=18446744073709551615, handle_duplicates=DUP_ERROR, found_return=0x7f2b04fced68, updated_return=0x7f2b04fced60)
    at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_update.cc:781
#4  0x000000000246401b in Sql_cmd_update::try_single_table_update (this=0x7f291401a450, thd=0x7f2914014970, switch_to_multitable=0x7f2b04fcee0f)
    at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_update.cc:2927
#5  0x00000000024645bb in Sql_cmd_update::execute (this=0x7f291401a450, thd=0x7f2914014970) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_update.cc:3058
#6  0x00000000023aa9b7 in mysql_execute_command (thd=0x7f2914014970, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_parse.cc:3655
#7  0x00000000023b07c1 in mysql_parse (thd=0x7f2914014970, parser_state=0x7f2b04fcff90) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_parse.cc:5655
#8  0x00000000023a5758 in dispatch_command (thd=0x7f2914014970, com_data=0x7f2b04fd0730, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_parse.cc:1495
#9  0x00000000023a4599 in do_command (thd=0x7f2914014970) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/sql_parse.cc:1034
#10 0x00000000024d5db7 in handle_connection (arg=0x8a807f0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/sql/conn_handler/connection_handler_per_thread.cc:313
#11 0x0000000002ba3100 in pfs_spawn_thread (arg=0x84560f0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-133/storage/perfschema/pfs.cc:2197
#12 0x00007f2b0f6871ca in start_thread () from /lib64/libpthread.so.0
#13 0x00007f2b0c9d9e73 in clone () from /lib64/libc.so.6

@adofsauron
Copy link
Collaborator

Closing the TIANMU predicate pushback results correctly

lALPGR5ppsqWg7bNB1XNDas_3499_1877

@adofsauron
Copy link
Collaborator

The problem when in a collection of multiple data, the concrete subclass is DimensionGroupMaterialized dimon_group, but the specific subclass does not exist GetFilter interface. As a result, the data already queried cannot be extracted further

lALPGSWEpCBThM7NB1XNDas_3499_1877

@mergify mergify bot closed this as completed in #1094 Dec 9, 2022
mergify bot pushed a commit that referenced this issue Dec 9, 2022
    Cause of error:
        Update multiple values does not work with WHERE IN
        clause Update multiple values does not work with where in clause.
        Predicate push-down from TIANMU is used, and this process works fine.
        But when you get the direct result,
        it is not compatible with TIANMU's dimen_group concrete type.
        In the execution of a predicate push-down,
        must get the Filter so that the execution of the follow-up to value,
        namely DimensionGroupFilter,
        but the current statement USES the materialized DimensionGroupMaterialized operation

    Solution Strategy:
        If the query is executed by a predicate pushdown, materialization is not enabled

    What remains:
        When no materialization operation is used in predicate push-down,
        the impact on query performance of predicate push-down
        needs to be cross-checked against benchmarks
konghaiya pushed a commit to konghaiya/stonedb that referenced this issue Mar 7, 2023
    Cause of error:
        Update multiple values does not work with WHERE IN
        clause Update multiple values does not work with where in clause.
        Predicate push-down from TIANMU is used, and this process works fine.
        But when you get the direct result,
        it is not compatible with TIANMU's dimen_group concrete type.
        In the execution of a predicate push-down,
        must get the Filter so that the execution of the follow-up to value,
        namely DimensionGroupFilter,
        but the current statement USES the materialized DimensionGroupMaterialized operation

    Solution Strategy:
        If the query is executed by a predicate pushdown, materialization is not enabled

    What remains:
        When no materialization operation is used in predicate push-down,
        the impact on query performance of predicate push-down
        needs to be cross-checked against benchmarks
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

Successfully merging a pull request may close this issue.

3 participants