MCPcopy Create free account
hub / github.com/apache/impala / Init

Method Init

be/src/exec/hbase/hbase-table-writer.cc:57–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 runtime_profile_(profile) { }
56
57Status HBaseTableWriter::Init(RuntimeState* state) {
58 RETURN_IF_ERROR(ExecEnv::GetInstance()->htable_factory()->GetTable(
59 table_desc_->table_name(), &table_));
60 encoding_timer_ = ADD_TIMER(runtime_profile_, "EncodingTimer");
61 htable_put_timer_ = ADD_TIMER(runtime_profile_, "HTablePutTimer");
62
63 int num_col = table_desc_->num_cols();
64 if (num_col < 2) {
65 return Status("HBase tables must contain at least"
66 " one column in addition to the row key.");
67 }
68
69 JNIEnv* env = JniUtil::GetJNIEnv();
70 if (env == NULL) return Status("Error getting JNIEnv.");
71 output_exprs_byte_sizes_.resize(num_col);
72 cf_arrays_.reserve(num_col - 1);
73 qual_arrays_.reserve(num_col - 1);
74 for (int i = 0; i < num_col; ++i) {
75 output_exprs_byte_sizes_[i] =
76 output_expr_evals_[i]->root().type().GetByteSize();
77
78 if (i == 0) continue;
79
80 // Setup column family and qualifier byte array for non-rowkey column
81 const HBaseTableDescriptor::HBaseColumnDescriptor& col = table_desc_->cols()[i];
82 jbyteArray byte_array;
83 jbyteArray global_ref;
84 RETURN_IF_ERROR(CreateByteArray(env, col.family, &byte_array));
85 RETURN_IF_ERROR(JniUtil::LocalToGlobalRef(env, byte_array, &global_ref));
86 cf_arrays_.push_back(global_ref);
87 RETURN_IF_ERROR(CreateByteArray(env, col.qualifier, &byte_array));
88 RETURN_IF_ERROR(JniUtil::LocalToGlobalRef(env, byte_array, &global_ref));
89 qual_arrays_.push_back(global_ref);
90 }
91
92 return Status::OK();
93}
94
95Status HBaseTableWriter::InitJNI() {
96 JNIEnv* env = JniUtil::GetJNIEnv();

Callers 2

GetNextMethod · 0.45
PrepareMethod · 0.45

Calls 13

OKFunction · 0.85
GetTableMethod · 0.80
htable_factoryMethod · 0.80
num_colsMethod · 0.80
resizeMethod · 0.80
reserveMethod · 0.80
GetByteSizeMethod · 0.80
rootMethod · 0.80
push_backMethod · 0.80
StatusClass · 0.70
table_nameMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected