Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ShowDataSrcsStmt.java
Go to the documentation of this file.
1 // Copyright 2014 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // 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
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 package com.cloudera.impala.analysis;
16 
18 import com.cloudera.impala.thrift.TShowDataSrcsParams;
19 
28 public class ShowDataSrcsStmt extends StatementBase {
29  // Pattern to match tables against. | denotes choice, * matches all strings
30  private final String pattern_;
31 
36  public ShowDataSrcsStmt() {
37  this(null);
38  }
39 
44  public ShowDataSrcsStmt(String pattern) {
45  this.pattern_ = pattern;
46  }
47 
48  public String getPattern() { return pattern_; }
49 
50  @Override
51  public String toSql() {
52  if (pattern_ == null) {
53  return "SHOW DATA SOURCES";
54  } else {
55  return "SHOW DATA SOURCES LIKE '" + pattern_ + "'";
56  }
57  }
58 
59  @Override
60  public void analyze(Analyzer analyzer) throws AnalysisException {
61  // Nothing to do here
62  }
63 
64  public TShowDataSrcsParams toThrift() {
65  TShowDataSrcsParams params = new TShowDataSrcsParams();
66  params.setShow_pattern(getPattern());
67  return params;
68  }
69 }