Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
ShowStatsStmt.java
Go to the documentation of this file.
1
// Copyright 2012 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
17
import
com.cloudera.impala.authorization.Privilege
;
18
import
com.cloudera.impala.catalog.Table
;
19
import
com.cloudera.impala.catalog.View
;
20
import
com.cloudera.impala.common.AnalysisException
;
21
import
com.cloudera.impala.thrift.TShowStatsParams;
22
27
public
class
ShowStatsStmt
extends
StatementBase
{
28
protected
final
boolean
isShowColStats_
;
29
protected
final
TableName
tableName_
;
30
31
// Set during analysis.
32
protected
Table
table_
;
33
34
public
ShowStatsStmt
(
TableName
tableName,
boolean
isShowColStats) {
35
this.tableName_ = tableName;
36
this.isShowColStats_ = isShowColStats;
37
}
38
39
@Override
40
public
String
toSql
() {
41
return
getSqlPrefix
() +
" "
+ tableName_.toString();
42
}
43
44
protected
String
getSqlPrefix
() {
45
return
"SHOW "
+ ((
isShowColStats_
) ?
"COLUMN"
:
"TABLE"
) +
" STATS"
;
46
}
47
48
@Override
49
public
void
analyze
(
Analyzer
analyzer)
throws
AnalysisException
{
50
table_
= analyzer.getTable(
tableName_
,
Privilege.VIEW_METADATA
);
51
if
(
table_
instanceof
View
) {
52
throw
new
AnalysisException
(String.format(
53
"%s not applicable to a view: %s"
,
getSqlPrefix
(),
table_
.
getFullName
()));
54
}
55
}
56
57
public
TShowStatsParams
toThrift
() {
58
// Ensure the DB is set in the table_name field by using table and not tableName.
59
return
new
TShowStatsParams(
isShowColStats_
,
60
new
TableName
(
table_
.
getDb
().getName(),
table_
.
getName
()).
toThrift
());
61
}
62
}
com.cloudera.impala.catalog.Table
Definition:
Table.java:51
com.cloudera.impala.analysis.ShowStatsStmt.tableName_
final TableName tableName_
Definition:
ShowStatsStmt.java:29
com.cloudera.impala.catalog.View
Definition:
View.java:41
com.cloudera.impala.catalog.Table.getName
String getName()
Definition:
Table.java:342
com.cloudera.impala.analysis.ShowStatsStmt.isShowColStats_
final boolean isShowColStats_
Definition:
ShowStatsStmt.java:28
com.cloudera.impala.analysis.TableName
Definition:
TableName.java:33
com.cloudera.impala.common.AnalysisException
Definition:
AnalysisException.java:21
com.cloudera.impala.analysis.ShowStatsStmt.toThrift
TShowStatsParams toThrift()
Definition:
ShowStatsStmt.java:57
com.cloudera.impala.analysis.ShowStatsStmt
Definition:
ShowStatsStmt.java:27
com.cloudera.impala.analysis.StatementBase
Definition:
StatementBase.java:22
com.cloudera.impala.analysis.ShowStatsStmt.getSqlPrefix
String getSqlPrefix()
Definition:
ShowStatsStmt.java:44
com.cloudera.impala.authorization.Privilege
Definition:
Privilege.java:24
com.cloudera.impala.analysis.Analyzer
Definition:
Analyzer.java:105
com.cloudera.impala.analysis.ShowStatsStmt.ShowStatsStmt
ShowStatsStmt(TableName tableName, boolean isShowColStats)
Definition:
ShowStatsStmt.java:34
com.cloudera.impala.authorization.Privilege.VIEW_METADATA
VIEW_METADATA
Definition:
Privilege.java:32
com.cloudera.impala.catalog.Table.getDb
Db getDb()
Definition:
Table.java:341
com.cloudera.impala.analysis.ShowStatsStmt.table_
Table table_
Definition:
ShowStatsStmt.java:32
com.cloudera.impala.analysis.ShowStatsStmt.analyze
void analyze(Analyzer analyzer)
Definition:
ShowStatsStmt.java:49
com.cloudera.impala.analysis.ShowStatsStmt.toSql
String toSql()
Definition:
ShowStatsStmt.java:40
com.cloudera.impala.catalog.Table.getFullName
String getFullName()
Definition:
Table.java:343
fe
src
main
java
com
cloudera
impala
analysis
ShowStatsStmt.java
Generated on Thu May 7 2015 16:10:38 for Impala by
1.8.6