Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DataStreamSink.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.planner;
16 
17 import com.cloudera.impala.thrift.TDataSink;
18 import com.cloudera.impala.thrift.TDataSinkType;
19 import com.cloudera.impala.thrift.TDataStreamSink;
20 import com.cloudera.impala.thrift.TExplainLevel;
21 import com.google.common.base.Preconditions;
22 
26 public class DataStreamSink extends DataSink {
27  private final ExchangeNode exchNode_;
29 
30  public DataStreamSink(ExchangeNode exchNode, DataPartition partition) {
31  Preconditions.checkNotNull(exchNode);
32  Preconditions.checkNotNull(partition);
33  exchNode_ = exchNode;
34  outputPartition_ = partition;
35  }
36 
37  @Override
38  public String getExplainString(String prefix, String detailPrefix,
39  TExplainLevel detailLevel) {
40  StringBuilder output = new StringBuilder();
41  output.append(
42  String.format("%sDATASTREAM SINK [FRAGMENT=%s, EXCHANGE=%s, %s]",
43  prefix, exchNode_.getFragment().getId().toString(),
45  return output.toString();
46  }
47 
48  @Override
49  protected TDataSink toThrift() {
50  TDataSink result = new TDataSink(TDataSinkType.DATA_STREAM_SINK);
51  TDataStreamSink tStreamSink =
52  new TDataStreamSink(exchNode_.getId().asInt(), outputPartition_.toThrift());
53  result.setStream_sink(tStreamSink);
54  return result;
55  }
56 
58 }
String getExplainString(String prefix, String detailPrefix, TExplainLevel detailLevel)
DataStreamSink(ExchangeNode exchNode, DataPartition partition)