@@ -79,4 +79,102 @@ suite("test_index_match_phrase_edge", "nonConcurrent"){
79
79
} finally {
80
80
GetDebugPoint (). disableDebugPointForAllBEs(" VMatchPredicate.execute" )
81
81
}
82
+
83
+ def indexTbName2 = " test_index_match_phrase_edge2"
84
+ def indexTbName3 = " test_index_match_phrase_edge3"
85
+
86
+ sql " DROP TABLE IF EXISTS ${ indexTbName2} "
87
+ sql " DROP TABLE IF EXISTS ${ indexTbName3} "
88
+
89
+ sql """
90
+ CREATE TABLE ${ indexTbName2} (
91
+ `@timestamp` int(11) NULL COMMENT "",
92
+ `clientip` varchar(20) NULL COMMENT "",
93
+ `request` text NULL COMMENT "",
94
+ `status` int(11) NULL COMMENT "",
95
+ `size` int(11) NULL COMMENT "",
96
+ INDEX request_idx (`request`) USING INVERTED PROPERTIES("parser" = "english", "support_phrase" = "true") COMMENT ''
97
+ ) ENGINE=OLAP
98
+ DUPLICATE KEY(`@timestamp`)
99
+ COMMENT "OLAP"
100
+ DISTRIBUTED BY RANDOM BUCKETS 1
101
+ PROPERTIES (
102
+ "replication_allocation" = "tag.location.default: 1"
103
+ );
104
+ """
105
+
106
+ sql """
107
+ CREATE TABLE ${ indexTbName3} (
108
+ `@timestamp` int(11) NULL COMMENT "",
109
+ `clientip` varchar(20) NULL COMMENT "",
110
+ `request` text NULL COMMENT "",
111
+ `status` int(11) NULL COMMENT "",
112
+ `size` int(11) NULL COMMENT ""
113
+ ) ENGINE=OLAP
114
+ DUPLICATE KEY(`@timestamp`)
115
+ COMMENT "OLAP"
116
+ DISTRIBUTED BY RANDOM BUCKETS 1
117
+ PROPERTIES (
118
+ "replication_allocation" = "tag.location.default: 1"
119
+ );
120
+ """
121
+
122
+ def load_httplogs_data = {table_name, label, read_flag, format_flag, file_name, ignore_failure= false ,
123
+ expected_succ_rows = -1 , load_to_single_tablet = ' true' ->
124
+
125
+ // load the json data
126
+ streamLoad {
127
+ table " ${ table_name} "
128
+
129
+ // set http request header params
130
+ set ' label' , label + " _" + UUID . randomUUID(). toString()
131
+ set ' read_json_by_line' , read_flag
132
+ set ' format' , format_flag
133
+ file file_name // import json file
134
+ time 10000 // limit inflight 10s
135
+ if (expected_succ_rows >= 0 ) {
136
+ set ' max_filter_ratio' , ' 1'
137
+ }
138
+
139
+ // if declared a check callback, the default check condition will ignore.
140
+ // So you must check all condition
141
+ check { result , exception , startTime , endTime ->
142
+ if (ignore_failure && expected_succ_rows < 0 ) { return }
143
+ if (exception != null ) {
144
+ throw exception
145
+ }
146
+ log. info(" Stream load result: ${ result} " . toString())
147
+ def json = parseJson(result)
148
+ assertEquals (" success" , json.Status . toLowerCase())
149
+ if (expected_succ_rows >= 0 ) {
150
+ assertEquals (json.NumberLoadedRows , expected_succ_rows)
151
+ } else {
152
+ assertEquals (json.NumberTotalRows , json.NumberLoadedRows + json.NumberUnselectedRows )
153
+ assertTrue (json.NumberLoadedRows > 0 && json.LoadBytes > 0 )
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ try {
160
+ load_httplogs_data. call(indexTbName2, indexTbName2, ' true' , ' json' , ' documents-1000.json' )
161
+ load_httplogs_data. call(indexTbName3, indexTbName3, ' true' , ' json' , ' documents-1000.json' )
162
+
163
+ sql " sync"
164
+ sql """ set enable_common_expr_pushdown = true; """
165
+
166
+ GetDebugPoint (). enableDebugPointForAllBEs(" VMatchPredicate.execute" )
167
+ qt_sql """ select count() from ${ indexTbName2} where request match_phrase_edge ''; """
168
+ qt_sql """ select count() from ${ indexTbName2} where request match_phrase_edge 'age'; """
169
+ qt_sql """ select count() from ${ indexTbName2} where request match_phrase_edge 'es/na'; """
170
+ qt_sql """ select count() from ${ indexTbName2} where request match_phrase_edge 'ets/images/ti'; """
171
+ GetDebugPoint (). disableDebugPointForAllBEs(" VMatchPredicate.execute" )
172
+
173
+ qt_sql """ select count() from ${ indexTbName3} where request match_phrase_edge ''; """
174
+ qt_sql """ select count() from ${ indexTbName3} where request match_phrase_edge 'age'; """
175
+ qt_sql """ select count() from ${ indexTbName3} where request match_phrase_edge 'es/na'; """
176
+ qt_sql """ select count() from ${ indexTbName3} where request match_phrase_edge 'ets/images/ti'; """
177
+ } finally {
178
+ GetDebugPoint (). disableDebugPointForAllBEs(" VMatchPredicate.execute" )
179
+ }
82
180
}
0 commit comments