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

Method TestDecimalResultType

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

Verify that output of 'query' has the same precision and scale as 'expected_type'. 'query' is an expression, optionally followed by a from clause which is needed for testing aggregate expressions.

Source from the content-addressed store, hash-verified

604 // 'query' is an expression, optionally followed by a from clause which is needed
605 // for testing aggregate expressions.
606 void TestDecimalResultType(const string& query, const ColumnType& expected_type) {
607 // For the case with from clause, we need to generate the "typeof query" by first
608 // extracting the select list.
609 size_t from_offset = query.find("from");
610 string typeof_query;
611 if (from_offset != string::npos) {
612 int query_len = query.length();
613 typeof_query = "typeof(" + query.substr(0, from_offset) + ")" +
614 query.substr(from_offset, query_len - from_offset);
615 } else {
616 typeof_query = "typeof(" + query + ")";
617 }
618 const string typeof_result = GetValue(typeof_query, ColumnType(TYPE_STRING));
619 EXPECT_EQ(expected_type.DebugString(), typeof_result) << typeof_query;
620 }
621
622 // Decimals don't work with TestValue.
623 // TODO: figure out what operators need to be implemented to work with EXPECT_EQ

Callers

nothing calls this directly

Calls 5

substrMethod · 0.80
ColumnTypeClass · 0.50
findMethod · 0.45
lengthMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected