init push
This commit is contained in:
18
unittest/sql/parser/CMakeLists.txt
Normal file
18
unittest/sql/parser/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
ob_unittest(test_parser_perf)
|
||||
sql_unittest(test_parser)
|
||||
sql_unittest(test_multi_parser)
|
||||
|
||||
add_executable(test_sql_fast_parser test_sql_fast_parser.cpp)
|
||||
target_link_libraries(test_sql_fast_parser
|
||||
PRIVATE
|
||||
gtest
|
||||
gmock
|
||||
ob_sql_proxy_parser_static
|
||||
-static-libstdc++
|
||||
)
|
||||
disable_pch(test_sql_fast_parser)
|
||||
target_include_directories(test_sql_fast_parser
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/ob_unittest
|
||||
)
|
||||
3630
unittest/sql/parser/print_parser_tree.result
Normal file
3630
unittest/sql/parser/print_parser_tree.result
Normal file
File diff suppressed because it is too large
Load Diff
519
unittest/sql/parser/test_filter_hint.result
Normal file
519
unittest/sql/parser/test_filter_hint.result
Normal file
@ -0,0 +1,519 @@
|
||||
************** Case 1 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 2 ***************
|
||||
select /*+trace_log no_rewrite*/ * from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 3 ***************
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 4 ***************
|
||||
select /*+*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 5 ***************
|
||||
select /*+sss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 6 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 7 ***************
|
||||
select /*+trace_log no_rewrite ssss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 8 ***************
|
||||
select /*+ssss no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 9 ***************
|
||||
select */*+trace_log no_rewrite*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 10 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 11 ***************
|
||||
select * from (select /*+SSSSSS*/ * from t1) as tt where c1 = 1 limit 1 order by 1;
|
||||
select * from (select * from t1) as tt where c1 = 1 limit 1 order by 1;
|
||||
************** Case 12 ***************
|
||||
select * from /*+sssssss*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from from t1 where c1 = 1 limit 1 order by 1;
|
||||
************** Case 13 ***************
|
||||
update /*+sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update t1 set c1 = 1 where c1 = 100;
|
||||
************** Case 14 ***************
|
||||
update /*+no_rewrite sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update t1 set c1 = 1 where c1 = 100;
|
||||
************** Case 15 ***************
|
||||
update /*+sssss*/ t1 set c1 = 1 where /*+sssss*/ c1 = 100;
|
||||
update t1 set c1 = 1 where c1 = 100;
|
||||
************** Case 16 ***************
|
||||
delete /*+sssss*/ from t1 where c=1;
|
||||
delete from t1 where c=1;
|
||||
************** Case 17 ***************
|
||||
delete /*+no_rewrite sssss*/ from t1 where c=1;
|
||||
delete from t1 where c=1;
|
||||
************** Case 18 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "t1"@"SEL$1") READ_CONSISTENCY("WEAK") HOTSPOT TOPK(1 100) QUERY_TIMEOUT(100) FROZEN_VERSION(1) USE_PLAN_CACHE("EXACT") ACTIVATE_BURIED_POINT(1, FIX_MODE, 1, 1) NO_REWRITE TRACE_LOG LOG_LEVEL('info') END_OUTLINE_DATA */* from t1;
|
||||
select * from t1;
|
||||
************** Case 19 ***************
|
||||
select /*+INDEX(@"SEL$2" "opt.t4"@"SEL$2" "idx_t4_c3")*/* from t1 where c1 in (select c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
************** Case 20 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA INDEX(@"SEL$1" "opt.t4"@"SEL$1" "idx_t4_c3") END_OUTLINE_DATA */ * from t4 where c1 = 1;
|
||||
select * from t4 where c1 = 1;
|
||||
************** Case 21 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "opt.t4"@"SEL$1") END_OUTLINE_DATA */ * from t4 where c2 = 1;
|
||||
select * from t4 where c2 = 1;
|
||||
************** Case 22 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_MERGE(@"SEL$1" "opt.t2"@"SEL$1") LEADING(@"SEL$1" "opt.t1"@"SEL$1" "opt.t2"@"SEL$1") FULL(@"SEL$1" "opt.t1"@"SEL$1") FULL(@"SEL$1" "opt.t2"@"SEL$1") END_OUTLINE_DATA */* from t1,t2 where t1.c1=t2.c1;
|
||||
select * from t1,t2 where t1.c1=t2.c1;
|
||||
************** Case 23 ***************
|
||||
select /*+log_level('info')*/* from t1;
|
||||
select * from t1;
|
||||
************** Case 24 ***************
|
||||
select /*+log_level('info')*/t1.c1,t2.c1 from t1,t2 group by t1.c1,t2.c1 having c1 =1;
|
||||
select t1.c1,t2.c1 from t1,t2 group by t1.c1,t2.c1 having c1 =1;
|
||||
************** Case 25 ***************
|
||||
select /*+log_level('info')*/* from t1 for update;
|
||||
select * from t1 for update;
|
||||
************** Case 26 ***************
|
||||
select * from /*+sssssss*/ from t1 where c1 in (select /*+fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
select * from from t1 where c1 in (select c1 from t2) limit 1 order by 1;
|
||||
************** Case 27 ***************
|
||||
select * from /*sssssss*/ from t1 where c1 in (select /*fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
select * from from t1 where c1 in (select c1 from t2) limit 1 order by 1;
|
||||
************** Case 28 ***************
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 ;
|
||||
update t1 set c1 = 1 where c2 ;
|
||||
************** Case 29 ***************
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 > any(select /*+index(t3 c1) trace_log*/c1 from t3 where c2 not in (select c1 from t4 order by c1 limit 2));
|
||||
update t1 set c1 = 1 where c2 > any(select c1 from t3 where c2 not in (select c1 from t4 order by c1 limit 2));
|
||||
************** Case 30 ***************
|
||||
update/*+index(t2 i2)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=2 where c1>0 and vt2.c2<2 order by vt2.c1 asc, vt2.c2 desc limit 2 offset 10;
|
||||
update t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=2 where c1>0 and vt2.c2<2 order by vt2.c1 asc, vt2.c2 desc limit 2 offset 10;
|
||||
************** Case 31 ***************
|
||||
update/*+index(t2 i2),query_timeout(2000)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=10 where c1>0 and vt2.c2<10 order by vt2.c1 asc,c2 desc limit 10,10
|
||||
update t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=10 where c1>0 and vt2.c2<10 order by vt2.c1 asc,c2 desc limit 10,10
|
||||
************** Case 32 ***************
|
||||
UPDATE t1 SET c1=c1+(SELECT MAX(C1) FROM (SELECT 1) t) WHERE c1=(SELECT /*+index(t2 i2),query_timeout(2000)*/ MAX(c1));
|
||||
UPDATE t1 SET c1=c1+(SELECT MAX(C1) FROM (SELECT 1) t) WHERE c1=(SELECT MAX(c1));
|
||||
************** Case 33 ***************
|
||||
update t1 set c2 = 6 where c1 = (select /*+index(t2 i2),query_timeout(2000)*/max(c1) from t1);
|
||||
update t1 set c2 = 6 where c1 = (select max(c1) from t1);
|
||||
************** Case 34 ***************
|
||||
insert /*+index(t2 i2)*/into ta select * from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
insert into ta select * from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
************** Case 35 ***************
|
||||
insert into t1 values (1,2),(3,4) on duplicate key update c1=values(c2)+values(c1), c2= values(c1)+values(c1);
|
||||
insert into t1 values (1,2),(3,4) on duplicate key update c1=values(c2)+values(c1), c2= values(c1)+values(c1);
|
||||
************** Case 36 ***************
|
||||
insert into t4 (c1,c2,c3) values(11, 2, default), (13,3, default) on duplicate key update c2 = 5, c3=4;
|
||||
insert into t4 (c1,c2,c3) values(11, 2, default), (13,3, default) on duplicate key update c2 = 5, c3=4;
|
||||
************** Case 37 ***************
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
************** Case 38 ***************
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
************** Case 39 ***************
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
************** Case 40 ***************
|
||||
insert into ta select /*+index(t2 i2)*/* from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
insert into ta select * from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
************** Case 41 ***************
|
||||
delete from t1 where c2 > 10 order by c1 limit 0, 1;
|
||||
delete from t1 where c2 > 10 order by c1 limit 0, 1;
|
||||
************** Case 42 ***************
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 =1;
|
||||
delete from t1 where c1 =1;
|
||||
************** Case 43 ***************
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 in (select /*trace_log*/c2 from t2);
|
||||
delete from t1 where c1 in (select c2 from t2);
|
||||
************** Case 44 ***************
|
||||
delete /*dfasdasf*/ from test where c1 = 1;
|
||||
delete from test where c1 = 1;
|
||||
************** Case 45 ***************
|
||||
select /*+no_rewrite*/* from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
select * from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
************** Case 46 ***************
|
||||
select * from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
select * from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
************** Case 47 ***************
|
||||
select * from t1 where c1 = 'aaaaa';
|
||||
select * from t1 where c1 = 'aaaaa';
|
||||
************** Case 48 ***************
|
||||
select * from t1 where c1 = "aaaaa";
|
||||
select * from t1 where c1 = "aaaaa";
|
||||
************** Case 49 ***************
|
||||
select * from t1 where c1 = '''';
|
||||
select * from t1 where c1 = '''';
|
||||
************** Case 50 ***************
|
||||
select * from t1 where c1 = '"';
|
||||
select * from t1 where c1 = '"';
|
||||
************** Case 51 ***************
|
||||
select * from t1 where c1 = "''";
|
||||
select * from t1 where c1 = "''";
|
||||
************** Case 52 ***************
|
||||
select * from t1 where c1 = '\\';
|
||||
select * from t1 where c1 = '\\';
|
||||
************** Case 53 ***************
|
||||
select * from t1 where c1 = "\t";
|
||||
select * from t1 where c1 = "\t";
|
||||
************** Case 54 ***************
|
||||
select * from t1 where c1 = '\n';
|
||||
select * from t1 where c1 = '\n';
|
||||
************** Case 55 ***************
|
||||
select * from t1 where c1 = "\n";
|
||||
select * from t1 where c1 = "\n";
|
||||
************** Case 56 ***************
|
||||
select * from t1 where c1 = ' ';
|
||||
select * from t1 where c1 = ' ';
|
||||
************** Case 57 ***************
|
||||
select * from t1 where c1 = " ";
|
||||
select * from t1 where c1 = " ";
|
||||
************** Case 58 ***************
|
||||
select * from t1 where c1 = `aaaaa`;
|
||||
select * from t1 where c1 = `aaaaa`;
|
||||
************** Case 59 ***************
|
||||
select * from t1 where c1 = ````;
|
||||
select * from t1 where c1 = ````;
|
||||
************** Case 60 ***************
|
||||
select /*+ leading(ta, tb) use_nl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
select * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
************** Case 61 ***************
|
||||
select /*+ leading(ta, tb) use_bnl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
select * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
************** Case 62 ***************
|
||||
select /*+ leading(t1) use_nl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
select * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
************** Case 63 ***************
|
||||
select /*+ leading(t1) use_bnl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
select * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
************** Case 64 ***************
|
||||
select /*+ leading(t2, t1) use_merge(t1)*/ * from hint.t2, opt.t1 where t1.c1 = t2.a;
|
||||
select * from hint.t2, opt.t1 where t1.c1 = t2.a;
|
||||
************** Case 65 ***************
|
||||
select /*+ index(hint.t1 idx_t1_a)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c1;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c1;
|
||||
************** Case 66 ***************
|
||||
select /*+ full(opt.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
************** Case 67 ***************
|
||||
select /*+ ordered use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
************** Case 68 ***************
|
||||
select /*+ ordered use_bnl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
************** Case 69 ***************
|
||||
select /*+ leading(tb, opt.t1) use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
************** Case 70 ***************
|
||||
select /*+ leading(tb, opt.t1) use_bnl(hint.t2, opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
************** Case 71 ***************
|
||||
select * from opt.t1,opt.t2 use index (idx_t1_c2) where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1,opt.t2 use index (idx_t1_c2) where opt.t1.c1 = opt.t2.c2;
|
||||
************** Case 72 ***************
|
||||
select /*+ index(t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
************** Case 73 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
************** Case 74 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(hint.t2, hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
************** Case 75 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(test hint.t2) use_nl(hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
************** Case 76 ***************
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 77 ***************
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 78 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 79 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 80 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 81 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 82 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 83 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
************** Case 84 ***************
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_c2, idx_t1_a) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_c2, idx_t1_a) where opt.t1.c1 = hint.t1.a;
|
||||
************** Case 85 ***************
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
************** Case 86 ***************
|
||||
select * from opt.t1,hint.t1 force index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 force index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
************** Case 87 ***************
|
||||
select * from opt.t4 force index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 force index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
************** Case 88 ***************
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
************** Case 89 ***************
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
************** Case 90 ***************
|
||||
select * from opt.t4, hint.t1 ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where opt.t4.c1 = hint.t1.a;
|
||||
select * from opt.t4, hint.t1 ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where opt.t4.c1 = hint.t1.a;
|
||||
************** Case 91 ***************
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where ta.c1 = tb.a;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where ta.c1 = tb.a;
|
||||
************** Case 92 ***************
|
||||
select * from opt.t1 use index(idx_yeti, idx_t1_c2) where opt.t1.c1 = opt.t1.c1;
|
||||
select * from opt.t1 use index(idx_yeti, idx_t1_c2) where opt.t1.c1 = opt.t1.c1;
|
||||
************** Case 93 ***************
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_test, idx_t1_a) where ta.c1 = tb.a;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_test, idx_t1_a) where ta.c1 = tb.a;
|
||||
************** Case 94 ***************
|
||||
select * from opt.t1 use index(index_t1_c2) where opt.t1.c2 = (select hint.t1.a from hint.t1,opt.t2 use index(idx_t1_a) where opt.t2.c1 = hint.t1.b);
|
||||
select * from opt.t1 use index(index_t1_c2) where opt.t1.c2 = (select hint.t1.a from hint.t1,opt.t2 use index(idx_t1_a) where opt.t2.c1 = hint.t1.b);
|
||||
************** Case 95 ***************
|
||||
select /*+ idex(yeti idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 where yeti.a = opt.t1.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 where yeti.a = opt.t1.c2;
|
||||
************** Case 96 ***************
|
||||
select /*+ idex(ta idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
************** Case 97 ***************
|
||||
select /*+ idex(opt.t1 idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
************** Case 98 ***************
|
||||
select /*+ full(opt.t1)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
************** Case 99 ***************
|
||||
select /*+ full(opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
************** Case 100 ***************
|
||||
select /*+ full(opt.t1 hint.t2)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
************** Case 101 ***************
|
||||
select /*+ full(opt.t1) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
************** Case 102 ***************
|
||||
select /*+ full(opt.ta) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
************** Case 103 ***************
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
************** Case 104 ***************
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
************** Case 105 ***************
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_nl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
************** Case 106 ***************
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_bnl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
************** Case 107 ***************
|
||||
select /*+ ordered use_merge(ta,tb,tc,td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
************** Case 108 ***************
|
||||
select /*+ ordered use_nl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
************** Case 109 ***************
|
||||
select /*+ ordered use_bnl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
************** Case 110 ***************
|
||||
select /*+ ordered*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
************** Case 111 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 112 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 113 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 114 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 115 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) */ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
************** Case 116 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_nl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
************** Case 117 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_bnl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
************** Case 118 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 119 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_nl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 120 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_bnl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 121 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_nl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 122 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_bnl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 123 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) use_nl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 124 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) use_bnl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
************** Case 125 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_nl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
************** Case 126 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_bnl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
************** Case 127 ***************
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
************** Case 128 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
************** Case 129 ***************
|
||||
select/*+no_rewrite*/ t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
************** Case 130 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+leading(t2)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
************** Case 131 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+read_consistency(weak)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
************** Case 132 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+use_nl(t2, t4)*/ t2.c1 from t2, t4 where t2.c1 = t4.c1) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4 where t2.c1 = t4.c1) v;
|
||||
************** Case 133 ***************
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select c1 from t2);
|
||||
(select c1 from t1) union (select c1 from t2);
|
||||
************** Case 134 ***************
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select /*+read_consistency(strong)*/ c1 from t2);
|
||||
(select c1 from t1) union (select c1 from t2);
|
||||
************** Case 135 ***************
|
||||
select * from opt.t1 ignore index (primary);
|
||||
select * from opt.t1 ignore index (primary);
|
||||
************** Case 136 ***************
|
||||
select /*+ index(@a0123456789012345678 t4@a0123456789012345678 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a0123456789012345678)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
************** Case 137 ***************
|
||||
select /*+ index(@a01234567890123456789 t4@a01234567890123456789 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a01234567890123456789)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
************** Case 138 ***************
|
||||
select /*+ index(@SEL$1 t4 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(yz)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
************** Case 139 ***************
|
||||
select /*+ leading(@SEL$1 t4 t1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 140 ***************
|
||||
select /*+ leading(@SEL$1 t1 t4)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 141 ***************
|
||||
select /*+ leading(@SEL$1 t1@SEL$1 t4@YZ)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 142 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 143 ***************
|
||||
select /*+ leading(@SEL$1 t_a@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
************** Case 144 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
************** Case 145 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_nl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 146 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_bnl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 147 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ * from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
************** Case 148 ***************
|
||||
select c1 from t1 union select /*+index(@SEL$1 t1 idx_t1_c2)*/ c1 from t2;
|
||||
select c1 from t1 union select c1 from t2;
|
||||
************** Case 149 ***************
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select c1 from t2;
|
||||
************** Case 150 ***************
|
||||
select/*+leading(@SEL$1 t2 t1)*/ t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select c1 from t2;
|
||||
************** Case 151 ***************
|
||||
(select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ t1.c1 from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
(select t1.c1 from t1 , (select c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
************** Case 152 ***************
|
||||
(select t1.c1 from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1) union select/*+leading(@SEL$1 t4@YZ t1@SEL$1) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t3;
|
||||
(select t1.c1 from t1 , (select c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
************** Case 153 ***************
|
||||
select/*+index(@SEL$1 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
************** Case 154 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
************** Case 155 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c2 > 1 and t4.c2 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c2 > 1 and t4.c2 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
************** Case 156 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c3 > 1 and t4.c3 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c3 > 1 and t4.c3 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
************** Case 157 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) leading(@SEL$2 t5@SEL$3 t4@SEL$2)*/t1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t_a.c1 = t4.c1 group by t4.c2);
|
||||
************** Case 158 ***************
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
************** Case 159 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_NL(@"SEL$3" "hint.t2"@"SEL$3") LEADING(@"SEL$3" "hint.t2"@"SEL$3" "hint.t1"@"SEL$3") END_OUTLINE_DATA */* from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
************** Case 160 ***************
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
************** Case 161 ***************
|
||||
select /*+ leading(@SEL$1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
************** Case 162 ***************
|
||||
select /*+ leading(@SEL1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
************** Case 163 ***************
|
||||
select /*+index(@SEL$3 t5@SEL$3 idx_t5_c2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t5.c1 from t5 group by t5.c2) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t5.c1 from t5 group by t5.c2) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
************** Case 164 ***************
|
||||
select c2 from t_idx use index(t_c2);
|
||||
select c2 from t_idx use index(t_c2);
|
||||
************** Case 165 ***************
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
************** Case 166 ***************
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
************** Case 167 ***************
|
||||
select /*+use_plan_cache(none)*/ * from hint.t1;
|
||||
select * from hint.t1;
|
||||
************** Case 168 ***************
|
||||
select /*+use_plan_cache(meaningless)*/ * from hint.t1;
|
||||
select * from hint.t1;
|
||||
************** Case 169 ***************
|
||||
select /*+ index(t1 primary) */ * from hint.t1 order by a desc;
|
||||
select * from hint.t1 order by a desc;
|
||||
************** Case 170 ***************
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
************** Case 171 ***************
|
||||
select /*+ INDEX(@SEL$3 opt.z1@SEL$2 z1_b)*/ min(a) from z1 za where za.a in (select a from z1);
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
************** Case 172 ***************
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(a);
|
||||
select * from z1 ignore key(a);
|
||||
************** Case 173 ***************
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(z1_b);
|
||||
select * from z1 ignore key(z1_b);
|
||||
89
unittest/sql/parser/test_multi_parser.cpp
Normal file
89
unittest/sql/parser/test_multi_parser.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SQL
|
||||
|
||||
#include "sql/parser/ob_parser.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "lib/utility/ob_test_util.h"
|
||||
#include "../test_sql_utils.h"
|
||||
#include "lib/allocator/page_arena.h"
|
||||
#include "lib/json/ob_json_print_utils.h" // for SJ
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::sql;
|
||||
|
||||
namespace test {
|
||||
|
||||
class TestMultiParser : public TestSqlUtils, public ::testing::Test {
|
||||
public:
|
||||
TestMultiParser();
|
||||
virtual ~TestMultiParser();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestMultiParser);
|
||||
|
||||
protected:
|
||||
// data members
|
||||
ObArenaAllocator allocator_;
|
||||
};
|
||||
|
||||
TestMultiParser::TestMultiParser() : allocator_(ObModIds::TEST)
|
||||
{}
|
||||
|
||||
TestMultiParser::~TestMultiParser()
|
||||
{}
|
||||
|
||||
void TestMultiParser::SetUp()
|
||||
{}
|
||||
|
||||
void TestMultiParser::TearDown()
|
||||
{}
|
||||
|
||||
TEST_F(TestMultiParser, basic_test)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSQLMode mode = SMO_DEFAULT;
|
||||
/*
|
||||
const char *query_str = "alter system bootstrap ZONE 'zone1' SERVER '100.81.152.44:19518'";
|
||||
const char *query_str = "create database if not exists rongxuan default character set = 'utf8' default collate =
|
||||
'default_collate'"; const char *query_str = "select * from d.t1 PARTITION(p1, p2);"; const char *query_str = "update
|
||||
d.t1 PARTITION (p2) SET id = 2 WHERE name = 'Jill';"; const char *query_str = "delete from d.t1 PARTITION(p0, p1);";
|
||||
*/
|
||||
// const char *query_str = "select '12', '11', '11', '11'";
|
||||
// const char *query_str = "alter system bootstrap ZONE 'zone1' SERVER '100.81.152.44:19518';select 3;select
|
||||
// '23';create table t1 (i int) ;;;; ";
|
||||
const char* query_str = "";
|
||||
// const char *query_str = "select 1";
|
||||
ObString query = ObString::make_string(query_str);
|
||||
ObSEArray<ObString, 4> queries;
|
||||
ObParser parser(allocator_, mode);
|
||||
ObMPParseStat parse_stat;
|
||||
ret = parser.split_multiple_stmt(query, queries, parse_stat);
|
||||
LOG_INFO("YES. multi query", K(query), K(queries));
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(1, queries.count());
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
test::parse_cmd_line_param(argc, argv, test::clp);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
345
unittest/sql/parser/test_parser.cpp
Normal file
345
unittest/sql/parser/test_parser.cpp
Normal file
@ -0,0 +1,345 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "sql/parser/ob_parser.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "lib/utility/ob_test_util.h"
|
||||
#include "../test_sql_utils.h"
|
||||
#include "lib/allocator/page_arena.h"
|
||||
#include "lib/json/ob_json_print_utils.h" // for SJ
|
||||
#include "sql/plan_cache/ob_sql_parameterization.h"
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::sql;
|
||||
namespace test {
|
||||
class TestParser : public TestSqlUtils, public ::testing::Test {
|
||||
public:
|
||||
TestParser();
|
||||
virtual ~TestParser();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestParser);
|
||||
|
||||
protected:
|
||||
// function members
|
||||
void do_parse(const char* query_str, std::ofstream& of_result, int64_t expect_error = OB_SUCCESS);
|
||||
void print_parse_tree(const char* query_str, std::ofstream& of_result, int64_t expect_error = OB_SUCCESS);
|
||||
void print_parse_outline(const char* query_str, std::ofstream& of_result, int64_t expect_error = OB_SUCCESS);
|
||||
void do_filter_hint(const char* query_str, std::ofstream& of_result, int64_t expect_error = OB_SUCCESS);
|
||||
bool pretreat_cmd(std::string line, int64_t& expect_error);
|
||||
|
||||
protected:
|
||||
// data members
|
||||
ObArenaAllocator allocator_;
|
||||
};
|
||||
|
||||
TestParser::TestParser() : allocator_(ObModIds::TEST)
|
||||
{}
|
||||
|
||||
TestParser::~TestParser()
|
||||
{}
|
||||
|
||||
void TestParser::SetUp()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void TestParser::TearDown()
|
||||
{}
|
||||
|
||||
TEST_F(TestParser, basic_test)
|
||||
{
|
||||
const char* test_file = "./test_parser.test";
|
||||
const char* result_file = "./test_parser.result";
|
||||
const char* tmp_file = "./test_parser.tmp";
|
||||
// run tests
|
||||
std::ifstream if_tests(test_file);
|
||||
ASSERT_TRUE(if_tests.is_open());
|
||||
std::ofstream of_result(tmp_file);
|
||||
ASSERT_TRUE(of_result.is_open());
|
||||
std::string line;
|
||||
int64_t case_id = 0;
|
||||
int64_t expect_error = 0;
|
||||
while (std::getline(if_tests, line)) {
|
||||
if (pretreat_cmd(line, expect_error)) {
|
||||
continue;
|
||||
}
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << line << std::endl;
|
||||
ASSERT_NO_FATAL_FAILURE(do_parse(line.c_str(), of_result, expect_error));
|
||||
if (expect_error != 0) {
|
||||
expect_error = 0;
|
||||
}
|
||||
}
|
||||
of_result.close();
|
||||
// verify results
|
||||
is_equal_content(tmp_file, result_file);
|
||||
}
|
||||
|
||||
TEST_F(TestParser, filter_hint)
|
||||
{
|
||||
const char* test_file = "./test_parser_outline.test";
|
||||
const char* result_file = "./test_filter_hint.result";
|
||||
const char* tmp_file = "./test_filter_hint.tmp";
|
||||
// run tests
|
||||
std::ifstream if_tests(test_file);
|
||||
ASSERT_TRUE(if_tests.is_open());
|
||||
std::ofstream of_result(tmp_file);
|
||||
ASSERT_TRUE(of_result.is_open());
|
||||
std::string line;
|
||||
int64_t case_id = 0;
|
||||
int64_t expect_error = 0;
|
||||
while (std::getline(if_tests, line)) {
|
||||
if (pretreat_cmd(line, expect_error)) {
|
||||
continue;
|
||||
}
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << line << std::endl;
|
||||
do_filter_hint(line.c_str(), of_result, expect_error);
|
||||
if (expect_error != 0) {
|
||||
expect_error = 0;
|
||||
}
|
||||
}
|
||||
of_result.close();
|
||||
// verify results
|
||||
is_equal_content(tmp_file, result_file);
|
||||
}
|
||||
|
||||
TEST_F(TestParser, print_parser_tree)
|
||||
{
|
||||
const char* test_file = "./test_parser.test";
|
||||
const char* result_file = "./print_parser_tree.result";
|
||||
const char* tmp_file = "./print_parser_tree.tmp";
|
||||
// run tests
|
||||
std::ifstream if_tests(test_file);
|
||||
ASSERT_TRUE(if_tests.is_open());
|
||||
std::ofstream of_result(tmp_file);
|
||||
ASSERT_TRUE(of_result.is_open());
|
||||
std::string line;
|
||||
int64_t case_id = 0;
|
||||
int64_t expect_error = 0;
|
||||
while (std::getline(if_tests, line)) {
|
||||
if (pretreat_cmd(line, expect_error)) {
|
||||
continue;
|
||||
}
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << line << std::endl;
|
||||
ASSERT_NO_FATAL_FAILURE(print_parse_tree(line.c_str(), of_result, expect_error));
|
||||
if (expect_error != 0) {
|
||||
expect_error = 0;
|
||||
}
|
||||
}
|
||||
of_result.close();
|
||||
// verify results
|
||||
is_equal_content(tmp_file, result_file);
|
||||
}
|
||||
TEST_F(TestParser, pre_parse)
|
||||
{
|
||||
constexpr int STR_NUM = 4;
|
||||
std::string str[] = {"\t/*\ttrace_id=ABC\t*/rpc_id=xxx",
|
||||
"\n/*\ntrace_id=ABC\nrpc_id=xxx*/",
|
||||
"\f/*\ftrace_id=ABC\frpc_id=xxx*/",
|
||||
"\r/*\rtrace_id=ABC\rrpc_id=xxx*/"};
|
||||
const char* test_file = "./test_pre_parse.test";
|
||||
const char* result_file = "./test_pre_parse.result";
|
||||
const char* tmp_file = "./test_pre_parse.tmp";
|
||||
// run tests
|
||||
std::ifstream if_tests(test_file);
|
||||
ASSERT_TRUE(if_tests.is_open());
|
||||
std::ofstream of_result(tmp_file);
|
||||
ASSERT_TRUE(of_result.is_open());
|
||||
std::string line;
|
||||
int64_t case_id = 0;
|
||||
char* w;
|
||||
char* p;
|
||||
for (int i = 0; i < STR_NUM; i++) {
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << str[i] << std::endl;
|
||||
PreParseResult res;
|
||||
ASSERT_EQ(OB_SUCCESS, ObParser::pre_parse(ObString(str[i].length(), str[i].c_str()), res));
|
||||
of_result << "trace_id: " << std::string(res.trace_id_.ptr(), res.trace_id_.length()) << std::endl;
|
||||
}
|
||||
while (std::getline(if_tests, line)) {
|
||||
if (line.size() <= 0)
|
||||
continue;
|
||||
if (line.at(0) == '#')
|
||||
continue;
|
||||
if (strncmp(line.c_str(), "--error", strlen("--error")) == 0) {
|
||||
p = const_cast<char*>(line.c_str());
|
||||
w = strsep(&p, " ");
|
||||
continue;
|
||||
}
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << line << std::endl;
|
||||
PreParseResult res;
|
||||
ASSERT_EQ(OB_SUCCESS, ObParser::pre_parse(ObString(line.length(), line.c_str()), res));
|
||||
of_result << "trace_id: " << std::string(res.trace_id_.ptr(), res.trace_id_.length()) << std::endl;
|
||||
}
|
||||
UNUSED(w);
|
||||
of_result.close();
|
||||
// verify results
|
||||
is_equal_content(tmp_file, result_file);
|
||||
}
|
||||
|
||||
void TestParser::print_parse_tree(const char* query_str, std::ofstream& of_result, int64_t expect_error)
|
||||
{
|
||||
ObSQLMode mode = test::clp.sql_mode;
|
||||
ObParser parser(allocator_, mode);
|
||||
ParseResult parse_result;
|
||||
ObString query = ObString::make_string(query_str);
|
||||
int ret = OB_SUCCESS;
|
||||
ret = parser.parse(query, parse_result);
|
||||
if (expect_error != -ret) {
|
||||
fprintf(stderr, "QUERY:%s failed\n", query_str);
|
||||
}
|
||||
ASSERT_EQ(expect_error, -ret);
|
||||
if (NULL != parse_result.result_tree_) {
|
||||
_OB_LOG(INFO, "%s", CSJ(ObParserResultTreePrintWrapper(*parse_result.result_tree_)));
|
||||
of_result << "question_mask_size: " << parse_result.result_tree_->children_[0]->value_ << std::endl;
|
||||
of_result << CSJ(ObParserResultTreePrintWrapper(*parse_result.result_tree_)) << std::endl;
|
||||
}
|
||||
parser.free_result(parse_result);
|
||||
}
|
||||
|
||||
void TestParser::print_parse_outline(const char* query_str, std::ofstream& of_result, int64_t expect_error)
|
||||
{
|
||||
ObSQLMode mode = test::clp.sql_mode;
|
||||
ObParser parser(allocator_, mode);
|
||||
ParseResult parse_result;
|
||||
ObString query = ObString::make_string(query_str);
|
||||
int ret = OB_SUCCESS;
|
||||
ret = parser.parse(query, parse_result, FP_PARAMERIZE_AND_FILTER_HINT_MODE);
|
||||
if (expect_error != -ret) {
|
||||
fprintf(stderr, "QUERY:%s failed\n", query_str);
|
||||
}
|
||||
ASSERT_EQ(expect_error, -ret);
|
||||
of_result << parse_result.no_param_sql_ << std::endl << std::endl;
|
||||
parser.free_result(parse_result);
|
||||
}
|
||||
|
||||
TEST_F(TestParser, test_parser_outline)
|
||||
{
|
||||
const char* test_file = "./test_parser_outline.test";
|
||||
const char* result_file = "./test_parser_outline.result";
|
||||
const char* tmp_file = "./test_parser_outline.tmp";
|
||||
// run tests
|
||||
std::ifstream if_tests(test_file);
|
||||
ASSERT_TRUE(if_tests.is_open());
|
||||
std::ofstream of_result(tmp_file);
|
||||
ASSERT_TRUE(of_result.is_open());
|
||||
std::string line;
|
||||
int64_t case_id = 0;
|
||||
int64_t expect_error = 0;
|
||||
while (std::getline(if_tests, line)) {
|
||||
if (pretreat_cmd(line, expect_error)) {
|
||||
continue;
|
||||
}
|
||||
of_result << "************** Case " << ++case_id << " ***************" << std::endl;
|
||||
of_result << line << std::endl;
|
||||
ASSERT_NO_FATAL_FAILURE(print_parse_outline(line.c_str(), of_result, expect_error));
|
||||
if (expect_error != 0) {
|
||||
expect_error = 0;
|
||||
}
|
||||
}
|
||||
of_result.close();
|
||||
// verify results
|
||||
is_equal_content(tmp_file, result_file);
|
||||
}
|
||||
|
||||
void TestParser::do_parse(const char* query_str, std::ofstream& of_result, int64_t expect_error)
|
||||
{
|
||||
ObSQLMode mode = test::clp.sql_mode;
|
||||
ObParser parser(allocator_, mode);
|
||||
ParseResult parse_result;
|
||||
ObString query = ObString::make_string(query_str);
|
||||
int ret = OB_SUCCESS;
|
||||
_OB_LOG(INFO, "QUERY: %s", query_str);
|
||||
ret = parser.parse(query, parse_result);
|
||||
if (expect_error != -ret) {
|
||||
fprintf(stderr, "QUERY:%s failed\n", query_str);
|
||||
}
|
||||
ASSERT_EQ(expect_error, -ret);
|
||||
if (NULL != parse_result.result_tree_) {
|
||||
_OB_LOG(INFO, "%s", CSJ(ObParserResultPrintWrapper(*parse_result.result_tree_)));
|
||||
of_result << "question_mask_size: " << parse_result.result_tree_->children_[0]->value_ << std::endl;
|
||||
of_result << CSJ(ObParserResultPrintWrapper(*parse_result.result_tree_)) << std::endl;
|
||||
}
|
||||
parser.free_result(parse_result);
|
||||
}
|
||||
|
||||
void TestParser::do_filter_hint(const char* query_str, std::ofstream& of_result, int64_t expect_error)
|
||||
{
|
||||
ObString real_query = ObString::make_string(query_str).trim();
|
||||
if (real_query.length() > 0 && *real_query.ptr() != '#') {
|
||||
// ignore empty query and comment
|
||||
_OB_LOG(INFO, "query_str: %s", query_str);
|
||||
int ret = OB_SUCCESS;
|
||||
ObString result_query;
|
||||
if (OB_FAIL(ObSQLUtils::filter_hint_in_query_sql(allocator_, session_info_, real_query, result_query))) {
|
||||
_OB_LOG(INFO, "query_str: %s", query_str);
|
||||
if (expect_error != -ret) {
|
||||
fprintf(stderr, "QUERY:%s failed\n", query_str);
|
||||
}
|
||||
ASSERT_EQ(expect_error, -ret);
|
||||
}
|
||||
if (expect_error == 0) {
|
||||
char buffer[OB_MAX_SQL_LENGTH];
|
||||
memset(buffer, '\0', OB_MAX_SQL_LENGTH);
|
||||
memcpy(buffer, result_query.ptr(), result_query.length());
|
||||
of_result << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TestParser::pretreat_cmd(std::string line, int64_t& expect_error)
|
||||
{
|
||||
bool skip_cmd = false;
|
||||
char* w = NULL;
|
||||
char* p = NULL;
|
||||
if (line.size() <= 0)
|
||||
skip_cmd = true;
|
||||
else if (line.at(0) == '#')
|
||||
skip_cmd = true;
|
||||
else if (strncmp(line.c_str(), "--error", strlen("--error")) == 0) {
|
||||
p = const_cast<char*>(line.c_str());
|
||||
w = strsep(&p, " ");
|
||||
expect_error = atol(p);
|
||||
skip_cmd = true;
|
||||
} else if (strncmp(line.c_str(), "--sql_mode", strlen("--sql_mode")) == 0) {
|
||||
p = const_cast<char*>(line.c_str());
|
||||
w = strsep(&p, " ");
|
||||
if (strncmp(p, "oracle", strlen("oracle")) == 0) {
|
||||
OB_LOG(INFO, "switch parser sql_mode to oracle");
|
||||
test::clp.sql_mode = DEFAULT_ORACLE_MODE | SMO_ORACLE;
|
||||
} else if (strncmp(p, "mysql", strlen("mysql")) == 0) {
|
||||
OB_LOG(INFO, "switch parser sql_mode to mysql");
|
||||
test::clp.sql_mode = DEFAULT_MYSQL_MODE;
|
||||
}
|
||||
skip_cmd = true;
|
||||
UNUSED(w);
|
||||
}
|
||||
return skip_cmd;
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
OB_LOGGER.set_file_name("test_parser.log", true);
|
||||
test::parse_cmd_line_param(argc, argv, test::clp);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
3593
unittest/sql/parser/test_parser.expect
Normal file
3593
unittest/sql/parser/test_parser.expect
Normal file
File diff suppressed because it is too large
Load Diff
23626
unittest/sql/parser/test_parser.result
Normal file
23626
unittest/sql/parser/test_parser.result
Normal file
File diff suppressed because it is too large
Load Diff
138
unittest/sql/parser/test_parser.sql
Normal file
138
unittest/sql/parser/test_parser.sql
Normal file
@ -0,0 +1,138 @@
|
||||
#select /*+ READ_CONSISTENCY*/ * from `t1` where c1 = 'a' 'b' /*HINT+ READ_CONSISTENCY*/;
|
||||
select * from t1 where c1 = 1;
|
||||
select * from t1 where c1 = 111111111111111111111111111;
|
||||
select * from t1 where c1 = 'a' /*READ_CONSISTENCY*/;
|
||||
select d.t1.c1, sum(t1.c2) from d.t1 where d.t1.c1 > 0 and c2 + d.t1.c1 = 100 group by d.t1.c2 order by t.d1.c1 desc limit 0, 1;
|
||||
select * from t1 where c1 = 'abc';
|
||||
create table s002 (c1 int primary key, c2 varchar(50), unique index idx(c2(20)));
|
||||
create table s001 (c1 int primary key, c2 varchar(50), unique key idx(c2(20)));
|
||||
create table s001 (c1 int primary key, c2 varchar(50), unique idx(c2(20)));
|
||||
use rongxuan;
|
||||
start transaction read only;
|
||||
start transaction read write;
|
||||
start transaction with consistent snapshot, read only;
|
||||
start transaction read write, with consistent snapshot;
|
||||
alter user 'zdy' account lock;
|
||||
alter user 'zdy' account unlock ;
|
||||
select d.t1.c1, sum(t1.c2) from d.t1 where d.t1.c1 > 0 and c2 + d.t1.c1 = 100 group by d.t1.c2 order by t.d1.c1 desc limit 0, 1;
|
||||
select c1, sum(d.t1.c2) from t1 where t1.c1 > 0 and c2 + t1.c1 = 100 group by t1.c2 order by t1.c1 desc limit 0, 1;
|
||||
select t1.c1, sum(c2) from t1 where c1 > 0 and c2 + c1 = 100 group by c2 order by c1 desc limit 0, 1;
|
||||
insert into t1 values(1, 2);
|
||||
insert into t1.t1 values(1, 2);
|
||||
insert into t1(c1) values(1), (2);
|
||||
insert into t1(t1.c1) values(1), (2);
|
||||
insert into d.t1(d.t1.c1) values(1), (2);
|
||||
update t1 set d.t1.c2=t1.c1+1 where d.t1.c1 > 1 order by d.t1.c1 desc limit 0, 10;
|
||||
update d.t1 set t1.c2=d.t1c1+1 where t1.c1 > 1 order by c1 desc limit 0, 10;
|
||||
delete from d.t1 where d.t1.c2 > 10 order by c1 limit 0, 1;
|
||||
select t1.c1, t2.c1 from d.t1 join d.t2 on d.t1.c1=t2.c1 where t1.c1>0;
|
||||
select d.t1.c1, t2.c1 from d.t1 join t2 on t1.c1=t2.c1 where t1.c1>0;
|
||||
select d.t1.c1, t2.c1 from d.t1 join t2 on c1=c1 where t1.c1>0;
|
||||
insert into t1 value (1, 2), (3, 4) on duplicate key update d.t.c1 = t.c2 + 1, c2 = c2 + 3;
|
||||
insert into d.t1 value (1, 2), (3, 4) on duplicate key update t.c1 = t.c2 + 1, d.t.c2 = t.c2 + 3;
|
||||
create table rongxuan(c int primary key, c2 int);
|
||||
create table rongxuan(rongxuan.c int primary key, c2 int);
|
||||
create table rongxuan(d.rongxuan.c int primary key, c2 int);
|
||||
drop table t1;
|
||||
drop table oceanbase.t, t1;
|
||||
alter table rongxuan add c3 int;
|
||||
alter table rongxuan add rongxuan.c4 int;
|
||||
alter table rongxuan add test.rongxuan.c5 int;
|
||||
drop database rongxuan;
|
||||
create database rongxuan;
|
||||
create database if not exists rongxuan;
|
||||
create database if not exists rongxuan default character set = 'utf8' default collate = 'default_collate';
|
||||
select * from d.t1 PARTITION(p1, p2);
|
||||
delete from d.t1 PARTITION(p0, p1);
|
||||
update d.t1 PARTITION (p2) SET id = 2 WHERE name = 'Jill';
|
||||
INSERT INTO d.t1 PARTITION (p3, p4) VALUES (24, 'Tim', 'Greene', 3, 1), (26, 'Linda', 'Mills', 2, 1);
|
||||
REPLACE INTO d.t1 PARTITION (p0) VALUES (20, 'Jan', 'Jones', 3, 2);
|
||||
SELECT e.id, s.city, d.name FROM e JOIN stores PARTITION (p1) ON e.id=s.id JOIN departments PARTITION (p0) ON e.id=d.id;
|
||||
alter system switch replica leader zone = 'z1';
|
||||
alter system switch replica leader server = '127.0.0.1:80';
|
||||
alter system switch replica leader partition_id = '1%8@3001' server = '127.0.0.1:80';
|
||||
alter system switch replica leader partition_id '1%8@3001' server '127.0.0.1:80';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' create_timestamp = 1;
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' zone = 'z1';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' create_timestamp = 1 zone = 'z1';
|
||||
alter system drop replica partition_id '1%8@3001' server '127.0.0.1:80' create_timestamp 1 zone 'z1';
|
||||
alter system copy replica partition_id = '1%8@3001' source = '127.0.0.1:80' destination = '127.0.0.2:80';
|
||||
alter system copy replica partition_id = '1%8@3001' source = '127.0.0.1:80' destination = '127.0.0.2:80';
|
||||
alter system move replica partition_id = '1%8@3001' source = '127.0.0.1:80' destination = '127.0.0.2:80';
|
||||
alter system move replica partition_id '1%8@3001' source '127.0.0.1:80' destination '127.0.0.2:80';
|
||||
alter system move replica partition_id '1%8@3001' source '127.0.0.1:80' destination '127.0.0.2:80';
|
||||
alter system report replica;
|
||||
alter system report replica server = '127.0.0.1:80';
|
||||
alter system report replica zone = 'z1';
|
||||
alter system recycle replica;
|
||||
alter system recycle replica server = '127.0.0.1:80';
|
||||
alter system recycle replica server '127.0.0.1:80';
|
||||
alter system recycle replica zone = 'z1';
|
||||
alter system recycle replica zone 'z1';
|
||||
alter system major freeze;
|
||||
alter system start merge zone = 'z1';
|
||||
alter system suspend merge;
|
||||
alter system suspend merge zone = 'z1';
|
||||
alter system resume merge;
|
||||
alter system resume merge zone = 'z1';
|
||||
alter system clear roottable;
|
||||
alter system clear roottable tenant = 'xxx';
|
||||
select * from t1 where c1>ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1 in (select c1 from t2 where c2>1);
|
||||
select * from t1 where c1 not in (select c1 from t2 where c2>1);
|
||||
select * from t1 where exists (select c1 from t2 where c2>1);
|
||||
select * from t1 where not exists (select c1 from t2 where c2>1);
|
||||
select * from t1 where (select c1 from t1) like (select c2 from t2);
|
||||
select * from t1 where (select c1 from t1) not like (select c2 from t2);
|
||||
select * from t1 where (c1) in (select c1 from t2);
|
||||
select * from t1 where (c1, c2) in (select c1, c2 from t2);
|
||||
select * from t1 where ROW(c1, c2) in (select c1, c2 from t2);
|
||||
set names latin1;
|
||||
set names 'latin1';
|
||||
set names utf8 collate 'utf8_general_ci';
|
||||
set names utf8 collate utf8_general_ci;
|
||||
set character set utf8;
|
||||
set character set 'utf8';
|
||||
set charset utf8;
|
||||
select _utf8 'abc', _utf8mb4 'def' collate utf8mb4_general_ci from t1 where c1 collate utf8_bin = 'xyz' collate utf8_bin;
|
||||
select * from t1 where c1=?;
|
||||
select * from t1 where c1>?;
|
||||
select * from t1 where (select c1 from t1 where c1 = ?) not like (select c2 from t2 where c2=?);
|
||||
#test join syntax with no join_condition;
|
||||
select * from t1 join t2;
|
||||
select * from t1 inner join t2;
|
||||
select * from t1 cross join t2;
|
||||
select * from t1 cross join t2 join t3;
|
||||
select "1234";
|
||||
select '1234';
|
||||
create table test(c1 varchar(3) binary);
|
||||
create table test(c1 varchar(3) binary charset utf8mb4);
|
||||
replace into test values(1,2);
|
||||
insert ignore into test values(1,2);
|
||||
insert ignore into test values(1,2) on duplicate key update c2 = c1 + 1;
|
||||
update ignore tt set c1 = 1;
|
||||
296
unittest/sql/parser/test_parser.test
Normal file
296
unittest/sql/parser/test_parser.test
Normal file
@ -0,0 +1,296 @@
|
||||
create table t1(c1 bit);
|
||||
create table t1(c1 bit(10));
|
||||
|
||||
#error
|
||||
create table s002 (c1 int primary key, c2 varchar(50), unique index idx(c2(20)))
|
||||
create table s001 (c1 int primary key, c2 varchar(50), unique key idx(c2(20)))
|
||||
create table s001 (c1 int primary key, c2 varchar(50), unique idx(c2(20)))
|
||||
|
||||
use rongxuan;
|
||||
start transaction read only;
|
||||
start transaction read write;
|
||||
start transaction with consistent snapshot, read only;
|
||||
start transaction read write, with consistent snapshot;
|
||||
alter user 'zdy' account lock;
|
||||
alter user 'zdy' account unlock;
|
||||
select d.t1.c1, sum(t1.c2) from d.t1 where d.t1.c1 > 0 and c2 + d.t1.c1 = 100 group by d.t1.c2 order by t.d1.c1 desc limit 0, 1
|
||||
select c1, sum(d.t1.c2) from t1 where t1.c1 > 0 and c2 + t1.c1 = 100 group by t1.c2 order by t1.c1 desc limit 0, 1
|
||||
select t1.c1, sum(c2) from t1 where c1 > 0 and c2 + c1 = 100 group by c2 order by c1 desc limit 0, 1
|
||||
insert into t1 values(1, 2)
|
||||
insert into t1.t1 values(1, 2)
|
||||
insert into t1(c1) values(1), (2)
|
||||
insert into t1(t1.c1) values(1), (2)
|
||||
insert into d.t1(d.t1.c1) values(1), (2)
|
||||
update t1 set d.t1.c2=t1.c1+1 where d.t1.c1 > 1 order by d.t1.c1 desc limit 0, 10
|
||||
update d.t1 set t1.c2=d.t1c1+1 where t1.c1 > 1 order by c1 desc limit 0, 10
|
||||
delete from d.t1 where d.t1.c2 > 10 order by c1 limit 0, 1
|
||||
select t1.c1, t2.c1 from d.t1 join d.t2 on d.t1.c1=t2.c1 where t1.c1>0;
|
||||
select d.t1.c1, t2.c1 from d.t1 join t2 on t1.c1=t2.c1 where t1.c1>0;
|
||||
select d.t1.c1, t2.c1 from d.t1 join t2 on c1=c1 where t1.c1>0;
|
||||
insert into t1 value (1, 2), (3, 4) on duplicate key update d.t.c1 = t.c2 + 1, c2 = c2 + 3;
|
||||
insert into d.t1 value (1, 2), (3, 4) on duplicate key update t.c1 = t.c2 + 1, d.t.c2 = t.c2 + 3;
|
||||
create table rongxuan(c int primary key, c2 int)
|
||||
create table rongxuan(rongxuan.c int primary key, c2 int)
|
||||
create table rongxuan(d.rongxuan.c int primary key, c2 int)
|
||||
drop table t1
|
||||
drop table oceanbase.t, t1
|
||||
alter table rongxuan add c3 int;
|
||||
alter table rongxuan add rongxuan.c4 int;
|
||||
alter table rongxuan add test.rongxuan.c5 int;
|
||||
drop database rongxuan
|
||||
create database rongxuan
|
||||
create database if not exists rongxuan
|
||||
create database if not exists rongxuan default character set = 'utf8' default collate = 'default_collate'
|
||||
select * from d.t1 PARTITION(p1, p2);
|
||||
delete from d.t1 PARTITION(p0, p1);
|
||||
update d.t1 PARTITION (p2) SET id = 2 WHERE name = 'Jill';
|
||||
INSERT INTO d.t1 PARTITION (p3, p4) VALUES (24, 'Tim', 'Greene', 3, 1), (26, 'Linda', 'Mills', 2, 1);
|
||||
REPLACE INTO d.t1 PARTITION (p0) VALUES (20, 'Jan', 'Jones', 3, 2);
|
||||
SELECT e.id, s.city, d.name FROM e JOIN stores PARTITION (p1) ON e.id=s.id JOIN departments PARTITION (p0) ON e.id=d.id;
|
||||
alter system switch replica leader zone = 'z1';
|
||||
alter system switch replica leader server = '127.0.0.1:80';
|
||||
alter system switch replica leader partition_id = '1%8@3001' server = '127.0.0.1:80';
|
||||
alter system switch replica leader partition_id '1%8@3001' server '127.0.0.1:80';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' create_timestamp = 1;
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' zone = 'z1';
|
||||
alter system drop replica partition_id = '1%8@3001' server = '127.0.0.1:80' create_timestamp = 1 zone = 'z1';
|
||||
alter system drop replica partition_id '1%8@3001' server '127.0.0.1:80' create_timestamp 1 zone 'z1';
|
||||
alter system copy replica partition_id = '1%8@3001' source = '127.0.0.1:80' destination = '127.0.0.2:80';
|
||||
alter system move replica partition_id = '1%8@3001' source = '127.0.0.1:80' destination = '127.0.0.2:80';
|
||||
alter system move replica partition_id '1%8@3001' source '127.0.0.1:80' destination '127.0.0.2:80';
|
||||
alter system report replica;
|
||||
alter system report replica server = '127.0.0.1:80';
|
||||
alter system report replica zone = 'z1';
|
||||
alter system recycle replica;
|
||||
alter system recycle replica server = '127.0.0.1:80';
|
||||
alter system recycle replica server '127.0.0.1:80';
|
||||
alter system recycle replica zone = 'z1';
|
||||
alter system recycle replica zone 'z1';
|
||||
alter system major freeze;
|
||||
alter system start merge zone = 'z1';
|
||||
alter system suspend merge;
|
||||
alter system suspend merge zone = 'z1';
|
||||
alter system resume merge;
|
||||
alter system resume merge zone = 'z1';
|
||||
alter system clear roottable;
|
||||
alter system clear roottable tenant = 'xxx';
|
||||
alter system modify zone 'z1' set region 'r1'
|
||||
--error 5001
|
||||
alter system start zone 'z1' region 'r1'
|
||||
alter system modify zone 'z1' IDC 'idc1'
|
||||
alter system modify zone 'z1' set IDC 'idc1', region 'r1'
|
||||
alter system add zone 'z1' idc 'idc1', region 'r1'
|
||||
alter system add zone 'z1' idc 'idc1'
|
||||
alter system modify zone 'z1'
|
||||
--error 5001
|
||||
alter system start zone 'z1' IDC 'idc1'
|
||||
--error 5001
|
||||
alter system start zone 'z1' zone_type 'ReadWrite'
|
||||
alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1'
|
||||
alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1'
|
||||
alter system add zone 'z1' zone_type 'ReadWrite', region 'r1'
|
||||
alter system add zone 'z1' zone_type 'ReadWrite'
|
||||
alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1'
|
||||
alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1'
|
||||
alter system modify zone 'z1' zone_type 'ReadWrite', region 'r1'
|
||||
alter system modify zone 'z1' zone_type 'ReadWrite'
|
||||
select * from t1 where c1>ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1>=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1<=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=ANY(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=SOME(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=ALL(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1!=(select c1 from t2 where c2>1);
|
||||
select * from t1 where c1 in (select c1 from t2 where c2>1);
|
||||
select * from t1 where c1 not in (select c1 from t2 where c2>1);
|
||||
select * from t1 where exists (select c1 from t2 where c2>1);
|
||||
select * from t1 where not exists (select c1 from t2 where c2>1);
|
||||
select * from t1 where (select c1 from t1) like (select c2 from t2);
|
||||
select * from t1 where (select c1 from t1) not like (select c2 from t2);
|
||||
select * from t1 where (c1) in (select c1 from t2);
|
||||
select * from t1 where (c1, c2) in (select c1, c2 from t2);
|
||||
select * from t1 where ROW(c1, c2) in (select c1, c2 from t2);
|
||||
set names latin1;
|
||||
set names 'latin1';
|
||||
set names utf8 collate 'utf8_general_ci';
|
||||
set names utf8 collate utf8_general_ci;
|
||||
set character set utf8;
|
||||
set character set 'utf8';
|
||||
set charset utf8;
|
||||
select _utf8 'abc', _utf8mb4 'def' collate utf8mb4_general_ci from t1 where c1 collate utf8_bin = 'xyz' collate utf8_bin;
|
||||
select * from t1 where c1=?;
|
||||
select * from t1 where c1>?;
|
||||
select * from t1 where (select c1 from t1 where c1 = ?) not like (select c2 from t2 where c2=?);
|
||||
#test join syntax with no join_condition
|
||||
select * from t1 join t2;
|
||||
select * from t1 inner join t2;
|
||||
select * from t1 cross join t2;
|
||||
select * from t1 cross join t2 join t3;
|
||||
select "1234";
|
||||
select '1234';
|
||||
create table test(c1 varchar(3) binary) locality="f@zone1, f,l@region1";
|
||||
create table test(c1 varchar(3) binary charset utf8mb4);
|
||||
replace into test values(1,2);
|
||||
replace ignore into test values(1,2);
|
||||
insert ignore into test values(1,2);
|
||||
insert ignore into test values(1,2) on duplicate key update c2 = c1 + 1;
|
||||
|
||||
#test for create outline
|
||||
create outline out_name on select * from t1;
|
||||
create or replace outline out_name on select * from t1;
|
||||
create outline out_name on select * from t1;
|
||||
create outline out_name on select /*+ssssss*/* from t1;
|
||||
create outline out_name on select /*+ssssss*/* from t1 to select /*+ssssss*/* from t1;
|
||||
create outline out_name on select /*+ssssss*/* from t1 to select * from t1;
|
||||
create outline out_name on insert /*+ssssss*/ into t1 values(1, 2) to insert /*+ssssss*/ into t1 values(1, 2);
|
||||
|
||||
#test for drop outline
|
||||
drop outline out_name;
|
||||
drop outline db_name.out_name;
|
||||
|
||||
#test create tenant, alter tenant
|
||||
create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%';
|
||||
create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%';
|
||||
create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%';
|
||||
create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%';
|
||||
create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%';
|
||||
create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%';
|
||||
|
||||
select /*+max_concurrent(-10)*/* from t1;
|
||||
select /*+max_concurrent(10)*/* from t1;
|
||||
|
||||
alter system refresh time_zone_info;
|
||||
|
||||
########################## test for hierarchical query ###################################
|
||||
|
||||
### test for prior expression ###
|
||||
|
||||
#select emp_id, mgr_id, emp_name from emp connect by prior emp_id = mgr_id;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by prior (emp_id + 1) = mgr_id;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by prior emp_id = mgr_id and prior emp_id = emp_name;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by prior emp_id = mgr_id or prior emp_id = emp_name;
|
||||
#
|
||||
#select emp_id, mgr_id, emp_name from emp connect by emp_id != 1;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by emp_id != 1 and emp_id = 2;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by emp_id != 1 or emp_id = 2;
|
||||
#
|
||||
#select emp_id, mgr_id, emp_name from emp connect by prior emp_id = mgr_id and emp_id > 10;
|
||||
#
|
||||
#select emp_id, mgr_id, emp_name from emp connect by nocycle prior emp_id = mgr_id;
|
||||
#
|
||||
#select emp_id, mgr_id, emp_name from emp connect by nocycle prior (select min(c1) from t1) = mgr_id;
|
||||
#select emp_id, mgr_id, emp_name from emp connect by nocycle prior emp_id = (select min(c1) from t1);
|
||||
#select emp_id, emp_name, mgr_id from emp connect by prior emp_id = (select min(c1) from t1 where c1 > emp_id);
|
||||
#
|
||||
#### test start with ###
|
||||
#
|
||||
#select emp_id, mgr_id, emp_name from emp start with emp_id = 1 connect by prior emp_id = mgr_id;
|
||||
#select emp_id, mgr_id, emp_name from emp start with (select min(c1) from t1) = 1 connect by prior emp_id = mgr_id;
|
||||
#select emp_id, mgr_id, emp_name from emp start with emp_id = 1 or emp_id = 2 connect by prior emp_id = mgr_id;
|
||||
#
|
||||
#### test for pseudocolumn ##
|
||||
#select level, emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select max(level), emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select level, emp_id from emp where level < 1 connect by prior emp_id = mgr_id;
|
||||
#--error 5001
|
||||
#create table t1(level int);
|
||||
#create table t1(`level` int);
|
||||
#
|
||||
#select connect_by_isleaf, emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select max(connect_by_isleaf), emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select connect_by_isleaf, emp_id from emp where connect_by_isleaf < 1 connect by prior emp_id = mgr_id;
|
||||
#
|
||||
#select connect_by_iscycle, emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select max(connect_by_iscycle), emp_id from emp connect by prior emp_id = mgr_id;
|
||||
#select connect_by_iscycle, emp_id from emp where connect_by_iscycle < 1 connect by prior emp_id = mgr_id;
|
||||
#
|
||||
#### test for order siblings by ##
|
||||
#select emp_id from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#select emp_id from emp connect by prior emp_id = gmr_id order siblings by emp_id;
|
||||
#select emp_id from emp connect by prior emp_id = gmr_id order siblings by emp_id asc;
|
||||
#select emp_id from emp connect by prior emp_id = gmr_id order siblings by emp_id asc, mgr_id;
|
||||
#
|
||||
#### test for connect_by_root ###
|
||||
#select connect_by_root(emp_id) from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#select connect_by_root(level) from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#
|
||||
### test for sys_connect_by_path ##
|
||||
#select sys_connect_by_path(emp_id, 1) from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#select sys_connect_by_path(emp_id, '/') from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#select sys_connect_by_path(1, '/') from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#select sys_connect_by_path(emp_id + 1, '/') from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#--error 5001
|
||||
#select sys_connect_by_path(emp_id, mgr_id) from emp connect by prior emp_id = gmr_id order by emp_id;
|
||||
#
|
||||
### test for group by ##
|
||||
#select emp_id, mgr_id from emp where emp_id = 1 start with emp_id = 1 connect by prior c1 = 1 group by c1 having c1 > 1;
|
||||
#
|
||||
### test for limit ##
|
||||
#select emp_id, mgr_id from emp where emp_id = 1 start with emp_id = 1 connect by prior c1 = 1 group by c1 having c1 > 1 limit 10;
|
||||
|
||||
########################## test for drop synonym ###################################
|
||||
drop public synonym t1;
|
||||
drop public synonym t1 force;
|
||||
drop synonym t1 force;
|
||||
drop synonym database1.t1 force;
|
||||
|
||||
#purge index t1_index;
|
||||
|
||||
|
||||
######################## test for merge stmt ####################################
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales);
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t2.id!= t1.id when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales);
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t1.id < 3 delete where t1.id < 5 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales);
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales delete where t1.sales =2 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales);
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0;
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (1 = 2) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0;
|
||||
--error 5001
|
||||
merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales;
|
||||
--error 5001
|
||||
merge into targetTable using sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales;
|
||||
--error 5001
|
||||
merge into targetTable using (select * from t1 ) sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales;
|
||||
|
||||
select unique(c1), c2 from t1;
|
||||
select unique(c1+1), c2 from t1;
|
||||
select distinct unique( max(c1)), c2 from t1;
|
||||
select unique distinct( max(c1)), c2 from t1;
|
||||
--error 5001
|
||||
select unique(*) from t1;
|
||||
|
||||
############# tablegroup ##################
|
||||
--sql_mode mysql
|
||||
create tablegroup tg1 primary_zone = 'z2';
|
||||
create tablegroup tg1 locality = 'z2';
|
||||
create tablegroup tg1 locality = 'z2', primary_zone='z2';
|
||||
alter tablegroup tg1 set primary_zone = "z1:z2";
|
||||
alter tablegroup tg1 set locality='f@z1,f@z3';
|
||||
alter tablegroup tg2 add table t1,t2;
|
||||
alter tablegroup tg1 set locality='f@z1,f@z3', set primary_zone = "z1:z2";
|
||||
insert into t1 values(X'');
|
||||
create table t1(`thedate` date NOT NULL COMMENT '日期');
|
||||
alter system bootstrap REGION 'sys_region' ZONE 'zone1' SERVER '10.101.74.122:41425';
|
||||
692
unittest/sql/parser/test_parser_outline.result
Normal file
692
unittest/sql/parser/test_parser_outline.result
Normal file
@ -0,0 +1,692 @@
|
||||
************** Case 1 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 2 ***************
|
||||
select /*+trace_log no_rewrite*/ * from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 3 ***************
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 4 ***************
|
||||
select /*+*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 5 ***************
|
||||
select /*+sss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 6 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 7 ***************
|
||||
select /*+trace_log no_rewrite ssss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 8 ***************
|
||||
select /*+ssss no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 9 ***************
|
||||
select */*+trace_log no_rewrite*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 10 ***************
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 11 ***************
|
||||
select * from (select /*+SSSSSS*/ * from t1) as tt where c1 = 1 limit 1 order by 1;
|
||||
select * from (select * from t1) as tt where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 12 ***************
|
||||
select * from /*+sssssss*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from from t1 where c1 = ? limit ? order by ?;
|
||||
|
||||
************** Case 13 ***************
|
||||
update /*+sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update t1 set c1 = ? where c1 = ?;
|
||||
|
||||
************** Case 14 ***************
|
||||
update /*+no_rewrite sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update t1 set c1 = ? where c1 = ?;
|
||||
|
||||
************** Case 15 ***************
|
||||
update /*+sssss*/ t1 set c1 = 1 where /*+sssss*/ c1 = 100;
|
||||
update t1 set c1 = ? where c1 = ?;
|
||||
|
||||
************** Case 16 ***************
|
||||
delete /*+sssss*/ from t1 where c=1;
|
||||
delete from t1 where c=?;
|
||||
|
||||
************** Case 17 ***************
|
||||
delete /*+no_rewrite sssss*/ from t1 where c=1;
|
||||
delete from t1 where c=?;
|
||||
|
||||
************** Case 18 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "t1"@"SEL$1") READ_CONSISTENCY("WEAK") HOTSPOT TOPK(1 100) QUERY_TIMEOUT(100) FROZEN_VERSION(1) USE_PLAN_CACHE("EXACT") ACTIVATE_BURIED_POINT(1, FIX_MODE, 1, 1) NO_REWRITE TRACE_LOG LOG_LEVEL('info') END_OUTLINE_DATA */* from t1;
|
||||
select * from t1;
|
||||
|
||||
************** Case 19 ***************
|
||||
select /*+INDEX(@"SEL$2" "opt.t4"@"SEL$2" "idx_t4_c3")*/* from t1 where c1 in (select c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
|
||||
************** Case 20 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA INDEX(@"SEL$1" "opt.t4"@"SEL$1" "idx_t4_c3") END_OUTLINE_DATA */ * from t4 where c1 = 1;
|
||||
select * from t4 where c1 = ?;
|
||||
|
||||
************** Case 21 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "opt.t4"@"SEL$1") END_OUTLINE_DATA */ * from t4 where c2 = 1;
|
||||
select * from t4 where c2 = ?;
|
||||
|
||||
************** Case 22 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_MERGE(@"SEL$1" "opt.t2"@"SEL$1") LEADING(@"SEL$1" "opt.t1"@"SEL$1" "opt.t2"@"SEL$1") FULL(@"SEL$1" "opt.t1"@"SEL$1") FULL(@"SEL$1" "opt.t2"@"SEL$1") END_OUTLINE_DATA */* from t1,t2 where t1.c1=t2.c1;
|
||||
select * from t1,t2 where t1.c1=t2.c1;
|
||||
|
||||
************** Case 23 ***************
|
||||
select /*+log_level('info')*/* from t1;
|
||||
select * from t1;
|
||||
|
||||
************** Case 24 ***************
|
||||
select /*+log_level('info')*/t1.c1,t2.c1 from t1,t2 group by t1.c1,t2.c1 having c1 =1;
|
||||
select t1.c1,t2.c1 from t1,t2 group by t1.c1,t2.c1 having c1 =?;
|
||||
|
||||
************** Case 25 ***************
|
||||
select /*+log_level('info')*/* from t1 for update;
|
||||
select * from t1 for update;
|
||||
|
||||
************** Case 26 ***************
|
||||
select * from /*+sssssss*/ from t1 where c1 in (select /*+fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
select * from from t1 where c1 in (select c1 from t2) limit ? order by ?;
|
||||
|
||||
************** Case 27 ***************
|
||||
select * from /*sssssss*/ from t1 where c1 in (select /*fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
select * from from t1 where c1 in (select c1 from t2) limit ? order by ?;
|
||||
|
||||
************** Case 28 ***************
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 ;
|
||||
update t1 set c1 = ? where c2 ;
|
||||
|
||||
************** Case 29 ***************
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 > any(select /*+index(t3 c1) trace_log*/c1 from t3 where c2 not in (select c1 from t4 order by c1 limit 2));
|
||||
update t1 set c1 = ? where c2 > any(select c1 from t3 where c2 not in (select c1 from t4 order by c1 limit ?));
|
||||
|
||||
************** Case 30 ***************
|
||||
update/*+index(t2 i2)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=2 where c1>0 and vt2.c2<2 order by vt2.c1 asc, vt2.c2 desc limit 2 offset 10;
|
||||
update t2 vt2 set vt2.c1=?*vt2.c2,c1=c1+?,vt2.c2=?,c3=? where c1>? and vt2.c2<? order by vt2.c1 asc, vt2.c2 desc limit ? offset ?;
|
||||
|
||||
************** Case 31 ***************
|
||||
update/*+index(t2 i2),query_timeout(2000)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=10 where c1>0 and vt2.c2<10 order by vt2.c1 asc,c2 desc limit 10,10
|
||||
update t2 vt2 set vt2.c1=?*vt2.c2,c1=c1+?,vt2.c2=?,c3=? where c1>? and vt2.c2<? order by vt2.c1 asc,c2 desc limit ?,?
|
||||
|
||||
************** Case 32 ***************
|
||||
UPDATE t1 SET c1=c1+(SELECT MAX(C1) FROM (SELECT 1) t) WHERE c1=(SELECT /*+index(t2 i2),query_timeout(2000)*/ MAX(c1));
|
||||
UPDATE t1 SET c1=c1+(SELECT MAX(C1) FROM (SELECT ?) t) WHERE c1=(SELECT MAX(c1));
|
||||
|
||||
************** Case 33 ***************
|
||||
update t1 set c2 = 6 where c1 = (select /*+index(t2 i2),query_timeout(2000)*/max(c1) from t1);
|
||||
update t1 set c2 = ? where c1 = (select max(c1) from t1);
|
||||
|
||||
************** Case 34 ***************
|
||||
insert /*+index(t2 i2)*/into ta select * from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
insert into ta select * from t3 on duplicate key update c1 = c1 + ?, c2 = values(c2);
|
||||
|
||||
************** Case 35 ***************
|
||||
insert into t1 values (1,2),(3,4) on duplicate key update c1=values(c2)+values(c1), c2= values(c1)+values(c1);
|
||||
insert into t1 values (?,?),(?,?) on duplicate key update c1=values(c2)+values(c1), c2= values(c1)+values(c1);
|
||||
|
||||
************** Case 36 ***************
|
||||
insert into t4 (c1,c2,c3) values(11, 2, default), (13,3, default) on duplicate key update c2 = 5, c3=4;
|
||||
insert into t4 (c1,c2,c3) values(?, ?, default), (?,?, default) on duplicate key update c2 = ?, c3=?;
|
||||
|
||||
************** Case 37 ***************
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (?,?), (?, ?);
|
||||
|
||||
************** Case 38 ***************
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (?,?), (?, ?);
|
||||
|
||||
************** Case 39 ***************
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (?,?), (?, ?);
|
||||
|
||||
************** Case 40 ***************
|
||||
insert into ta select /*+index(t2 i2)*/* from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
insert into ta select * from t3 on duplicate key update c1 = c1 + ?, c2 = values(c2);
|
||||
|
||||
************** Case 41 ***************
|
||||
delete from t1 where c2 > 10 order by c1 limit 0, 1;
|
||||
delete from t1 where c2 > ? order by c1 limit ?, ?;
|
||||
|
||||
************** Case 42 ***************
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 =1;
|
||||
delete from t1 where c1 =?;
|
||||
|
||||
************** Case 43 ***************
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 in (select /*trace_log*/c2 from t2);
|
||||
delete from t1 where c1 in (select c2 from t2);
|
||||
|
||||
************** Case 44 ***************
|
||||
delete /*dfasdasf*/ from test where c1 = 1;
|
||||
delete from test where c1 = ?;
|
||||
|
||||
************** Case 45 ***************
|
||||
select /*+no_rewrite*/* from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
select * from t1 where c1 = ? and c2 = ? order by ?;
|
||||
|
||||
************** Case 46 ***************
|
||||
select * from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
select * from t1 where c1 = ? and c2 = ? order by ?;
|
||||
|
||||
************** Case 47 ***************
|
||||
select * from t1 where c1 = 'aaaaa';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 48 ***************
|
||||
select * from t1 where c1 = "aaaaa";
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 49 ***************
|
||||
select * from t1 where c1 = '''';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 50 ***************
|
||||
select * from t1 where c1 = '"';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 51 ***************
|
||||
select * from t1 where c1 = "''";
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 52 ***************
|
||||
select * from t1 where c1 = '\\';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 53 ***************
|
||||
select * from t1 where c1 = "\t";
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 54 ***************
|
||||
select * from t1 where c1 = '\n';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 55 ***************
|
||||
select * from t1 where c1 = "\n";
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 56 ***************
|
||||
select * from t1 where c1 = ' ';
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 57 ***************
|
||||
select * from t1 where c1 = " ";
|
||||
select * from t1 where c1 = ?;
|
||||
|
||||
************** Case 58 ***************
|
||||
select * from t1 where c1 = `aaaaa`;
|
||||
select * from t1 where c1 = `aaaaa`;
|
||||
|
||||
************** Case 59 ***************
|
||||
select * from t1 where c1 = ````;
|
||||
select * from t1 where c1 = ````;
|
||||
|
||||
************** Case 60 ***************
|
||||
select /*+ leading(ta, tb) use_nl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
select * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
|
||||
************** Case 61 ***************
|
||||
select /*+ leading(ta, tb) use_bnl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
select * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
|
||||
************** Case 62 ***************
|
||||
select /*+ leading(t1) use_nl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
select * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
|
||||
************** Case 63 ***************
|
||||
select /*+ leading(t1) use_bnl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
select * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
|
||||
************** Case 64 ***************
|
||||
select /*+ leading(t2, t1) use_merge(t1)*/ * from hint.t2, opt.t1 where t1.c1 = t2.a;
|
||||
select * from hint.t2, opt.t1 where t1.c1 = t2.a;
|
||||
|
||||
************** Case 65 ***************
|
||||
select /*+ index(hint.t1 idx_t1_a)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c1;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c1;
|
||||
|
||||
************** Case 66 ***************
|
||||
select /*+ full(opt.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
|
||||
************** Case 67 ***************
|
||||
select /*+ ordered use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
|
||||
************** Case 68 ***************
|
||||
select /*+ ordered use_bnl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
|
||||
************** Case 69 ***************
|
||||
select /*+ leading(tb, opt.t1) use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
|
||||
************** Case 70 ***************
|
||||
select /*+ leading(tb, opt.t1) use_bnl(hint.t2, opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
|
||||
************** Case 71 ***************
|
||||
select * from opt.t1,opt.t2 use index (idx_t1_c2) where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1,opt.t2 use index (idx_t1_c2) where opt.t1.c1 = opt.t2.c2;
|
||||
|
||||
************** Case 72 ***************
|
||||
select /*+ index(t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
|
||||
************** Case 73 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
|
||||
************** Case 74 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(hint.t2, hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
|
||||
************** Case 75 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(test hint.t2) use_nl(hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
|
||||
************** Case 76 ***************
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 77 ***************
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 78 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 79 ***************
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 80 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 81 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 82 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 83 ***************
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
|
||||
************** Case 84 ***************
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_c2, idx_t1_a) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_c2, idx_t1_a) where opt.t1.c1 = hint.t1.a;
|
||||
|
||||
************** Case 85 ***************
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
|
||||
************** Case 86 ***************
|
||||
select * from opt.t1,hint.t1 force index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 force index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
|
||||
************** Case 87 ***************
|
||||
select * from opt.t4 force index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 force index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
|
||||
************** Case 88 ***************
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
|
||||
************** Case 89 ***************
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
|
||||
************** Case 90 ***************
|
||||
select * from opt.t4, hint.t1 ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where opt.t4.c1 = hint.t1.a;
|
||||
select * from opt.t4, hint.t1 ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where opt.t4.c1 = hint.t1.a;
|
||||
|
||||
************** Case 91 ***************
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where ta.c1 = tb.a;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where ta.c1 = tb.a;
|
||||
|
||||
************** Case 92 ***************
|
||||
select * from opt.t1 use index(idx_yeti, idx_t1_c2) where opt.t1.c1 = opt.t1.c1;
|
||||
select * from opt.t1 use index(idx_yeti, idx_t1_c2) where opt.t1.c1 = opt.t1.c1;
|
||||
|
||||
************** Case 93 ***************
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_test, idx_t1_a) where ta.c1 = tb.a;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_test, idx_t1_a) where ta.c1 = tb.a;
|
||||
|
||||
************** Case 94 ***************
|
||||
select * from opt.t1 use index(index_t1_c2) where opt.t1.c2 = (select hint.t1.a from hint.t1,opt.t2 use index(idx_t1_a) where opt.t2.c1 = hint.t1.b);
|
||||
select * from opt.t1 use index(index_t1_c2) where opt.t1.c2 = (select hint.t1.a from hint.t1,opt.t2 use index(idx_t1_a) where opt.t2.c1 = hint.t1.b);
|
||||
|
||||
************** Case 95 ***************
|
||||
select /*+ idex(yeti idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 where yeti.a = opt.t1.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 where yeti.a = opt.t1.c2;
|
||||
|
||||
************** Case 96 ***************
|
||||
select /*+ idex(ta idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
|
||||
************** Case 97 ***************
|
||||
select /*+ idex(opt.t1 idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
select * from (select * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
|
||||
************** Case 98 ***************
|
||||
select /*+ full(opt.t1)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
|
||||
************** Case 99 ***************
|
||||
select /*+ full(opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
|
||||
************** Case 100 ***************
|
||||
select /*+ full(opt.t1 hint.t2)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
|
||||
************** Case 101 ***************
|
||||
select /*+ full(opt.t1) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
|
||||
************** Case 102 ***************
|
||||
select /*+ full(opt.ta) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
|
||||
************** Case 103 ***************
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
|
||||
************** Case 104 ***************
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
|
||||
************** Case 105 ***************
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_nl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
|
||||
************** Case 106 ***************
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_bnl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
|
||||
************** Case 107 ***************
|
||||
select /*+ ordered use_merge(ta,tb,tc,td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
|
||||
************** Case 108 ***************
|
||||
select /*+ ordered use_nl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
|
||||
************** Case 109 ***************
|
||||
select /*+ ordered use_bnl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
|
||||
************** Case 110 ***************
|
||||
select /*+ ordered*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
|
||||
************** Case 111 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 112 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 113 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 114 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 115 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) */ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
************** Case 116 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_nl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
************** Case 117 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_bnl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
************** Case 118 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 119 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_nl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 120 ***************
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_bnl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 121 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_nl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 122 ***************
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_bnl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 123 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) use_nl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 124 ***************
|
||||
select /*+ leading(opt.t1 opt.t2) use_bnl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
|
||||
************** Case 125 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_nl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
************** Case 126 ***************
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_bnl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
************** Case 127 ***************
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
|
||||
************** Case 128 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
|
||||
************** Case 129 ***************
|
||||
select/*+no_rewrite*/ t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
|
||||
************** Case 130 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+leading(t2)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
|
||||
************** Case 131 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+read_consistency(weak)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
|
||||
************** Case 132 ***************
|
||||
select t1.c1, v.c1 from t1, (select/*+use_nl(t2, t4)*/ t2.c1 from t2, t4 where t2.c1 = t4.c1) v;
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4 where t2.c1 = t4.c1) v;
|
||||
|
||||
************** Case 133 ***************
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select c1 from t2);
|
||||
(select c1 from t1) union (select c1 from t2);
|
||||
|
||||
************** Case 134 ***************
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select /*+read_consistency(strong)*/ c1 from t2);
|
||||
(select c1 from t1) union (select c1 from t2);
|
||||
|
||||
************** Case 135 ***************
|
||||
select * from opt.t1 ignore index (primary);
|
||||
select * from opt.t1 ignore index (primary);
|
||||
|
||||
************** Case 136 ***************
|
||||
select /*+ index(@a0123456789012345678 t4@a0123456789012345678 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a0123456789012345678)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
|
||||
************** Case 137 ***************
|
||||
select /*+ index(@a01234567890123456789 t4@a01234567890123456789 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a01234567890123456789)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
|
||||
************** Case 138 ***************
|
||||
select /*+ index(@SEL$1 t4 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(yz)*/ c1 from t4);
|
||||
select * from t1 where c1 in (select c1 from t4);
|
||||
|
||||
************** Case 139 ***************
|
||||
select /*+ leading(@SEL$1 t4 t1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 140 ***************
|
||||
select /*+ leading(@SEL$1 t1 t4)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 141 ***************
|
||||
select /*+ leading(@SEL$1 t1@SEL$1 t4@YZ)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 142 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 143 ***************
|
||||
select /*+ leading(@SEL$1 t_a@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 144 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 145 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_nl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 146 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_bnl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 147 ***************
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ * from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select * from t1 , (select c1 from t4) t where t.c1 = t1.c1;
|
||||
|
||||
************** Case 148 ***************
|
||||
select c1 from t1 union select /*+index(@SEL$1 t1 idx_t1_c2)*/ c1 from t2;
|
||||
select c1 from t1 union select c1 from t2;
|
||||
|
||||
************** Case 149 ***************
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select c1 from t2;
|
||||
|
||||
************** Case 150 ***************
|
||||
select/*+leading(@SEL$1 t2 t1)*/ t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select c1 from t2;
|
||||
|
||||
************** Case 151 ***************
|
||||
(select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ t1.c1 from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
(select t1.c1 from t1 , (select c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
|
||||
************** Case 152 ***************
|
||||
(select t1.c1 from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1) union select/*+leading(@SEL$1 t4@YZ t1@SEL$1) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t3;
|
||||
(select t1.c1 from t1 , (select c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
|
||||
************** Case 153 ***************
|
||||
select/*+index(@SEL$1 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
|
||||
************** Case 154 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
|
||||
************** Case 155 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c2 > 1 and t4.c2 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c2 > ? and t4.c2 < ? and t_a.c1 = t4.c1 group by t4.c2);
|
||||
|
||||
************** Case 156 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c3 > 1 and t4.c3 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c3 > ? and t4.c3 < ? and t_a.c1 = t4.c1 group by t4.c2);
|
||||
|
||||
************** Case 157 ***************
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) leading(@SEL$2 t5@SEL$3 t4@SEL$2)*/t1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t_a.c1 = t4.c1 group by t4.c2);
|
||||
selectt1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t_a.c1 = t4.c1 group by t4.c2);
|
||||
|
||||
************** Case 158 ***************
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
|
||||
************** Case 159 ***************
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_NL(@"SEL$3" "hint.t2"@"SEL$3") LEADING(@"SEL$3" "hint.t2"@"SEL$3" "hint.t1"@"SEL$3") END_OUTLINE_DATA */* from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
|
||||
************** Case 160 ***************
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
|
||||
************** Case 161 ***************
|
||||
select /*+ leading(@SEL$1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
|
||||
************** Case 162 ***************
|
||||
select /*+ leading(@SEL1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
|
||||
************** Case 163 ***************
|
||||
select /*+index(@SEL$3 t5@SEL$3 idx_t5_c2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t5.c1 from t5 group by t5.c2) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t5.c1 from t5 group by t5.c2) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
|
||||
************** Case 164 ***************
|
||||
select c2 from t_idx use index(t_c2);
|
||||
select c2 from t_idx use index(t_c2);
|
||||
|
||||
************** Case 165 ***************
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = ?;
|
||||
|
||||
************** Case 166 ***************
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = ?;
|
||||
|
||||
************** Case 167 ***************
|
||||
select /*+use_plan_cache(none)*/ * from hint.t1;
|
||||
select * from hint.t1;
|
||||
|
||||
************** Case 168 ***************
|
||||
select /*+use_plan_cache(meaningless)*/ * from hint.t1;
|
||||
select * from hint.t1;
|
||||
|
||||
************** Case 169 ***************
|
||||
select /*+ index(t1 primary) */ * from hint.t1 order by a desc;
|
||||
select * from hint.t1 order by a desc;
|
||||
|
||||
************** Case 170 ***************
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
|
||||
************** Case 171 ***************
|
||||
select /*+ INDEX(@SEL$3 opt.z1@SEL$2 z1_b)*/ min(a) from z1 za where za.a in (select a from z1);
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
|
||||
************** Case 172 ***************
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(a);
|
||||
select * from z1 ignore key(a);
|
||||
|
||||
************** Case 173 ***************
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(z1_b);
|
||||
select * from z1 ignore key(z1_b);
|
||||
|
||||
230
unittest/sql/parser/test_parser_outline.test
Normal file
230
unittest/sql/parser/test_parser_outline.test
Normal file
@ -0,0 +1,230 @@
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+trace_log no_rewrite*/ * from t1 where c1 = 1 limit 1 order by 1;
|
||||
|
||||
select * from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+sss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+trace_log no_rewrite ssss*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+ssss no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select */*+trace_log no_rewrite*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
select /*+trace_log no_rewrite*/* from t1 where c1 = 1 limit 1 order by 1;
|
||||
select * from (select /*+SSSSSS*/ * from t1) as tt where c1 = 1 limit 1 order by 1;
|
||||
select * from /*+sssssss*/ from t1 where c1 = 1 limit 1 order by 1;
|
||||
|
||||
update /*+sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update /*+no_rewrite sssss*/ t1 set c1 = 1 where c1 = 100;
|
||||
update /*+sssss*/ t1 set c1 = 1 where /*+sssss*/ c1 = 100;
|
||||
delete /*+sssss*/ from t1 where c=1;
|
||||
delete /*+no_rewrite sssss*/ from t1 where c=1;
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "t1"@"SEL$1") READ_CONSISTENCY("WEAK") HOTSPOT TOPK(1 100) QUERY_TIMEOUT(100) FROZEN_VERSION(1) USE_PLAN_CACHE("EXACT") ACTIVATE_BURIED_POINT(1, FIX_MODE, 1, 1) NO_REWRITE TRACE_LOG LOG_LEVEL('info') END_OUTLINE_DATA */* from t1;
|
||||
select /*+INDEX(@"SEL$2" "opt.t4"@"SEL$2" "idx_t4_c3")*/* from t1 where c1 in (select c1 from t4);
|
||||
select /*+ BEGIN_OUTLINE_DATA INDEX(@"SEL$1" "opt.t4"@"SEL$1" "idx_t4_c3") END_OUTLINE_DATA */ * from t4 where c1 = 1;
|
||||
select /*+ BEGIN_OUTLINE_DATA FULL(@"SEL$1" "opt.t4"@"SEL$1") END_OUTLINE_DATA */ * from t4 where c2 = 1;
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_MERGE(@"SEL$1" "opt.t2"@"SEL$1") LEADING(@"SEL$1" "opt.t1"@"SEL$1" "opt.t2"@"SEL$1") FULL(@"SEL$1" "opt.t1"@"SEL$1") FULL(@"SEL$1" "opt.t2"@"SEL$1") END_OUTLINE_DATA */* from t1,t2 where t1.c1=t2.c1;
|
||||
|
||||
select /*+log_level('info')*/* from t1;
|
||||
select /*+log_level('info')*/t1.c1,t2.c1 from t1,t2 group by t1.c1,t2.c1 having c1 =1;
|
||||
select /*+log_level('info')*/* from t1 for update;
|
||||
select * from /*+sssssss*/ from t1 where c1 in (select /*+fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
select * from /*sssssss*/ from t1 where c1 in (select /*fdsafasfa*/ c1 from t2) limit 1 order by 1;
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 ;
|
||||
update /*+sssssss*/t1 set c1 = 1 where c2 > any(select /*+index(t3 c1) trace_log*/c1 from t3 where c2 not in (select c1 from t4 order by c1 limit 2));
|
||||
update/*+index(t2 i2)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=2 where c1>0 and vt2.c2<2 order by vt2.c1 asc, vt2.c2 desc limit 2 offset 10;
|
||||
update/*+index(t2 i2),query_timeout(2000)*/ t2 vt2 set vt2.c1=2*vt2.c2,c1=c1+1,vt2.c2=10,c3=10 where c1>0 and vt2.c2<10 order by vt2.c1 asc,c2 desc limit 10,10
|
||||
UPDATE t1 SET c1=c1+(SELECT MAX(C1) FROM (SELECT 1) t) WHERE c1=(SELECT /*+index(t2 i2),query_timeout(2000)*/ MAX(c1));
|
||||
update t1 set c2 = 6 where c1 = (select /*+index(t2 i2),query_timeout(2000)*/max(c1) from t1);
|
||||
|
||||
insert /*+index(t2 i2)*/into ta select * from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
insert into t1 values (1,2),(3,4) on duplicate key update c1=values(c2)+values(c1), c2= values(c1)+values(c1);
|
||||
insert into t4 (c1,c2,c3) values(11, 2, default), (13,3, default) on duplicate key update c2 = 5, c3=4;
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert /*+index(t2 i2)*/into ta(c1,c2) values (3,NULL), (4, NULL);
|
||||
insert into ta select /*+index(t2 i2)*/* from t3 on duplicate key update c1 = c1 + 2, c2 = values(c2);
|
||||
|
||||
delete from t1 where c2 > 10 order by c1 limit 0, 1;
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 =1;
|
||||
delete /*+ INDEX(t1 idx1)*/ from t1 where c1 in (select /*trace_log*/c2 from t2);
|
||||
delete /*dfasdasf*/ from test where c1 = 1;
|
||||
select /*+no_rewrite*/* from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
select * from t1 where c1 = 4 and c2 = 6 order by 2;
|
||||
|
||||
## test for FP_NO_PARAMERIZE_AND_FILTER_HINT_MODE
|
||||
select * from t1 where c1 = 'aaaaa';
|
||||
select * from t1 where c1 = "aaaaa";
|
||||
select * from t1 where c1 = '''';
|
||||
select * from t1 where c1 = '"';
|
||||
select * from t1 where c1 = "''";
|
||||
select * from t1 where c1 = '\\';
|
||||
select * from t1 where c1 = "\t";
|
||||
select * from t1 where c1 = '\n';
|
||||
select * from t1 where c1 = "\n";
|
||||
select * from t1 where c1 = ' ';
|
||||
select * from t1 where c1 = " ";
|
||||
select * from t1 where c1 = `aaaaa`;
|
||||
select * from t1 where c1 = ````;
|
||||
|
||||
#cross database hint effective
|
||||
select /*+ leading(ta, tb) use_nl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
select /*+ leading(ta, tb) use_bnl(tb)*/ * from hint.t1 as tb, opt.t1 as ta where tb.a = ta.c1;
|
||||
#cross database hint ineffective, leading table duplicated
|
||||
select /*+ leading(t1) use_nl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
select /*+ leading(t1) use_bnl(hint.t1)*/ * from hint.t2, hint.t1, opt.t1 where hint.t2.a = opt.t1.c1;
|
||||
#cross database hint effective. table no duplicated
|
||||
select /*+ leading(t2, t1) use_merge(t1)*/ * from hint.t2, opt.t1 where t1.c1 = t2.a;
|
||||
#index int
|
||||
select /*+ index(hint.t1 idx_t1_a)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c1;
|
||||
#full hint
|
||||
select /*+ full(opt.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
#ordered hint
|
||||
select /*+ ordered use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select /*+ ordered use_bnl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
#as tb not exist after rewrite, leading hint ineffective
|
||||
select /*+ leading(tb, opt.t1) use_nl(hint.t2 opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
select /*+ leading(tb, opt.t1) use_bnl(hint.t2, opt.t1)*/ * from (select * from t2) as tb, hint.t2, opt.t1;
|
||||
|
||||
#index hint
|
||||
select * from opt.t1,opt.t2 use index (idx_t1_c2) where opt.t1.c1 = opt.t2.c2;
|
||||
select /*+ index(t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select /*+ index(opt.t1 idx_t1_c2)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(hint.t2, hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(test hint.t2) use_nl(hint.t1)*/ * from opt.t1, hint.t1 where hint.t1.a = opt.t1.c2;
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select /*+ index(ta idx_t1_c2) use_merge(test) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select /*+ index(opt.t1 idx_t1_c2) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
select /*+ index(opt.t1 idx_test) use_merge(opt.t2) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
#table tb both in use_merge, use_nl; when tb is right table both MERGE-JON and NL-JOIN path generated.
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_nl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
#table tb both in use_merge, use_bnl; when tb is right table both MERGE-JON and BNL-JOIN path generated.
|
||||
select /*+ index(opt.t1 idx_test) use_merge(ta tb) use_bnl(tb)*/ * from opt.t1 as ta, hint.t1 as tb where ta.c1 = tb.a;
|
||||
#use index more than one, only the first is effective
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_c2, idx_t1_a) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t1,hint.t1 use index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
#force index
|
||||
select * from opt.t1,hint.t1 force index (idx_t1_a, idx_t1_c2) where opt.t1.c1 = hint.t1.a;
|
||||
select * from opt.t4 force index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
#ignore index, all is effective
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3,idx_t4_c2_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4 ignore index (idx_t4_c2,idx_t4_c3) where opt.t4.c1 = opt.t4.c2;
|
||||
select * from opt.t4, hint.t1 ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where opt.t4.c1 = hint.t1.a;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_t4_c2,idx_t4_c3, idx_t1_a) where ta.c1 = tb.a;
|
||||
#index not exist, leading hint ineffective @TODO selectivity error
|
||||
select * from opt.t1 use index(idx_yeti, idx_t1_c2) where opt.t1.c1 = opt.t1.c1;
|
||||
select * from opt.t4 as ta, hint.t1 as tb ignore index (idx_test, idx_t1_a) where ta.c1 = tb.a;
|
||||
#subquery
|
||||
select * from opt.t1 use index(index_t1_c2) where opt.t1.c2 = (select hint.t1.a from hint.t1,opt.t2 use index(idx_t1_a) where opt.t2.c1 = hint.t1.b);
|
||||
select /*+ idex(yeti idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 where yeti.a = opt.t1.c2;
|
||||
select /*+ idex(ta idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
select /*+ idex(opt.t1 idx_t1_c2)*/ * from (select /*+ idex(opt.t4 idx_t4_c2))*/ * from hint.t1, opt.t4 where hint.t1.a = opt.t4.c2) as yeti, opt.t1 as ta where yeti.a = ta.c2;
|
||||
|
||||
#full hint
|
||||
select /*+ full(opt.t1)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select /*+ full(opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select /*+ full(opt.t1 hint.t2)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select /*+ full(opt.t1) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select /*+ full(opt.ta) use_merge(ta)*/ * from opt.t1 as ta , opt.t2 as tb where ta.c1 = tb.c1;
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select /*+ full(opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c2;
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_nl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
select /*+ full(opt.t1 hint.t2) use_merge(test), use_bnl(opt.t1)*/ * from opt.t1, hint.t2 where opt.t1.c1 = hint.t2.b;
|
||||
|
||||
#ordered hint
|
||||
select /*+ ordered use_merge(ta,tb,tc,td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select /*+ ordered use_nl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select /*+ ordered use_bnl(ta tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
#select /*+ ordered use_hash(ta,tb tc td)*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
select /*+ ordered*/ * from opt.t1 as ta, opt.t2 as tb , hint.t1 as tc, hint.t2 as td where ta.c1 = tc.a and ta.c2 = tb.c1 and tb.c1 = td.b;
|
||||
|
||||
#leading hint
|
||||
select /*+ leading(test, opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_nl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_merge(opt.t1), use_bnl(opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t2) */ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) */ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_nl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_merge(opt.t1 ha) use_bnl(opt.t1 hb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1 opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_nl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(test, opt.t1 opt.t2) use_merge(test opt.t1) use_bnl(test opt.t2)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
# duplicate table name, leading hint ineffective
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_nl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t1 opt.t2) use_bnl(opt.t1 opt.t3 opt.t5)*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
# use_nl():hint syntax error , failed when parser
|
||||
select /*+ leading(opt.t1 opt.t2) use_nl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t2) use_bnl()*/ * from opt.t1, opt.t2 where opt.t1.c1 = opt.t2.c1;
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_nl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
select /*+ leading(opt.t1 opt.t2 ha hb) use_bnl(ta hint.t1 hint.t2 tb)*/ * from opt.t1, opt.t2, hint.t1 as ha, hint.t2 as hb where opt.t1.c1 = opt.t2.c1 and opt.t1.c1 = ha.a and opt.t2.c2 = hb.b;
|
||||
|
||||
#hint with sub-query
|
||||
select t1.c1, v.c1 from t1, (select t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
#no rewrite should not influence whether check_and_convert_hint bug:8378105
|
||||
select/*+no_rewrite*/ t1.c1, v.c1 from t1, (select/*+index(t4 primary)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select/*+leading(t2)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select/*+read_consistency(weak)*/ t2.c1 from t2, t4) v;
|
||||
select t1.c1, v.c1 from t1, (select/*+use_nl(t2, t4)*/ t2.c1 from t2, t4 where t2.c1 = t4.c1) v;
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select c1 from t2);
|
||||
(select /*+read_consistency(weak)*/ c1 from t1) union (select /*+read_consistency(strong)*/ c1 from t2);
|
||||
|
||||
select * from opt.t1 ignore index (primary);
|
||||
#hint with query-block, for outline generated
|
||||
#hint qb_name/index
|
||||
select /*+ index(@a0123456789012345678 t4@a0123456789012345678 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a0123456789012345678)*/ c1 from t4);
|
||||
#hint qb_name length larger than MAX_QB_NAME_LENGTH
|
||||
select /*+ index(@a01234567890123456789 t4@a01234567890123456789 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(a01234567890123456789)*/ c1 from t4);
|
||||
select /*+ index(@SEL$1 t4 idx_t4_c3)*/ * from t1 where c1 in (select/*+qb_name(yz)*/ c1 from t4);
|
||||
#hint qb_name/leading
|
||||
select /*+ leading(@SEL$1 t4 t1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select /*+ leading(@SEL$1 t1 t4)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select /*+ leading(@SEL$1 t1@SEL$1 t4@YZ)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
#hint qb_name/leading/alias name table_name in hint should be alias name
|
||||
select /*+ leading(@SEL$1 t_a@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4 t_a) t where t.c1 = t1.c1;
|
||||
#hint qb_name/leading/use_nl
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_nl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
#hint qb_name/leading/use_bnl
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) use_bnl(@SEL$1 t1@SEL$1)*/ * from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
#hint qb_name/leading/use_merge
|
||||
select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ * from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1;
|
||||
#hint with set op
|
||||
select c1 from t1 union select /*+index(@SEL$1 t1 idx_t1_c2)*/ c1 from t2;
|
||||
select t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
|
||||
select/*+leading(@SEL$1 t2 t1)*/ t1.c1 from t1, t2 where t1.c1 = t2.c1 union select/*+leading(@SEL$1 t1 t2) use_merge(@SEL1 t2@SEL$1)*/ c1 from t2;
|
||||
(select /*+ leading(@SEL$1 t4@YZ t1@SEL$1) */ t1.c1 from t1 , (select/*+qb_name(yz) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t4) t where t.c1 = t1.c1) union select c1 from t3;
|
||||
(select t1.c1 from t1 , (select/*+qb_name(yz)*/ c1 from t4) t where t.c1 = t1.c1) union select/*+leading(@SEL$1 t4@YZ t1@SEL$1) use_merge(@SEL$1 t1@SEL$1)*/ c1 from t3;
|
||||
#hint subquery in subquery with no rewrite
|
||||
#no rewrite, can not find t4 in SEL$1
|
||||
select/*+index(@SEL$1 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select t4.c1 from t4 group by t4.c2);
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c2 > 1 and t4.c2 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) */t1.c1 from t1 where t1.c1 in (select/*+index(t4 idx_t4_c3)*/ t4.c1 from t4, (select t5.c1 from t5) t_a where t4.c3 > 1 and t4.c3 < 3 and t_a.c1 = t4.c1 group by t4.c2);
|
||||
select/*+index(@SEL$2 t4 idx_t4_c2) leading(@SEL$2 t5@SEL$3 t4@SEL$2)*/t1.c1 from t1 where t1.c1 in (select t4.c1 from t4, (select t5.c1 from t5) t_a where t_a.c1 = t4.c1 group by t4.c2);
|
||||
select * from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
select /*+ BEGIN_OUTLINE_DATA USE_NL(@"SEL$3" "hint.t2"@"SEL$3") LEADING(@"SEL$3" "hint.t2"@"SEL$3" "hint.t1"@"SEL$3") END_OUTLINE_DATA */* from hint.t1 where a in (select * from (select max(t1.a) from hint.t1, hint.t2) as tt);
|
||||
#subquery in subquery
|
||||
select t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select /*+ leading(@SEL$1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
#wrong qb name SEL1 should be SEL$1
|
||||
select /*+ leading(@SEL1 t1 t4 t3 t2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t3.c1 from t3) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
select /*+index(@SEL$3 t5@SEL$3 idx_t5_c2) index(@SEL$4 t4 idx_t4_c3)*/ t1.c1 from t1, (select t2.c1 from t2, (select t5.c1 from t5 group by t5.c2) t_a where t_a.c1 = t2.c1) t_a1 where t_a1.c1 = t1.c1 and t1.c1 in (select t4.c1 from t4);
|
||||
#test index hint
|
||||
select c2 from t_idx use index(t_c2);
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
select c120 from t_idx use index (idx_t_idx_c2, idx_t_idx_c2, idx_t_idx_c3, idx_t_idx_c4, idx_t_idx_c5, idx_t_idx_c6, idx_t_idx_c7, idx_t_idx_c8, idx_t_idx_c9, idx_t_idx_c10, idx_t_idx_c11, idx_t_idx_c12, idx_t_idx_c13, idx_t_idx_c14, idx_t_idx_c15, idx_t_idx_c16, idx_t_idx_c17, idx_t_idx_c18, idx_t_idx_c19, idx_t_idx_c20, idx_t_idx_c21, idx_t_idx_c22, idx_t_idx_c23, idx_t_idx_c24, idx_t_idx_c25, idx_t_idx_c26, idx_t_idx_c27, idx_t_idx_c28, idx_t_idx_c29, idx_t_idx_c30, idx_t_idx_c31, idx_t_idx_c32, idx_t_idx_c33, idx_t_idx_c34, idx_t_idx_c35, idx_t_idx_c36, idx_t_idx_c37, idx_t_idx_c38, idx_t_idx_c39, idx_t_idx_c40, idx_t_idx_c41, idx_t_idx_c42, idx_t_idx_c43, idx_t_idx_c44, idx_t_idx_c45, idx_t_idx_c46, idx_t_idx_c47, idx_t_idx_c48, idx_t_idx_c49, idx_t_idx_c50, idx_t_idx_c51, idx_t_idx_c52, idx_t_idx_c53, idx_t_idx_c54, idx_t_idx_c55, idx_t_idx_c56, idx_t_idx_c57, idx_t_idx_c58, idx_t_idx_c59, idx_t_idx_c60, idx_t_idx_c61, idx_t_idx_c62, idx_t_idx_c63, idx_t_idx_c64, idx_t_idx_c65, idx_t_idx_c66, idx_t_idx_c67, idx_t_idx_c68, idx_t_idx_c69, idx_t_idx_c70, idx_t_idx_c71, idx_t_idx_c72, idx_t_idx_c73, idx_t_idx_c74, idx_t_idx_c75, idx_t_idx_c76, idx_t_idx_c77, idx_t_idx_c78, idx_t_idx_c79, idx_t_idx_c80, idx_t_idx_c81, idx_t_idx_c82, idx_t_idx_c83, idx_t_idx_c84, idx_t_idx_c85, idx_t_idx_c86, idx_t_idx_c87, idx_t_idx_c88, idx_t_idx_c89, idx_t_idx_c90, idx_t_idx_c91, idx_t_idx_c92, idx_t_idx_c93, idx_t_idx_c94, idx_t_idx_c95, idx_t_idx_c96, idx_t_idx_c97, idx_t_idx_c98, idx_t_idx_c99, idx_t_idx_c100, idx_t_idx_c101, idx_t_idx_c102, idx_t_idx_c103, idx_t_idx_c104, idx_t_idx_c105, idx_t_idx_c106, idx_t_idx_c107, idx_t_idx_c108, idx_t_idx_c109, idx_t_idx_c110, idx_t_idx_c111, idx_t_idx_c112, idx_t_idx_c113, idx_t_idx_c114, idx_t_idx_c115, idx_t_idx_c116, idx_t_idx_c117, idx_t_idx_c118, idx_t_idx_c119, idx_t_idx_c120, idx_t_idx_c121, idx_t_idx_c122, idx_t_idx_c123, idx_t_idx_c124, idx_t_idx_c125, idx_t_idx_c126, idx_t_idx_c127, idx_t_idx_c128, idx_t_idx_c129) where c120 = 1;
|
||||
|
||||
#use_plan_cache hint not used now,but should not produce error
|
||||
select /*+use_plan_cache(none)*/ * from hint.t1;
|
||||
select /*+use_plan_cache(meaningless)*/ * from hint.t1;
|
||||
select /*+ index(t1 primary) */ * from hint.t1 order by a desc;
|
||||
#bug 8477262
|
||||
select min(a) from z1 za where za.a in (select a from z1);
|
||||
select /*+ INDEX(@SEL$3 opt.z1@SEL$2 z1_b)*/ min(a) from z1 za where za.a in (select a from z1);
|
||||
#bug 8408303(ignore key influence index hint);
|
||||
#repair: /*+index(t i)*/ hint will ignore IGNORE HINT
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(a);
|
||||
select /*+index(z1 z1_b)*/ * from z1 ignore key(z1_b);
|
||||
177
unittest/sql/parser/test_parser_perf.cpp
Normal file
177
unittest/sql/parser/test_parser_perf.cpp
Normal file
@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "sql/parser/ob_parser.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "lib/allocator/page_arena.h"
|
||||
#include "lib/time/tbtimeutil.h"
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using namespace oceanbase;
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::sql;
|
||||
namespace test {
|
||||
static char* parse_file = NULL;
|
||||
static int LOOP_COUNT = 1;
|
||||
static bool PRINT_STAT = false;
|
||||
static bool IS_FP = false;
|
||||
|
||||
class TestParserPerf {
|
||||
public:
|
||||
TestParserPerf();
|
||||
virtual ~TestParserPerf();
|
||||
void do_parse(const char* query_str);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(TestParserPerf);
|
||||
|
||||
public:
|
||||
ObArenaAllocator allocator_;
|
||||
int64_t total_t_;
|
||||
int64_t total_cnt_;
|
||||
int64_t succ_cnt_;
|
||||
};
|
||||
|
||||
TestParserPerf::TestParserPerf() : allocator_(ObModIds::TEST), total_t_(0), total_cnt_(0), succ_cnt_(0)
|
||||
{}
|
||||
|
||||
TestParserPerf::~TestParserPerf()
|
||||
{}
|
||||
|
||||
void TestParserPerf::do_parse(const char* query_str)
|
||||
{
|
||||
int64_t t0 = 0, t1 = 0;
|
||||
ObSQLMode mode = SMO_DEFAULT;
|
||||
ObParser parser(allocator_, mode);
|
||||
ParseResult parse_result;
|
||||
ParseMode pmode = IS_FP ? FP_MODE : STD_MODE;
|
||||
parse_result.is_fp_ = IS_FP;
|
||||
ObString query = ObString::make_string(query_str);
|
||||
int ret = OB_SUCCESS;
|
||||
t0 = obsys::CTimeUtil::getTime();
|
||||
ret = parser.parse(query, parse_result, pmode);
|
||||
t1 = obsys::CTimeUtil::getTime();
|
||||
if (OB_SUCC(ret)) {
|
||||
succ_cnt_++;
|
||||
}
|
||||
total_t_ += t1 - t0;
|
||||
total_cnt_++;
|
||||
|
||||
if (PRINT_STAT) {
|
||||
printf("==%s\n", query_str);
|
||||
printf("==%s\n", parse_result.no_param_sql_);
|
||||
printf("time:%ld, len:%d, ", t1 - t0, parse_result.no_param_sql_len_);
|
||||
printf("param_node_num:%d\n", parse_result.param_node_num_);
|
||||
ParamList* param = parse_result.param_nodes_;
|
||||
for (int32_t i = 0; OB_SUCC(ret) && i < parse_result.param_node_num_ && NULL != param; i++) {
|
||||
printf(" param_%d: type:%d; value:%ld, str_value:%s, raw_text:%s, pos_:%ld\n",
|
||||
i,
|
||||
param->node_->type_,
|
||||
param->node_->value_,
|
||||
param->node_->str_value_,
|
||||
param->node_->raw_text_,
|
||||
param->node_->pos_);
|
||||
param = param->next_;
|
||||
}
|
||||
}
|
||||
parser.free_result(parse_result);
|
||||
allocator_.reset();
|
||||
}
|
||||
|
||||
int load_sql(const char* test_file, std::vector<std::string>& sql_array)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
std::ifstream if_tests(test_file);
|
||||
if (!if_tests.is_open()) {
|
||||
SQL_PC_LOG(ERROR, "maybe reach max file open");
|
||||
ret = OB_ERROR;
|
||||
}
|
||||
std::string line;
|
||||
std::string total_line;
|
||||
;
|
||||
while (std::getline(if_tests, line)) {
|
||||
// allow human readable formatting
|
||||
if (line.size() <= 0)
|
||||
continue;
|
||||
std::size_t begin = line.find_first_not_of('\t');
|
||||
if (line.at(begin) == '#')
|
||||
continue;
|
||||
std::size_t end = line.find_last_not_of('\t');
|
||||
std::string exact_line = line.substr(begin, end - begin + 1);
|
||||
total_line += exact_line;
|
||||
total_line += " ";
|
||||
if (exact_line.at(exact_line.length() - 1) != ';')
|
||||
continue;
|
||||
else {
|
||||
sql_array.push_back(total_line);
|
||||
total_line = "";
|
||||
}
|
||||
}
|
||||
if_tests.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
std::vector<std::string> test_sql_array;
|
||||
load_sql("./test_parser.sql", test_sql_array);
|
||||
TestParserPerf pp;
|
||||
for (int i = 0; i < LOOP_COUNT; i++) {
|
||||
for (int j = 0; j < (int)test_sql_array.size(); j++) {
|
||||
pp.do_parse(test_sql_array.at(j).c_str());
|
||||
}
|
||||
}
|
||||
std::cout << "===="
|
||||
<< "succ_cnt:" << pp.succ_cnt_ << std::endl;
|
||||
std::cout << "===="
|
||||
<< "total_cnt:" << pp.total_cnt_ << std::endl;
|
||||
std::cout << "===="
|
||||
<< "avg_time:" << (double)(pp.total_t_) / (double)(pp.total_cnt_) << std::endl;
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
OB_LOGGER.set_log_level("ERROR");
|
||||
OB_LOGGER.set_file_name("test_parser.log", true);
|
||||
int c = 0;
|
||||
while (-1 != (c = getopt(argc, argv, "q:pfl:n:"))) {
|
||||
switch (c) {
|
||||
case 'q':
|
||||
test::parse_file = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
test::LOOP_COUNT = atoi(optarg);
|
||||
break;
|
||||
case 'f':
|
||||
test::IS_FP = true;
|
||||
break;
|
||||
case 'l':
|
||||
if (NULL != optarg) {
|
||||
OB_LOGGER.set_log_level(optarg);
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
test::PRINT_STAT = true;
|
||||
break;
|
||||
default:
|
||||
printf("usage:");
|
||||
break;
|
||||
}
|
||||
}
|
||||
::test::run();
|
||||
return 0;
|
||||
}
|
||||
69
unittest/sql/parser/test_pre_parse.result
Normal file
69
unittest/sql/parser/test_pre_parse.result
Normal file
@ -0,0 +1,69 @@
|
||||
************** Case 1 ***************
|
||||
/* trace_id=ABC */rpc_id=xxx
|
||||
trace_id: ABC
|
||||
************** Case 2 ***************
|
||||
|
||||
/*
|
||||
trace_id=ABC
|
||||
rpc_id=xxx*/
|
||||
trace_id: ABC
|
||||
************** Case 3 ***************
|
||||
/*trace_id=ABCrpc_id=xxx*/
|
||||
trace_id: ABC
|
||||
************** Case 4 ***************
|
||||
|
||||
/*
|
||||
trace_id=ABC
|
||||
rpc_id=xxx*/
|
||||
trace_id: ABC
|
||||
************** Case 5 ***************
|
||||
/*trace_id=xxx*/select * from t1;
|
||||
trace_id: xxx
|
||||
************** Case 6 ***************
|
||||
/*TrAcE_Id=xxx read*/ select * from t1;
|
||||
trace_id: xxx
|
||||
************** Case 7 ***************
|
||||
/*+tRaCe_iD=abcd12 * read*/ select * from t1;
|
||||
trace_id: abcd12
|
||||
************** Case 8 ***************
|
||||
/* trace_id=a12db rpc_id=xxxxx */ select * from t1;
|
||||
trace_id: a12db
|
||||
************** Case 9 ***************
|
||||
/*trace_id=xxx,rpc_id=xxx*/select * from t1;
|
||||
trace_id: xxx
|
||||
************** Case 10 ***************
|
||||
/*rpc_id=xxx, TrAcE_Id=xxx, read*/ select * from t1;
|
||||
trace_id: xxx
|
||||
************** Case 11 ***************
|
||||
/*+tRaCe_iD=abcd12* read*/ select * from t1;
|
||||
trace_id: abcd12
|
||||
************** Case 12 ***************
|
||||
/* trace_id=a12db, rpc_id=xxxxx */ select * from t1;
|
||||
trace_id: a12db
|
||||
************** Case 13 ***************
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc888888889999999 rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc88888888
|
||||
************** Case 14 ***************
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc88888888 rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc88888888
|
||||
************** Case 15 ***************
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc8888888 rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc8888888
|
||||
************** Case 16 ***************
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc888888889 rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc88888888
|
||||
************** Case 17 ***************
|
||||
/*trace_id=1 rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 1
|
||||
************** Case 18 ***************
|
||||
/*trace_id=12QA rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 12QA
|
||||
************** Case 19 ***************
|
||||
/*trace_id=12QA rpc_id=xxx*/ select * from t1;
|
||||
trace_id: 12QA
|
||||
************** Case 20 ***************
|
||||
select /*trace_id=xx*/ * from t1;
|
||||
trace_id:
|
||||
************** Case 21 ***************
|
||||
/*trace_id= abc read*/ select * from t1;
|
||||
trace_id:
|
||||
21
unittest/sql/parser/test_pre_parse.test
Normal file
21
unittest/sql/parser/test_pre_parse.test
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
/*trace_id=xxx*/select * from t1;
|
||||
/*TrAcE_Id=xxx read*/ select * from t1;
|
||||
/*+tRaCe_iD=abcd12 * read*/ select * from t1;
|
||||
/* trace_id=a12db rpc_id=xxxxx */ select * from t1;
|
||||
/*trace_id=xxx,rpc_id=xxx*/select * from t1;
|
||||
/*rpc_id=xxx, TrAcE_Id=xxx, read*/ select * from t1;
|
||||
/*+tRaCe_iD=abcd12* read*/ select * from t1;
|
||||
/* trace_id=a12db, rpc_id=xxxxx */ select * from t1;
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc888888889999999 rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc88888888 rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc8888888 rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=1111111122222222aaaaaaaabbbbbbbb5555555566666666cccccccc888888889 rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=1 rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=12QA rpc_id=xxx*/ select * from t1;
|
||||
/*trace_id=12QA rpc_id=xxx*/ select * from t1;
|
||||
|
||||
select /*trace_id=xx*/ * from t1;
|
||||
/*trace_id= abc read*/ select * from t1;
|
||||
/*trace_id= abc select * from t1;
|
||||
|
||||
356
unittest/sql/parser/test_sql_fast_parser.cpp
Normal file
356
unittest/sql/parser/test_sql_fast_parser.cpp
Normal file
@ -0,0 +1,356 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define UNUSED(param) (void)param
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "sql/parser/ob_sql_parser.h"
|
||||
#include "sql/parser/parse_malloc.h"
|
||||
#include "sql/parser/parser_proxy_func.h"
|
||||
|
||||
extern "C" {
|
||||
extern void right_to_die_or_duty_to_live_c()
|
||||
{
|
||||
while (1) {
|
||||
sleep(120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using namespace oceanbase::common;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
// must implement following four functions.
|
||||
void* parser_alloc_buffer(void* malloc_pool, const int64_t buff_size)
|
||||
{
|
||||
UNUSED(malloc_pool);
|
||||
return std::malloc(buff_size);
|
||||
}
|
||||
|
||||
void parser_free_buffer(void* malloc_pool, void* buffer)
|
||||
{
|
||||
UNUSED(malloc_pool);
|
||||
std::free(buffer);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int check_stack_overflow_in_c(int* check_overflow)
|
||||
{
|
||||
*check_overflow = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool check_stack_overflow_c()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace oceanbase::sql;
|
||||
using namespace oceanbase::common;
|
||||
|
||||
void is_equal_content(const char* tmp_file, const char* result_file, bool is_record = false)
|
||||
{
|
||||
std::ifstream if_test(tmp_file);
|
||||
if_test.is_open();
|
||||
EXPECT_EQ(true, if_test.is_open());
|
||||
std::istream_iterator<std::string> it_test(if_test);
|
||||
std::ifstream if_expected(result_file);
|
||||
if_expected.is_open();
|
||||
EXPECT_EQ(true, if_expected.is_open());
|
||||
std::istream_iterator<std::string> it_expected(if_expected);
|
||||
bool is_equal = std::equal(it_test, std::istream_iterator<std::string>(), it_expected);
|
||||
if (is_equal) {
|
||||
std::remove(tmp_file);
|
||||
} else if (is_record) {
|
||||
fprintf(stdout, "The result files mismatched, you can choose to\n");
|
||||
fprintf(stdout, "emacs -q %s %s\n", result_file, tmp_file);
|
||||
fprintf(stdout, "diff -u %s %s\n", result_file, tmp_file);
|
||||
fprintf(stdout, "mv %s %s\n", tmp_file, result_file);
|
||||
std::rename(tmp_file, result_file);
|
||||
} else {
|
||||
fprintf(stdout, "The result files mismatched, you can choose to\n");
|
||||
fprintf(stdout, "diff -u %s %s\n", tmp_file, result_file);
|
||||
}
|
||||
EXPECT_EQ(true, is_equal);
|
||||
}
|
||||
|
||||
void print_result_tree(ParseNode* root, const int level, std::ostream& of)
|
||||
{
|
||||
for (int i = 0; i < level * 2; i++) {
|
||||
of << "-";
|
||||
}
|
||||
of << get_type_name(root->type_);
|
||||
if (NULL == root->str_value_) {
|
||||
of << " (null)";
|
||||
} else {
|
||||
of << " (" << root->str_value_ << ")";
|
||||
}
|
||||
of << " off: " << root->token_off_;
|
||||
of << " len: " << root->token_len_ << endl;
|
||||
for (int i = 0; i < root->num_child_; i++) {
|
||||
if (NULL == root->children_[i]) {
|
||||
// do nothing
|
||||
} else {
|
||||
print_result_tree(root->children_[i], level + 1, of);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_comment_list(ParseResult* p, std::ostream& of)
|
||||
{
|
||||
for (int i = 0; i < p->comment_cnt_; ++i) {
|
||||
of << "i: " << i;
|
||||
of << ", off: " << p->comment_list_[i].token_off_;
|
||||
of << ", len: " << p->comment_list_[i].token_len_;
|
||||
of << endl;
|
||||
}
|
||||
}
|
||||
|
||||
class TestFastSqlParser : public ::testing::Test {
|
||||
virtual void SetUp()
|
||||
{}
|
||||
virtual void TearDown()
|
||||
{}
|
||||
};
|
||||
|
||||
void test_fast_parser()
|
||||
{
|
||||
ParseResult parse_result;
|
||||
int tmp_ptr = 1;
|
||||
memset(&parse_result, 0, sizeof(parse_result));
|
||||
parse_result.is_fp_ = true;
|
||||
parse_result.is_multi_query_ = false;
|
||||
// for parser_malloc's inner check. Normally, malloc_pool cannot be empty.
|
||||
parse_result.malloc_pool_ = &tmp_ptr;
|
||||
parse_result.is_ignore_hint_ = false;
|
||||
parse_result.need_parameterize_ = true;
|
||||
parse_result.pl_parse_info_.is_pl_parse_ = false;
|
||||
parse_result.minus_ctx_.has_minus_ = false;
|
||||
parse_result.minus_ctx_.pos_ = -1;
|
||||
parse_result.minus_ctx_.raw_sql_offset_ = -1;
|
||||
parse_result.is_for_trigger_ = false;
|
||||
parse_result.is_dynamic_sql_ = false;
|
||||
parse_result.is_batched_multi_enabled_split_ = false;
|
||||
|
||||
char input_sql[1024];
|
||||
|
||||
const int64_t test_sql_cnt = 10;
|
||||
const char* test_sqls[test_sql_cnt] = {"select 1",
|
||||
"select 2.2345;",
|
||||
"select a from t where a = 'hello' and b = 3;",
|
||||
"select a from t where a = 1 and b = 'hello';",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select t2.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select * from t;",
|
||||
"select * from t;",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3.1231232) and c = "
|
||||
"'hello';"};
|
||||
const char* expected_sql_ids[test_sql_cnt] = {
|
||||
"1FE1379FE2A31B8D16219655761820A2",
|
||||
"99B8023929C1482A458CB071ADE822AC",
|
||||
"ADFDC18C98D0A001EF337A9EAB18CAD8",
|
||||
"ADFDC18C98D0A001EF337A9EAB18CAD8",
|
||||
"27B601C30CABBDF94C0117EF53236D45",
|
||||
"6C3F77365F581EC95803ED167CD82046",
|
||||
"99C43C457B0C8E5AA6666E89C80DC5CE",
|
||||
"0FD2573F48AA6C8DF7C3C71028CAFC81",
|
||||
"27B601C30CABBDF94C0117EF53236D45",
|
||||
"27B601C30CABBDF94C0117EF53236D45",
|
||||
};
|
||||
for (int i = 0; i < test_sql_cnt; i++) {
|
||||
const char* input_sql = test_sqls[i];
|
||||
|
||||
int64_t new_length = std::strlen(input_sql) + 1;
|
||||
char* buf = (char*)parse_malloc(new_length, parse_result.malloc_pool_);
|
||||
|
||||
parse_result.param_nodes_ = NULL;
|
||||
parse_result.tail_param_node_ = NULL;
|
||||
parse_result.no_param_sql_ = buf;
|
||||
parse_result.no_param_sql_buf_len_ = new_length;
|
||||
|
||||
const int64_t SQL_ID_LENGTH = 32;
|
||||
ObSQLParser sql_parser(*(ObIAllocator*)(parse_result.malloc_pool_), FP_MODE);
|
||||
char sql_id[SQL_ID_LENGTH + 1];
|
||||
int ret = sql_parser.parse_and_gen_sqlid(&tmp_ptr, input_sql, std::strlen(input_sql), sizeof(sql_id), sql_id);
|
||||
sql_id[SQL_ID_LENGTH] = '\0';
|
||||
ASSERT_EQ(0, std::strncmp(sql_id, expected_sql_ids[i], strlen(expected_sql_ids[i])));
|
||||
}
|
||||
}
|
||||
|
||||
void test_sql_parser()
|
||||
{
|
||||
ParseResult parse_result;
|
||||
int tmp_ptr = 1;
|
||||
memset(&parse_result, 0, sizeof(parse_result));
|
||||
parse_result.sql_mode_ = DEFAULT_MYSQL_MODE;
|
||||
parse_result.is_fp_ = false;
|
||||
parse_result.is_multi_query_ = false;
|
||||
// for parser_malloc's inner check. Normally, malloc_pool cannot be empty.
|
||||
parse_result.malloc_pool_ = &tmp_ptr;
|
||||
parse_result.is_ignore_hint_ = false;
|
||||
parse_result.need_parameterize_ = true;
|
||||
parse_result.pl_parse_info_.is_pl_parse_ = false;
|
||||
parse_result.minus_ctx_.has_minus_ = false;
|
||||
parse_result.minus_ctx_.pos_ = -1;
|
||||
parse_result.minus_ctx_.raw_sql_offset_ = -1;
|
||||
parse_result.is_for_trigger_ = false;
|
||||
parse_result.is_dynamic_sql_ = false;
|
||||
parse_result.is_batched_multi_enabled_split_ = false;
|
||||
|
||||
const int64_t test_sql_cnt = 10;
|
||||
const char* test_sqls[test_sql_cnt] = {"select 1",
|
||||
"select 2.2345;",
|
||||
"select a from t where a = 'hello' and b = 3;",
|
||||
"select a from t where a = 1 and b = 'hello';",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select t2.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select * from t;",
|
||||
"select * from t;",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3) and c = 'hello';",
|
||||
"select t1.a from t1 join t2 where b = udf_func(3.1231232) and c = "
|
||||
"'hello';"};
|
||||
|
||||
for (int i = 0; i < test_sql_cnt; i++) {
|
||||
const char* input_sql = test_sqls[i];
|
||||
|
||||
int64_t new_length = std::strlen(input_sql) + 1;
|
||||
char* buf = (char*)parse_malloc(new_length, parse_result.malloc_pool_);
|
||||
|
||||
parse_result.param_nodes_ = NULL;
|
||||
parse_result.tail_param_node_ = NULL;
|
||||
parse_result.no_param_sql_ = buf;
|
||||
parse_result.no_param_sql_buf_len_ = new_length;
|
||||
|
||||
ObSQLParser sql_parser(*(ObIAllocator*)(parse_result.malloc_pool_), parse_result.sql_mode_);
|
||||
int ret = sql_parser.parse(input_sql, std::strlen(input_sql), parse_result);
|
||||
ASSERT_TRUE(NULL != parse_result.result_tree_);
|
||||
}
|
||||
}
|
||||
|
||||
void setup_parse_result(ParseResult& parse_result, int& tmp_ptr)
|
||||
{
|
||||
memset(&parse_result, 0, sizeof(parse_result));
|
||||
parse_result.sql_mode_ = DEFAULT_MYSQL_MODE;
|
||||
parse_result.is_fp_ = false;
|
||||
parse_result.is_multi_query_ = false;
|
||||
// for parser_malloc's inner check. Normally, malloc_pool cannot be empty.
|
||||
parse_result.malloc_pool_ = &tmp_ptr;
|
||||
parse_result.is_ignore_hint_ = false;
|
||||
parse_result.need_parameterize_ = true;
|
||||
parse_result.pl_parse_info_.is_pl_parse_ = false;
|
||||
parse_result.minus_ctx_.has_minus_ = false;
|
||||
parse_result.minus_ctx_.pos_ = -1;
|
||||
parse_result.minus_ctx_.raw_sql_offset_ = -1;
|
||||
parse_result.is_for_trigger_ = false;
|
||||
parse_result.is_dynamic_sql_ = false;
|
||||
parse_result.is_batched_multi_enabled_split_ = false;
|
||||
|
||||
parse_result.realloc_cnt_ = 10;
|
||||
}
|
||||
|
||||
void start_test_token_offset(const char* test_sqls[], int test_sql_cnt, uint64_t sql_mode, std::ostream& of)
|
||||
{
|
||||
for (int64_t i = 0; i < test_sql_cnt; ++i) {
|
||||
ParseResult parse_result;
|
||||
int tmp_ptr = 1;
|
||||
setup_parse_result(parse_result, tmp_ptr);
|
||||
parse_result.sql_mode_ = sql_mode;
|
||||
const char* input_sql = test_sqls[i];
|
||||
|
||||
ObSQLParser sql_parser(*(ObIAllocator*)(parse_result.malloc_pool_), parse_result.sql_mode_);
|
||||
int ret = sql_parser.parse(input_sql, std::strlen(input_sql), parse_result);
|
||||
|
||||
of << input_sql << endl;
|
||||
ASSERT_TRUE(NULL != parse_result.result_tree_);
|
||||
print_result_tree(parse_result.result_tree_, 0, of);
|
||||
print_comment_list(&parse_result, of);
|
||||
}
|
||||
}
|
||||
|
||||
void test_token_pos()
|
||||
{
|
||||
const char* test_sqls_mysql[] = {
|
||||
// test hint and comment
|
||||
"/*+ c1 */ /* c2 */ select /* ignored */ /*+ no_rewrite, index(t1 primary) */ /* ignored */ c1 from t1;",
|
||||
// test sys fun / add minus... / order by
|
||||
"select * from t1 where c1 = c2+1*2/3-4 order by c1 + 2 limit 1;",
|
||||
"select * from t1 where c1 = c2+1*2/3-4 order by c1 + 2 limit 1 offset 1;",
|
||||
"select /*+ index(t1.c1 primary) */* from t1 where `name` = 'abc';",
|
||||
"select /*+ index(t1.name primary) */* from t1 where `c1` = 'abc';",
|
||||
};
|
||||
|
||||
const char* test_sqls_oracle[] = {
|
||||
// test hint and comment
|
||||
"/*+ c1 */ /* c2 */ select /* ignored */ /*+ no_rewrite, index(t1 primary) */ /* ignored */ c1 from t1;",
|
||||
// test sys fun / add minus... / order by
|
||||
"select * from t1 where c1 = c2+1*2/3-4 and rownum < 1 order by c1 + 2;",
|
||||
"select * from t1 where c1 = c2+1*2/3-4 and rownum < 1+1 order by c1 + 2;",
|
||||
"select /*+ index(t1.c1 primary) */* from t1 where \"name\" = 'abc';",
|
||||
"select /*+ index(t1.name primary) */* from t1 where \"c1\" = 'abc';",
|
||||
};
|
||||
|
||||
const char* res_file = "./test_sql_fast_parser.result";
|
||||
const char* tmp_file = "./test_sql_fast_parser.tmp";
|
||||
bool generate_res_file = false;
|
||||
if (generate_res_file) {
|
||||
std::ofstream res_of(res_file);
|
||||
std::ofstream tmp_of(tmp_file);
|
||||
ASSERT_TRUE(res_of.is_open());
|
||||
ASSERT_TRUE(tmp_of.is_open());
|
||||
|
||||
tmp_of << "MySQL mode: \n";
|
||||
start_test_token_offset(test_sqls_mysql, sizeof(test_sqls_mysql) / sizeof(char*), DEFAULT_MYSQL_MODE, tmp_of);
|
||||
tmp_of << "Oracle mode: \n";
|
||||
start_test_token_offset(
|
||||
test_sqls_oracle, sizeof(test_sqls_oracle) / sizeof(char*), DEFAULT_ORACLE_MODE | SMO_ORACLE, tmp_of);
|
||||
|
||||
res_of.close();
|
||||
tmp_of.close();
|
||||
is_equal_content(tmp_file, res_file, generate_res_file);
|
||||
} else {
|
||||
std::ofstream tmp_of(tmp_file);
|
||||
ASSERT_TRUE(tmp_of.is_open());
|
||||
|
||||
tmp_of << "MySQL mode: \n";
|
||||
start_test_token_offset(test_sqls_mysql, sizeof(test_sqls_mysql) / sizeof(char*), DEFAULT_MYSQL_MODE, tmp_of);
|
||||
tmp_of << "Oracle mode: \n";
|
||||
start_test_token_offset(
|
||||
test_sqls_oracle, sizeof(test_sqls_oracle) / sizeof(char*), DEFAULT_ORACLE_MODE | SMO_ORACLE, tmp_of);
|
||||
|
||||
tmp_of.close();
|
||||
is_equal_content(tmp_file, res_file, generate_res_file);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TestFastSqlParser, linker_test)
|
||||
{
|
||||
test_sql_parser();
|
||||
test_fast_parser();
|
||||
test_token_pos();
|
||||
}
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
279
unittest/sql/parser/test_sql_fast_parser.result
Normal file
279
unittest/sql/parser/test_sql_fast_parser.result
Normal file
@ -0,0 +1,279 @@
|
||||
MySQL mode:
|
||||
/*+ c1 */ /* c2 */ select /* ignored */ /*+ no_rewrite, index(t1 primary) */ /* ignored */ c1 from t1;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 19 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (c1) off: -1 len: -1
|
||||
--------T_COLUMN_REF (c1) off: 95 len: 2
|
||||
----------T_IDENT (c1) off: 95 len: 2
|
||||
----T_FROM_LIST (null) off: 98 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
----------T_IDENT (t1) off: 103 len: 2
|
||||
----T_HINT_OPTION_LIST (null) off: 42 len: 37
|
||||
------T_NO_REWRITE (null) off: -1 len: -1
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 62 len: 2
|
||||
--------T_IDENT (primary) off: 65 len: 7
|
||||
i: 0, off: 0, len: 9
|
||||
i: 1, off: 10, len: 8
|
||||
select * from t1 where c1 = c2+1*2/3-4 order by c1 + 2 limit 1;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: -1 len: -1
|
||||
--------T_STAR (null) off: 7 len: 1
|
||||
----T_FROM_LIST (null) off: 9 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
----------T_IDENT (t1) off: 14 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: 17 len: 5
|
||||
------T_OP_EQ (c1 = c2+1*2/3-4) off: 23 len: 15
|
||||
--------T_COLUMN_REF (c1) off: 23 len: 2
|
||||
----------T_IDENT (c1) off: 23 len: 2
|
||||
--------T_OP_MINUS (c2+1*2/3-4) off: 28 len: 10
|
||||
----------T_OP_ADD (c2+1*2/3) off: 28 len: 8
|
||||
------------T_COLUMN_REF (c2) off: 28 len: 2
|
||||
--------------T_IDENT (c2) off: 28 len: 2
|
||||
------------T_OP_DIV (1*2/3) off: 31 len: 5
|
||||
--------------T_OP_MUL (1*2) off: 31 len: 3
|
||||
----------------T_INT (1) off: 31 len: 1
|
||||
----------------T_INT (2) off: 33 len: 1
|
||||
--------------T_INT (3) off: 35 len: 1
|
||||
----------T_INT (4) off: 37 len: 1
|
||||
----T_ORDER_BY (null) off: 39 len: 8
|
||||
------T_SORT_LIST (null) off: -1 len: -1
|
||||
--------T_SORT_KEY (null) off: -1 len: -1
|
||||
----------T_OP_ADD (c1 + 2) off: 48 len: 6
|
||||
------------T_COLUMN_REF (c1) off: 48 len: 2
|
||||
--------------T_IDENT (c1) off: 48 len: 2
|
||||
------------T_INT (2) off: 53 len: 1
|
||||
----------T_SORT_ASC (null) off: -1 len: -1
|
||||
----T_LIMIT_CLAUSE (limit 1) off: 55 len: 7
|
||||
------T_LIMIT_INT (1) off: 61 len: 1
|
||||
select * from t1 where c1 = c2+1*2/3-4 order by c1 + 2 limit 1 offset 1;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: -1 len: -1
|
||||
--------T_STAR (null) off: 7 len: 1
|
||||
----T_FROM_LIST (null) off: 9 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
----------T_IDENT (t1) off: 14 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: 17 len: 5
|
||||
------T_OP_EQ (c1 = c2+1*2/3-4) off: 23 len: 15
|
||||
--------T_COLUMN_REF (c1) off: 23 len: 2
|
||||
----------T_IDENT (c1) off: 23 len: 2
|
||||
--------T_OP_MINUS (c2+1*2/3-4) off: 28 len: 10
|
||||
----------T_OP_ADD (c2+1*2/3) off: 28 len: 8
|
||||
------------T_COLUMN_REF (c2) off: 28 len: 2
|
||||
--------------T_IDENT (c2) off: 28 len: 2
|
||||
------------T_OP_DIV (1*2/3) off: 31 len: 5
|
||||
--------------T_OP_MUL (1*2) off: 31 len: 3
|
||||
----------------T_INT (1) off: 31 len: 1
|
||||
----------------T_INT (2) off: 33 len: 1
|
||||
--------------T_INT (3) off: 35 len: 1
|
||||
----------T_INT (4) off: 37 len: 1
|
||||
----T_ORDER_BY (null) off: 39 len: 8
|
||||
------T_SORT_LIST (null) off: -1 len: -1
|
||||
--------T_SORT_KEY (null) off: -1 len: -1
|
||||
----------T_OP_ADD (c1 + 2) off: 48 len: 6
|
||||
------------T_COLUMN_REF (c1) off: 48 len: 2
|
||||
--------------T_IDENT (c1) off: 48 len: 2
|
||||
------------T_INT (2) off: 53 len: 1
|
||||
----------T_SORT_ASC (null) off: -1 len: -1
|
||||
----T_LIMIT_CLAUSE (limit 1 offset 1) off: 55 len: 16
|
||||
------T_LIMIT_INT (1) off: 61 len: 1
|
||||
------T_INT (1) off: 70 len: 1
|
||||
select /*+ index(t1.c1 primary) */* from t1 where `name` = 'abc';
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: -1 len: -1
|
||||
--------T_STAR (null) off: 34 len: 1
|
||||
----T_FROM_LIST (null) off: 36 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
----------T_IDENT (t1) off: 41 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: 44 len: 5
|
||||
------T_OP_EQ (`name` = 'abc') off: 50 len: 14
|
||||
--------T_COLUMN_REF (`name`) off: 50 len: 6
|
||||
----------T_IDENT (name) off: 51 len: 4
|
||||
--------T_VARCHAR ('abc') off: 59 len: 5
|
||||
----------T_VARCHAR (abc) off: 60 len: 3
|
||||
----T_HINT_OPTION_LIST (null) off: 9 len: 25
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (c1) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 17 len: 2
|
||||
------------T_IDENT (c1) off: 20 len: 2
|
||||
--------T_IDENT (primary) off: 23 len: 7
|
||||
select /*+ index(t1.name primary) */* from t1 where `c1` = 'abc';
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: -1 len: -1
|
||||
--------T_STAR (null) off: 36 len: 1
|
||||
----T_FROM_LIST (null) off: 38 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
----------T_IDENT (t1) off: 43 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: 46 len: 5
|
||||
------T_OP_EQ (`c1` = 'abc') off: 52 len: 12
|
||||
--------T_COLUMN_REF (`c1`) off: 52 len: 4
|
||||
----------T_IDENT (c1) off: 53 len: 2
|
||||
--------T_VARCHAR ('abc') off: 59 len: 5
|
||||
----------T_VARCHAR (abc) off: 60 len: 3
|
||||
----T_HINT_OPTION_LIST (null) off: 9 len: 27
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (name) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 17 len: 2
|
||||
------------T_IDENT (name) off: 20 len: 4
|
||||
--------T_IDENT (primary) off: 25 len: 7
|
||||
Oracle mode:
|
||||
/*+ c1 */ /* c2 */ select /* ignored */ /*+ no_rewrite, index(t1 primary) */ /* ignored */ c1 from t1;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 19 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (C1) off: -1 len: -1
|
||||
--------T_OBJ_ACCESS_REF (c1) off: 95 len: 2
|
||||
----------T_IDENT (C1) off: 95 len: 2
|
||||
----T_FROM_LIST (null) off: 98 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (T1) off: -1 len: -1
|
||||
----------T_IDENT (T1) off: 103 len: 2
|
||||
----T_HINT_OPTION_LIST (null) off: 78 len: 37
|
||||
------T_NO_REWRITE (null) off: -1 len: -1
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (t1) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 62 len: 2
|
||||
--------T_IDENT (primary) off: 65 len: 7
|
||||
i: 0, off: 0, len: 9
|
||||
i: 1, off: 10, len: 8
|
||||
select * from t1 where c1 = c2+1*2/3-4 and rownum < 1 order by c1 + 2;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: 7 len: 1
|
||||
--------T_STAR (null) off: -1 len: -1
|
||||
----T_FROM_LIST (null) off: 9 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (T1) off: -1 len: -1
|
||||
----------T_IDENT (T1) off: 14 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: -1 len: -1
|
||||
------T_OP_AND (null) off: -1 len: -1
|
||||
--------T_OP_EQ (c1 = c2+1*2/3-4) off: 23 len: 15
|
||||
----------T_OBJ_ACCESS_REF (c1) off: 23 len: 2
|
||||
------------T_IDENT (C1) off: 23 len: 2
|
||||
----------T_OP_MINUS (c2+1*2/3-4) off: 28 len: 10
|
||||
------------T_OP_ADD (c2+1*2/3) off: 28 len: 8
|
||||
--------------T_OBJ_ACCESS_REF (c2) off: 28 len: 2
|
||||
----------------T_IDENT (C2) off: 28 len: 2
|
||||
--------------T_OP_DIV (1*2/3) off: 31 len: 5
|
||||
----------------T_OP_MUL (1*2) off: 31 len: 3
|
||||
------------------T_INT (1) off: 31 len: 1
|
||||
------------------T_INT (2) off: 33 len: 1
|
||||
----------------T_INT (3) off: 35 len: 1
|
||||
------------T_INT (4) off: 37 len: 1
|
||||
--------T_OP_LT (rownum < 1) off: 43 len: 10
|
||||
----------T_FUN_SYS (rownum) off: 43 len: 6
|
||||
------------T_IDENT (rownum) off: -1 len: -1
|
||||
----------T_INT (1) off: 52 len: 1
|
||||
----T_ORDER_BY (null) off: 54 len: 8
|
||||
------T_SORT_LIST (null) off: -1 len: -1
|
||||
--------T_SORT_KEY (null) off: -1 len: -1
|
||||
----------T_OP_ADD (c1 + 2) off: 63 len: 6
|
||||
------------T_OBJ_ACCESS_REF (c1) off: 63 len: 2
|
||||
--------------T_IDENT (C1) off: 63 len: 2
|
||||
------------T_INT (2) off: 68 len: 1
|
||||
----------T_SORT_ASC (null) off: -1 len: -1
|
||||
select * from t1 where c1 = c2+1*2/3-4 and rownum < 1+1 order by c1 + 2;
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: 7 len: 1
|
||||
--------T_STAR (null) off: -1 len: -1
|
||||
----T_FROM_LIST (null) off: 9 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (T1) off: -1 len: -1
|
||||
----------T_IDENT (T1) off: 14 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: -1 len: -1
|
||||
------T_OP_AND (null) off: -1 len: -1
|
||||
--------T_OP_EQ (c1 = c2+1*2/3-4) off: 23 len: 15
|
||||
----------T_OBJ_ACCESS_REF (c1) off: 23 len: 2
|
||||
------------T_IDENT (C1) off: 23 len: 2
|
||||
----------T_OP_MINUS (c2+1*2/3-4) off: 28 len: 10
|
||||
------------T_OP_ADD (c2+1*2/3) off: 28 len: 8
|
||||
--------------T_OBJ_ACCESS_REF (c2) off: 28 len: 2
|
||||
----------------T_IDENT (C2) off: 28 len: 2
|
||||
--------------T_OP_DIV (1*2/3) off: 31 len: 5
|
||||
----------------T_OP_MUL (1*2) off: 31 len: 3
|
||||
------------------T_INT (1) off: 31 len: 1
|
||||
------------------T_INT (2) off: 33 len: 1
|
||||
----------------T_INT (3) off: 35 len: 1
|
||||
------------T_INT (4) off: 37 len: 1
|
||||
--------T_OP_LT (rownum < 1+1) off: 43 len: 12
|
||||
----------T_FUN_SYS (rownum) off: 43 len: 6
|
||||
------------T_IDENT (rownum) off: -1 len: -1
|
||||
----------T_OP_ADD (1+1) off: 52 len: 3
|
||||
------------T_INT (1) off: 52 len: 1
|
||||
------------T_INT (1) off: 54 len: 1
|
||||
----T_ORDER_BY (null) off: 56 len: 8
|
||||
------T_SORT_LIST (null) off: -1 len: -1
|
||||
--------T_SORT_KEY (null) off: -1 len: -1
|
||||
----------T_OP_ADD (c1 + 2) off: 65 len: 6
|
||||
------------T_OBJ_ACCESS_REF (c1) off: 65 len: 2
|
||||
--------------T_IDENT (C1) off: 65 len: 2
|
||||
------------T_INT (2) off: 70 len: 1
|
||||
----------T_SORT_ASC (null) off: -1 len: -1
|
||||
select /*+ index(t1.c1 primary) */* from t1 where "name" = 'abc';
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: 34 len: 1
|
||||
--------T_STAR (null) off: -1 len: -1
|
||||
----T_FROM_LIST (null) off: 36 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (T1) off: -1 len: -1
|
||||
----------T_IDENT (T1) off: 41 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: -1 len: -1
|
||||
------T_OP_EQ ("name" = 'abc') off: 50 len: 14
|
||||
--------T_OBJ_ACCESS_REF ("name") off: 50 len: 6
|
||||
----------T_IDENT (name) off: 51 len: 4
|
||||
--------T_CHAR ('abc') off: 59 len: 5
|
||||
----------T_VARCHAR (abc) off: 60 len: 3
|
||||
----T_HINT_OPTION_LIST (null) off: 33 len: 25
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (c1) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 17 len: 2
|
||||
------------T_IDENT (c1) off: 20 len: 2
|
||||
--------T_IDENT (primary) off: 23 len: 7
|
||||
select /*+ index(t1.name primary) */* from t1 where "c1" = 'abc';
|
||||
T_STMT_LIST (null) off: -1 len: -1
|
||||
--T_SELECT (null) off: 0 len: 6
|
||||
----T_PROJECT_LIST (null) off: -1 len: -1
|
||||
------T_PROJECT_STRING (*) off: 36 len: 1
|
||||
--------T_STAR (null) off: -1 len: -1
|
||||
----T_FROM_LIST (null) off: 38 len: 4
|
||||
------T_ORG (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR (T1) off: -1 len: -1
|
||||
----------T_IDENT (T1) off: 43 len: 2
|
||||
----T_WHERE_CLAUSE (null) off: -1 len: -1
|
||||
------T_OP_EQ ("c1" = 'abc') off: 52 len: 12
|
||||
--------T_OBJ_ACCESS_REF ("c1") off: 52 len: 4
|
||||
----------T_IDENT (c1) off: 53 len: 2
|
||||
--------T_CHAR ('abc') off: 59 len: 5
|
||||
----------T_VARCHAR (abc) off: 60 len: 3
|
||||
----T_HINT_OPTION_LIST (null) off: 35 len: 27
|
||||
------T_INDEX (null) off: -1 len: -1
|
||||
--------T_RELATION_FACTOR_IN_HINT (null) off: -1 len: -1
|
||||
----------T_RELATION_FACTOR (name) off: -1 len: -1
|
||||
------------T_IDENT (t1) off: 17 len: 2
|
||||
------------T_IDENT (name) off: 20 len: 4
|
||||
--------T_IDENT (primary) off: 25 len: 7
|
||||
Reference in New Issue
Block a user