YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_select.h
Line
Count
Source (jump to first uncovered line)
1
//--------------------------------------------------------------------------------------------------
2
// Copyright (c) YugaByte, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
// in compliance with the License.  You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software distributed under the License
10
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
// or implied.  See the License for the specific language governing permissions and limitations
12
// under the License.
13
//
14
//
15
// Tree node definitions for SELECT statement.
16
//--------------------------------------------------------------------------------------------------
17
18
#ifndef YB_YQL_CQL_QL_PTREE_PT_SELECT_H_
19
#define YB_YQL_CQL_QL_PTREE_PT_SELECT_H_
20
21
#include "yb/yql/cql/ql/ptree/list_node.h"
22
#include "yb/yql/cql/ql/ptree/tree_node.h"
23
#include "yb/yql/cql/ql/ptree/pt_name.h"
24
#include "yb/yql/cql/ql/ptree/pt_dml.h"
25
26
namespace yb {
27
namespace ql {
28
29
//--------------------------------------------------------------------------------------------------
30
// ORDER BY.
31
class PTOrderBy : public TreeNode {
32
 public:
33
  //------------------------------------------------------------------------------------------------
34
  // Public types.
35
  typedef MCSharedPtr<PTOrderBy> SharedPtr;
36
  typedef MCSharedPtr<const PTOrderBy> SharedPtrConst;
37
38
  enum Direction : int8_t { kASC = 0, kDESC };
39
40
  enum NullPlacement : int8_t { kFIRST = 0, kLAST };
41
42
  //------------------------------------------------------------------------------------------------
43
  // Constructor and destructor.
44
  PTOrderBy(MemoryContext *memctx,
45
            YBLocationPtr loc,
46
            const PTExprPtr& order_expr,
47
            const Direction direction,
48
            const NullPlacement null_placement);
49
  virtual ~PTOrderBy();
50
51
  // Node type.
52
0
  virtual TreeNodeOpcode opcode() const override {
53
0
    return TreeNodeOpcode::kPTOrderBy;
54
0
  }
55
56
  template<typename... TypeArgs>
57
308
  inline static PTOrderBy::SharedPtr MakeShared(MemoryContext *memctx, TypeArgs&&... args) {
58
308
    return MCMakeShared<PTOrderBy>(memctx, std::forward<TypeArgs>(args)...);
59
308
  }
60
61
  virtual CHECKED_STATUS Analyze(SemContext *sem_context) override;
62
63
315
  Direction direction() const {
64
315
    return direction_;
65
315
  }
66
67
0
  NullPlacement null_placement() const {
68
0
    return null_placement_;
69
0
  }
70
71
315
  PTExprPtr order_expr() const {
72
315
    return order_expr_;
73
315
  }
74
75
 private:
76
  PTExprPtr order_expr_;
77
  Direction direction_;
78
  NullPlacement null_placement_;
79
};
80
81
using PTOrderByListNode = TreeListNode<PTOrderBy>;
82
83
//--------------------------------------------------------------------------------------------------
84
// FROM <table ref list>.
85
class PTTableRef : public TreeNode {
86
 public:
87
  //------------------------------------------------------------------------------------------------
88
  // Public types.
89
  typedef MCSharedPtr<PTTableRef> SharedPtr;
90
  typedef MCSharedPtr<const PTTableRef> SharedPtrConst;
91
92
  //------------------------------------------------------------------------------------------------
93
  // Constructor and destructor.
94
  PTTableRef(MemoryContext *memctx,
95
             YBLocationPtr loc,
96
             const PTQualifiedName::SharedPtr& name,
97
             MCSharedPtr<MCString> alias);
98
  virtual ~PTTableRef();
99
100
  // Node type.
101
0
  virtual TreeNodeOpcode opcode() const override {
102
0
    return TreeNodeOpcode::kPTTableRef;
103
0
  }
104
105
  template<typename... TypeArgs>
106
273k
  inline static PTTableRef::SharedPtr MakeShared(MemoryContext *memctx, TypeArgs&&... args) {
107
273k
    return MCMakeShared<PTTableRef>(memctx, std::forward<TypeArgs>(args)...);
108
273k
  }
std::__1::shared_ptr<yb::ql::PTTableRef> yb::ql::PTTableRef::MakeShared<std::__1::shared_ptr<yb::ql::Location>, std::__1::shared_ptr<yb::ql::PTQualifiedName>&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, yb::internal::ArenaAllocatorBase<char, yb::internal::ArenaTraits> > >&>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, std::__1::shared_ptr<yb::ql::Location>&&, std::__1::shared_ptr<yb::ql::PTQualifiedName>&, std::__1::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, yb::internal::ArenaAllocatorBase<char, yb::internal::ArenaTraits> > >&)
Line
Count
Source
106
269k
  inline static PTTableRef::SharedPtr MakeShared(MemoryContext *memctx, TypeArgs&&... args) {
107
269k
    return MCMakeShared<PTTableRef>(memctx, std::forward<TypeArgs>(args)...);
108
269k
  }
std::__1::shared_ptr<yb::ql::PTTableRef> yb::ql::PTTableRef::MakeShared<std::__1::shared_ptr<yb::ql::Location>, std::__1::shared_ptr<yb::ql::PTQualifiedName>&, std::nullptr_t>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, std::__1::shared_ptr<yb::ql::Location>&&, std::__1::shared_ptr<yb::ql::PTQualifiedName>&, std::nullptr_t&&)
Line
Count
Source
106
4.16k
  inline static PTTableRef::SharedPtr MakeShared(MemoryContext *memctx, TypeArgs&&... args) {
107
4.16k
    return MCMakeShared<PTTableRef>(memctx, std::forward<TypeArgs>(args)...);
108
4.16k
  }
109
110
  virtual CHECKED_STATUS Analyze(SemContext *sem_context) override;
111
112
788k
  client::YBTableName table_name() const {
113
788k
    return name_->ToTableName();
114
788k
  }
115
116
 private:
117
  PTQualifiedName::SharedPtr name_;
118
  MCSharedPtr<MCString> alias_;
119
};
120
121
using PTTableRefListNode = TreeListNode<PTTableRef>;
122
123
//--------------------------------------------------------------------------------------------------
124
// State variables for INDEX analysis.
125
class SelectScanInfo : public MCBase {
126
 public:
127
  // Public types.
128
  typedef MCSharedPtr<SelectScanInfo> SharedPtr;
129
130
  // Constructor.
131
  explicit SelectScanInfo(MemoryContext *memctx,
132
                          size_t num_columns,
133
                          MCVector<const PTExpr*> *scan_filtering_exprs,
134
                          MCMap<MCString, ColumnDesc> *scan_column_map);
135
136
  // Collecting references to columns.
137
  const ColumnDesc* GetColumnDesc(const SemContext *sem_context, const MCString& col_name);
138
139
  // Collecting references to filter expressions.
140
  CHECKED_STATUS AddFilteringExpr(SemContext *sem_context, const PTRelationExpr *expr);
141
142
  // Collecting references of operators on WHERE clause.
143
  CHECKED_STATUS AddWhereExpr(SemContext *sem_context,
144
                              const PTRelationExpr *expr,
145
                              const ColumnDesc *col_desc,
146
                              PTExprPtr value,
147
                              PTExprListNode::SharedPtr col_args = nullptr);
148
149
  // Setup for analyzing where clause.
150
192k
  void set_analyze_where(bool val) { analyze_where_ = val; }
151
108k
  bool analyze_where() const { return analyze_where_; }
152
153
  // Setup for analyzing if clause.
154
327
  void set_analyze_if(bool val) { analyze_if_ = val; }
155
108k
  bool analyze_if() const { return analyze_if_; }
156
157
  // Setup for analyzing order by clause.
158
230
  void StartOrderbyAnalysis(MCMap<MCString, ColumnDesc> *column_map) {
159
230
    analyze_orderby_ = true;
160
230
    scan_column_map_ = column_map;
161
230
  }
162
194
  void FinishOrderbyAnalysis() {
163
194
    analyze_orderby_ = false;
164
194
    scan_column_map_ = nullptr;
165
194
  }
166
167
  // Direct access functions.
168
287k
  const MCList<ColumnOp>& col_ops() const {
169
287k
    return col_ops_;
170
287k
  }
171
172
0
  const MCVector<ColumnOpCounter>& col_op_counters() const {
173
0
    return col_op_counters_;
174
0
  }
175
176
16.9k
  const MCList<JsonColumnOp>& col_json_ops() const {
177
16.9k
    return col_json_ops_;
178
16.9k
  }
179
180
0
  const MCList<SubscriptedColumnOp>& col_subscript_ops() const {
181
0
    return col_subscript_ops_;
182
0
  }
183
184
 private:
185
  // Processing state.
186
  bool analyze_where_ = false;
187
  bool analyze_if_ = false;
188
  bool analyze_orderby_ = false;
189
190
  // Reference list from where clause
191
  MCList<ColumnOp> col_ops_;
192
  MCVector<ColumnOpCounter> col_op_counters_;
193
194
  MCList<JsonColumnOp> col_json_ops_;
195
  MCList<SubscriptedColumnOp> col_subscript_ops_;
196
197
  // All filter expression from WHERE and IF clauses.
198
  MCVector<const PTExpr*> *scan_filtering_exprs_ = nullptr;
199
200
  // Index columns.
201
  MCMap<MCString, ColumnDesc> *scan_column_map_ = nullptr;
202
};
203
204
//--------------------------------------------------------------------------------------------------
205
// Chosen index.
206
class SelectScanSpec {
207
 public:
208
269k
  SelectScanSpec() { }
209
210
765
  const TableId& index_id() const {
211
765
    return index_id_;
212
765
  }
213
214
268k
  void set_index_id(const TableId& val) {
215
268k
    index_id_ = val;
216
268k
  }
217
218
269k
  bool use_primary_scan() const {
219
269k
    return index_id_.empty();
220
269k
  }
221
222
3.06k
  bool covers_fully() const {
223
3.06k
    return covers_fully_;
224
3.06k
  }
225
226
269k
  void set_covers_fully(bool val) {
227
269k
    covers_fully_ = val;
228
269k
  }
229
230
269k
  bool is_forward_scan() const {
231
269k
    return is_forward_scan_;
232
269k
  }
233
234
269k
  void set_is_forward_scan(bool val) {
235
269k
    is_forward_scan_ = val;
236
269k
  }
237
238
269k
  void set_prefix_length(size_t prefix_length) {
239
269k
    prefix_length_ = prefix_length;
240
269k
  }
241
242
765
  size_t prefix_length() const {
243
765
    return prefix_length_;
244
765
  }
245
246
 private:
247
  TableId index_id_;
248
  bool covers_fully_ = false;
249
  bool is_forward_scan_ = true;
250
  size_t prefix_length_ = 0;
251
};
252
253
//--------------------------------------------------------------------------------------------------
254
// This class represents SELECT statement.
255
class PTSelectStmt : public PTDmlStmt {
256
 public:
257
  //------------------------------------------------------------------------------------------------
258
  // Public types.
259
  typedef MCSharedPtr<PTSelectStmt> SharedPtr;
260
  typedef MCSharedPtr<const PTSelectStmt> SharedPtrConst;
261
262
  //------------------------------------------------------------------------------------------------
263
  // Constructor and destructor.
264
  PTSelectStmt(MemoryContext *memctx,
265
               YBLocationPtr loc,
266
               bool distinct,
267
               PTExprListNode::SharedPtr selected_exprs,
268
               PTTableRefListNode::SharedPtr from_clause,
269
               PTExprPtr where_clause,
270
               PTExprPtr if_clause,
271
               PTListNode::SharedPtr group_by_clause,
272
               PTListNode::SharedPtr having_clause,
273
               PTOrderByListNode::SharedPtr order_by_clause,
274
               PTExprPtr limit_clause,
275
               PTExprPtr offset_clause);
276
277
  // Construct a nested select tnode to select from the index.
278
  PTSelectStmt(MemoryContext *memctx,
279
               const PTSelectStmt& parent,
280
               PTExprListNode::SharedPtr selected_exprs,
281
               const SelectScanSpec& scan_spec);
282
283
  virtual ~PTSelectStmt();
284
285
  template<typename... TypeArgs>
286
  inline static PTSelectStmt::SharedPtr MakeShared(MemoryContext *memctx,
287
271k
                                                   TypeArgs&&... args) {
288
271k
    return MCMakeShared<PTSelectStmt>(memctx, std::forward<TypeArgs>(args)...);
289
271k
  }
std::__1::shared_ptr<yb::ql::PTSelectStmt> yb::ql::PTSelectStmt::MakeShared<yb::ql::PTSelectStmt&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, yb::ql::SelectScanSpec const&>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, yb::ql::PTSelectStmt&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, yb::ql::SelectScanSpec const&)
Line
Count
Source
287
765
                                                   TypeArgs&&... args) {
288
765
    return MCMakeShared<PTSelectStmt>(memctx, std::forward<TypeArgs>(args)...);
289
765
  }
