~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/test_tools/randgen/conf/optimizer/archive/subquery_materialization.yy

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (1.2.12) (2.1.19 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029154340-2gp39el6cv8bwf2o
Tags: 1:7.2.3-2ubuntu1
* Merge from debian, remaining changes:
  - Link against boost_system because of boost_thread.
  - Add required libs to message/include.am
  - Add upstart job and adjust init script to be upstart compatible.
  - Disable -floop-parallelize-all due to gcc-4.8/4.9 compiler ICE
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57732

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved.
 
2
# Use is subject to license terms.
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; version 2 of the License.
 
7
#
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
11
# General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 
16
# USA
 
17
 
 
18
################################################################################
 
19
# NOTE:  This is an older grammar and should not be prioritized over other 
 
20
#        grammars (such as optimizer*subquery, outer_join, range_access)
 
21
#        While this is still an effective testing tool, the grammars listed
 
22
#        above should be run first
 
23
################################################################################
 
24
 
 
25
 
 
26
query:
 
27
        SELECT select_option outer_select_item
 
28
        FROM outer_from
 
29
        WHERE subquery_expression outer_logical_expr outer_condition_top
 
30
        outer_having outer_order_by ;
 
31
 
 
32
outer_logical_expr:
 
33
        AND | OR | XOR ;
 
34
 
 
35
outer_select_item:
 
36
        OUTR . field_name AS x |
 
37
        aggregate_function OUTR . field_name ) AS x;
 
38
 
 
39
aggregate_function:
 
40
        AVG( |
 
41
        BIT_AND( | BIT_OR( | BIT_XOR( |
 
42
        COUNT(DISTINCT | COUNT( |
 
43
        MIN( | MIN(DISTINCT |
 
44
        MAX( | MAX(DISTINCT |
 
45
        STD( | STDDEV_POP( | STDDEV_SAMP( |
 
46
        SUM( | SUM(DISTINCT |
 
47
        VAR_POP( | VAR_SAMP( | VARIANCE( |
 
48
        AVG(DISTINCT ;
 
49
 
 
50
aggregate_function_disabled_unpredictable_value:
 
51
        GROUP_CONCAT( | ;
 
52
 
 
53
outer_from:
 
54
        outer_table_name AS OUTR |
 
55
        outer_table_name AS OUTR2 LEFT JOIN outer_table_name AS OUTR ON ( outer_join_condition );
 
56
 
 
57
outer_join_condition:
 
58
        OUTR2 . int_field_name arithmetic_operator OUTR . int_field_name |
 
59
        OUTR2 . date_field_name arithmetic_operator OUTR . date_field_name |
 
60
        OUTR2 . char_field_name arithmetic_operator OUTR . char_field_name ;
 
61
 
 
62
outer_order_by:
 
63
        ORDER BY OUTR . field_name , OUTR . `pk` ;
 
64
 
 
65
outer_group_by:
 
66
        | GROUP BY OUTR . field_name ;
 
67
 
 
68
outer_having:
 
69
        | HAVING x arithmetic_operator value;
 
70
 
 
71
outer_having_disabled_bug38072:
 
72
        | HAVING x arithmetic_operator value ;
 
73
 
 
74
limit:
 
75
        | LIMIT digit ;
 
76
 
 
77
select_inner_body:
 
78
        FROM inner_from
 
79
        WHERE inner_condition_top
 
80
        inner_order_by;
 
81
 
 
82
select_inner:
 
83
        SELECT select_option inner_select_item
 
84
        select_inner_body;
 
85
 
 
86
inner_order_by:
 
87
        | ORDER BY INNR . field_name ;
 
88
 
 
89
inner_select_item:
 
90
        INNR . int_field_name AS y ;
 
91
 
 
92
inner_from:
 
93
        inner_table_name AS INNR |
 
94
        inner_table_name AS INNR2 LEFT JOIN inner_table_name AS INNR ON ( inner_join_condition );
 
95
 
 
96
inner_join_condition:
 
97
        INNR2 . int_field_name arithmetic_operator INNR . int_field_name |
 
98
        INNR2 . char_field_name arithmetic_operator INNR . char_field_name |
 
99
        INNR2 . date_field_name arithmetic_operator INNR . date_field_name ;
 
100
 
 
101
outer_condition_top:
 
102
        outer_condition_bottom |
 
103
        ( outer_condition_bottom logical_operator outer_condition_bottom ) |
 
104
        outer_condition_bottom logical_operator outer_condition_bottom ;
 
105
 
 
106
outer_condition_bottom:
 
107
        OUTR . expression ;
 
108
 
 
109
expression:
 
110
        field_name null_operator |
 
111
        int_field_name int_expression |
 
112
        date_field_name date_expression |
 
113
        char_field_name char_expression ;
 
114
 
 
115
int_expression:
 
116
        arithmetic_operator digit ;
 
117
 
 
118
date_expression:
 
119
        arithmetic_operator date | BETWEEN date AND date;
 
120
 
 
121
char_expression:
 
122
        arithmetic_operator _varchar(1);
 
123
 
 
124
inner_condition_top:
 
125
        INNR . expression |
 
126
        OUTR . expression |
 
127
        inner_condition_bottom logical_operator inner_condition_bottom |
 
128
        inner_condition_bottom logical_operator outer_condition_bottom ;
 
129
 
 
130
inner_condition_bottom:
 
131
        INNR . expression |
 
132
        INNR . int_field_name arithmetic_operator INNR . int_field_name |
 
133
        INNR . date_field_name arithmetic_operator INNR . date_field_name |
 
134
        INNR . char_field_name arithmetic_operator INNR . char_field_name ;
 
135
 
 
136
null_operator: IS NULL | IS NOT NULL ;
 
137
 
 
138
logical_operator:
 
139
        AND | OR | OR NOT | XOR | AND NOT ;
 
140
 
 
141
arithmetic_operator:
 
142
        = | > | < | <> | >= | <= ;
 
143
 
 
144
subquery_expression:
 
145
        OUTR . int_field_name IN ( SELECT select_option INNR . int_field_name AS y select_inner_body ) |
 
146
        OUTR . char_field_name IN ( SELECT select_option INNR . char_field_name AS y select_inner_body ) |
 
147
        ( OUTR . int_field_name , OUTR . int_field_name ) IN ( SELECT select_option INNR . int_field_name AS x , INNR . int_field_name AS y select_inner_body ) |
 
148
        ( OUTR . char_field_name , OUTR . char_field_name ) IN ( SELECT select_option INNR . char_field_name AS x , INNR . char_field_name AS y select_inner_body ) ;
 
149
 
 
150
field_name:
 
151
        int_field_name | char_field_name | date_field_name;
 
152
 
 
153
int_field_name:
 
154
        `pk` | `col_int_key` | `col_int_nokey` ;
 
155
 
 
156
date_field_name:
 
157
        `col_date_key` | `col_date_nokey` | `col_datetime_key` | `col_datetime_nokey` | `col_time_key` | `col_time_nokey` ;
 
158
 
 
159
char_field_name:
 
160
        `col_varchar_key` | `col_varchar_nokey` ;
 
161
 
 
162
outer_table_name:
 
163
        B | C ;
 
164
 
 
165
inner_table_name:
 
166
        BB | CC ;
 
167
 
 
168
value: _digit | _date | _time | _datetime | _varchar(1) | NULL ;
 
169
 
 
170
select_option: 
 
171
        | DISTINCT ;