!1975 修复行存转向量化场景下,explain plan由于字符串超长导致的问题

Merge pull request !1975 from pengjiong/array
This commit is contained in:
opengauss-bot
2022-07-26 12:05:43 +00:00
committed by Gitee
3 changed files with 34 additions and 2 deletions

View File

@ -10352,7 +10352,7 @@ void PlanTable::set_plan_table_ops(int plan_node_id, char* operation, char* opti
if (operation != NULL) {
/* Transform the vaules into upper case. */
operation = set_strtoupper(operation, OPERATIONLEN);
rc = strncpy_s(m_plan_table[plan_node_id - 1]->m_datum->operation, OPERATIONLEN, operation, strlen(operation));
rc = strncpy_s(m_plan_table[plan_node_id - 1]->m_datum->operation, OPERATIONLEN, operation, OPERATIONLEN - 1);
securec_check(rc, "\0", "\0");
pfree(operation);
@ -10360,7 +10360,7 @@ void PlanTable::set_plan_table_ops(int plan_node_id, char* operation, char* opti
}
if (options != NULL) {
options = set_strtoupper(options, OPTIONSLEN);
rc = strncpy_s(m_plan_table[plan_node_id - 1]->m_datum->options, OPTIONSLEN, options, strlen(options));
rc = strncpy_s(m_plan_table[plan_node_id - 1]->m_datum->options, OPTIONSLEN, options, OPTIONSLEN - 1);
securec_check(rc, "\0", "\0");
pfree(options);

View File

@ -59,7 +59,27 @@ select * from v_force order by 1;
2 | 2
(2 rows)
CREATE TABLE force_vector_dept(deptNO INT PRIMARY KEY,DNAME VARCHAR(14),LOC VARCHAR(13));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "force_vector_dept_pkey" for table "force_vector_dept"
INSERT INTO force_vector_dept VALUES (20,'RESEARCH','DALLAS');
CREATE TABLE force_vector_emp(EMPNO INT PRIMARY KEY,ENAME VARCHAR(10),JOB VARCHAR(9),MGR numeric,HIREDATE DATE,SAL numeric,COMM numeric,deptNO INT, FOREIGN KEY(deptNO) REFERENCES force_vector_dept(deptNO));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "force_vector_emp_pkey" for table "force_vector_emp"
INSERT INTO force_vector_emp VALUES(7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20);
explain plan for select e.empno,e.ename,e.sal,d.dname from force_vector_emp e inner join force_vector_dept d on d.deptNO= e.deptNO;
select id,operation,options,object_name,object_type,projection from plan_table order by 1;
id | operation | options | object_name | object_type | projection
----+--------------------------------+----------+-------------------+-------------+-----------------------------------
1 | ROW ADAPTER | | | | e.empno, e.ename, e.sal, d.dname
2 | VECTOR SONIC HASH JOIN | INNER | | | e.empno, e.ename, e.sal, d.dname
3 | VECTOR ADAPTER(TYPE: BATCH MOD | | | | d.deptno, d.dname, d.loc
4 | TABLE ACCESS | SEQ SCAN | force_vector_dept | TABLE | d.deptno, d.dname, d.loc
5 | VECTOR ADAPTER(TYPE: BATCH MOD | | | | e.empno, e.ename, e.sal, e.deptno
6 | TABLE ACCESS | SEQ SCAN | force_vector_emp | TABLE | e.empno, e.ename, e.sal, e.deptno
(6 rows)
set try_vector_engine_strategy=off;
drop table force_vector_emp;
drop table force_vector_dept;
drop table force_vector_test;
drop schema test_force_vector2 cascade;
NOTICE: drop cascades to 5 other objects

View File

@ -24,7 +24,19 @@ insert into force_tb1 values(1,1);
insert into force_tb1 values(2,2);
create incremental materialized view v_force as select * from force_tb1;
select * from v_force order by 1;
CREATE TABLE force_vector_dept(deptNO INT PRIMARY KEY,DNAME VARCHAR(14),LOC VARCHAR(13));
INSERT INTO force_vector_dept VALUES (20,'RESEARCH','DALLAS');
CREATE TABLE force_vector_emp(EMPNO INT PRIMARY KEY,ENAME VARCHAR(10),JOB VARCHAR(9),MGR numeric,HIREDATE DATE,SAL numeric,COMM numeric,deptNO INT, FOREIGN KEY(deptNO) REFERENCES force_vector_dept(deptNO));
INSERT INTO force_vector_emp VALUES(7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20);
explain plan for select e.empno,e.ename,e.sal,d.dname from force_vector_emp e inner join force_vector_dept d on d.deptNO= e.deptNO;
select id,operation,options,object_name,object_type,projection from plan_table order by 1;
set try_vector_engine_strategy=off;
drop table force_vector_emp;
drop table force_vector_dept;
drop table force_vector_test;
drop schema test_force_vector2 cascade;