std::__1::shared_ptr<yb::ql::PTSelectStmt> yb::ql::PTSelectStmt::MakeShared<std::__1::shared_ptr<yb::ql::Location>, bool, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTTableRef> >&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::TreeNode> >&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::TreeNode> >&, std::nullptr_t, std::nullptr_t, std::nullptr_t>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, std::__1::shared_ptr<yb::ql::Location>&&, bool&&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTTableRef> >&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::TreeNode> >&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::TreeNode> >&, std::nullptr_t&&, std::nullptr_t&&, std::nullptr_t&&)
Line
Count
Source
287
271k
                                                   TypeArgs&&... args) {
288
271k
    return MCMakeShared<PTSelectStmt>(memctx, std::forward<TypeArgs>(args)...);
289
271k
  }
290
291
  // Node semantics analysis.
292
  // This function traverses the parse tree for SELECT statement a few times for different purposes.
293
  // (1) Analyze references.
294
  //     This step validate the references to tables, columns, and operators.
295
  // (2) Analyze scan plan.
296
  //     This step chooses an index to scan and save the scan-spec.
297
  // (3) Analyze clauses
298
  //     This step analyzes clauses according to the chosen scan spec to prepare for execution.
299
  //
300
  // NOTE:
301
  // The current design for SELECT analysis is bit different from common compilation practice.
302
  // extended and required more analysis, we can redo this work then.
303
  // - Normally, step (1) should have collected information for processes in steps (2) and (3).
304
  //   However, the existing implementation in YugaByte is different when choosing scan path.
305
  // - After step (2), the current design creates a duplicate of the parse tree for nested query
306
  //   and compile both SELECT twins to analyze PRIMARY and SECONDARY scan within the same context.
307
  // This adds unnecessary complexities to the compilation process. However, it affects all layers
308
  // in CQL, so we will keep it that way for now to avoid new bugs and extra work. If the CQL
309
  // language is extended further toward SQL, we can change this design.
310
  virtual CHECKED_STATUS Analyze(SemContext *sem_context) override;
311
  bool CoversFully(const IndexInfo& index_info,
312
                   const MCUnorderedMap<int32, uint16> &column_ref_cnts) const;
313
314
  // Explain scan path.
315
  void PrintSemanticAnalysisResult(SemContext *sem_context);
316
  ExplainPlanPB AnalysisResultToPB() override;
317
318
  // Execution opcode.
319
53.6M
  virtual TreeNodeOpcode opcode() const override {
320
53.6M
    return TreeNodeOpcode::kPTSelectStmt;
321
53.6M
  }
322
323
766
  virtual void SetOrderByClause(PTOrderByListNode::SharedPtr order_by_clause) {
324
766
    order_by_clause_ = order_by_clause;
325
766
  }
