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

Method GetValue

be/src/exprs/expr-test.cc:364–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362 virtual void TearDown() { pool_.Clear(); }
363
364 string GetValue(const string& expr, const ColumnType& expr_type,
365 bool expect_error = false) {
366 string stmt = "select " + expr;
367 vector<FieldSchema> result_types;
368 Status status = executor_->Exec(stmt, &result_types);
369 if (!status.ok()) {
370 EXPECT_TRUE(expect_error) << "stmt: " << stmt << "\nerror: " << status.GetDetail();
371 return "";
372 }
373 string result_row;
374 status = executor_->FetchResult(&result_row);
375 if (expect_error) {
376 EXPECT_FALSE(status.ok()) << "Expected error\nstmt: " << stmt;
377 return "";
378 }
379 EXPECT_TRUE(status.ok()) << "stmt: " << stmt << "\nerror: " << status.GetDetail();
380 string odbcType = TypeToOdbcString(expr_type.ToThrift());
381 // ColumnType cannot be BINARY, so STRING is used instead.
382 string expectedType =
383 result_types[0].type == "binary" ? "string" : result_types[0].type;
384 EXPECT_EQ(odbcType, expectedType) << expr;
385 return result_row;
386 }
387
388 template <typename T>
389 T ConvertValue(const string& value);

Callers 2

TEST_PFunction · 0.45

Calls 6

TypeToOdbcStringFunction · 0.85
GetDetailMethod · 0.80
ExecMethod · 0.45
okMethod · 0.45
FetchResultMethod · 0.45
ToThriftMethod · 0.45

Tested by

no test coverage detected