326
327
577
  virtual void SetLimitClause(PTExprPtr limit_clause) {
328
577
    limit_clause_ = limit_clause;
329
577
  }
330
331
577
  virtual void SetOffsetClause(PTExprPtr offset_clause) {
332
577
    offset_clause_ = offset_clause;
333
577
  }
334
335
7.60M
  bool distinct() const {
336
7.60M
    return distinct_;
337
7.60M
  }
338
339
7.46M
  bool is_forward_scan() const {
340
7.46M
    return is_forward_scan_;
341
7.46M
  }
342
343
29.6M
  const PTExprPtr& limit() const {
344
29.6M
    return limit_clause_;
345
29.6M
  }
346
347
15.0M
  const PTExprPtr& offset() const {
348
15.0M
    return offset_clause_;
349
15.0M
  }
350
351
7.91M
  const MCList<PTExprPtr>& selected_exprs() const {
352
7.91M
    return selected_exprs_->node_list();
353
7.91M
  }
354
355
  // Returns table name.
356
781k
  virtual client::YBTableName table_name() const override {
357
    // CQL only allows one table at a time.
358
781k
    return from_clause_->element(0)->table_name();
359
781k
  }
360
361
  // Returns location of table name.
362
2.13k
  virtual const YBLocation& table_loc() const override {
363
2.13k
    return from_clause_->loc();
364
2.13k
  }
365
366
0
  PTOrderByListNode::SharedPtr order_by_clause() const {
367
0
    return order_by_clause_;
368
0
  }
369
370
14.9M
  bool is_aggregate() const {
371
14.9M
    return is_aggregate_;
372
14.9M
  }
373
374
286k
  const SelectScanInfo *select_scan_info() const {
375
286k
    return select_scan_info_;
376
286k
  }
377
378
45.1M
  const PTSelectStmt::SharedPtr& child_select() const {
379
45.1M
    return child_select_;
380
45.1M
  }
381
382
113k
  const TableId& index_id() const {
383
113k
    return index_id_;
384
113k
  }
385
386
8.45k
  bool covers_fully() const {
387
8.45k
    return covers_fully_;
388
8.45k
  }
389
390
  // Certain tables can be read by any authorized role specifically because they are being used
391
  // by the Cassandra driver:
392
  // system_schema.keyspaces
393
  // system_schema.columns
394
  // system_schema.tables
395
  // system.local
396
  // system.peers
397
  bool IsReadableByAllSystemTable() const;
398
399
  const std::shared_ptr<client::YBTable>& bind_table() const override;
400
401
7.94M
  const std::shared_ptr<client::YBTable>& table() const {
402
7.94M
    return PTDmlStmt::bind_table();
403
7.94M
  }
404
405
1.26k
  const MCVector<PTBindVar*> &bind_variables() const override {
406
1.26k
    return child_select_ ? 
child_select_->bind_variables()152
:
PTDmlStmt::bind_variables()1.10k
;
407
1.26k
  }
408
268k
  MCVector<PTBindVar*> &bind_variables() override {
409
268k
    return child_select_ ? 
child_select_->bind_variables()0
: PTDmlStmt::bind_variables();
410
268k
  }
411
412
712
  std::vector<int64_t> hash_col_indices() const override {
413
712
    return child_select_ ? 
child_select_->hash_col_indices()76
:
PTDmlStmt::hash_col_indices()636
;
414
712
  }
415
416
  // CQL does not have nested DML statement, but YugaByte processes INDEX query as a nested DML.
417
  // - Returns true by default for all SELECT nodes.
418
  // - Returns false for index query node nested inside SELECT node. Because the data from the
419
  //   INDEX nested node is used for another READ, it is not the top level READ node where all
420
  //   READ operations end.
421
  //     SELECT * FROM table WHERE primary_keys IN (SELECT primary_keys FROM index);
422
  //   The data from INDEX query (i.e. primary key) is used for another READ from PRIMARY table.
423
  // - There is one exception when nested node is promoted to become the top level READ node.
424
  //   Due to an optimization, when an INDEX fully-covers a SELECT statement, all data will be
425
  //   read from the INDEX.
426
  //     SELECT all-requested-data FROM <index>;
427
  //   In this case, the nested index node is the top treenode to query data from server. It is not
428
  //   the top level SELECT in this case.
429
29.7M
  bool IsTopLevelReadNode() const override {
430
29.7M
    return is_top_level_ || 
covers_fully_8.91k
;
431
29.7M
  }
432
433
15.5M
  bool IsWriteOp() const override {
434
15.5M
    return false;
435
15.5M
  }
436
437
 private:
438
  // Analyze the components of a SELECT.
439
  CHECKED_STATUS LookupIndex(SemContext *sem_context);
440
441
  // Analyze clauses.
442
  CHECKED_STATUS AnalyzeFromClause(SemContext *sem_context);
443
  CHECKED_STATUS AnalyzeSelectList(SemContext *sem_context);
444
  CHECKED_STATUS AnalyzeDistinctClause(SemContext *sem_context);
445
  CHECKED_STATUS AnalyzeLimitClause(SemContext *sem_context);
446
  CHECKED_STATUS AnalyzeOffsetClause(SemContext *sem_context);
447
  CHECKED_STATUS ConstructSelectedSchema();
448
449
  // Routines for analysis and choosing scan plan.
450
  CHECKED_STATUS AnalyzeReferences(SemContext *sem_context);
451
  CHECKED_STATUS AnalyzeIndexes(SemContext *sem_context, SelectScanSpec *scan_spec);
452
  CHECKED_STATUS AnalyzeOrderByClause(SemContext *sem_context,
453
                                      const TableId& index_id,
454
                                      bool *is_forward_scan);
455
  CHECKED_STATUS SetupScanPath(SemContext *sem_context, const SelectScanSpec& scan_spec);
456
457
  // --- The parser will decorate this node with the following information --
458
459
  // The following members represent different components of SELECT statement. However, Cassandra
460
  // doesn't support all of SQL syntax and semantics.
461
  //
462
  // SELECT [DISTINCT] <selected_exprs_>
463
  //   FROM      <from_clause_>
464
  //   WHERE     <where_clause_>
465
  //   GROUP BY  <group_by_clause_> HAVING <having_clause_>
466
  //   ORDER BY  <order_by_clause_>
467
  //   LIMIT     <limit_clause_>
468
  //   OFFSET    <offset_clause_>
469
  const bool distinct_ = false;
470
  const PTExprListNode::SharedPtr selected_exprs_;
471
  const PTTableRefListNode::SharedPtr from_clause_;
472
  const PTListNode::SharedPtr group_by_clause_;
473
  const PTListNode::SharedPtr having_clause_;
474
  PTOrderByListNode::SharedPtr order_by_clause_;
475
  PTExprPtr limit_clause_;
476
  PTExprPtr offset_clause_;
477
478
  // -- The semantic analyzer will decorate this node with the following information --
479
  // Collecting all expressions that are selected.
480
  MCVector<const PTExpr*> covering_exprs_;
481
482
  // Collecting all expressions that a chosen index must cover to process the statement.
483
  MCVector<const PTExpr*> filtering_exprs_;
484
485
  bool is_forward_scan_ = true;
486
  bool is_aggregate_ = false;
487
488
  // Child select statement. Currently only a select statement using an index (covered or uncovered)
489
  // has a child select statement to query an index.
490
  PTSelectStmt::SharedPtr child_select_;
491
492
  // For nested select from an index: the index id and whether it covers the query fully.
493
  TableId index_id_;
494
  bool covers_fully_ = false;
495
496
  // Name of all columns the SELECT statement is referenced. Similar to the list "column_refs_",
497
  // but this is a list of column names instead of column ids.
498
  MCSet<std::string> referenced_index_colnames_;
499
  SelectScanInfo *select_scan_info_ = nullptr;
500
501
  // Flag for a top level SELECT.
502
  // Although CQL does not have nested SELECT, YugaByte treats INDEX query as a nested DML.
503
  bool is_top_level_ = true;
504
};
505
506
}  // namespace ql
507
}  // namespace yb
508
509
#endif  // YB_YQL_CQL_QL_PTREE_PT_SELECT_H_