Skip to content
Snippets Groups Projects
Commit 32aa8823 authored by Simon Liu's avatar Simon Liu Committed by dutor
Browse files

Fixed an undefined behavior. (#1039)

2 Replace static_cast with dynamic_cast.
parent 431f2348
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,11 @@ Status FetchExecutor::prepareYield() { ...@@ -34,11 +34,11 @@ Status FetchExecutor::prepareYield() {
// such as YIELD 1+1, it has not type in schema, the type from the eval() // such as YIELD 1+1, it has not type in schema, the type from the eval()
colTypes_.emplace_back(nebula::cpp2::SupportedType::UNKNOWN); colTypes_.emplace_back(nebula::cpp2::SupportedType::UNKNOWN);
if (col->expr()->isAliasExpression()) { if (col->expr()->isAliasExpression()) {
colNames_.emplace_back(*static_cast<InputPropertyExpression*>(col->expr())->prop()); colNames_.emplace_back(*dynamic_cast<AliasPropertyExpression*>(col->expr())->prop());
continue; continue;
} else if (col->expr()->isTypeCastingExpression()) { } else if (col->expr()->isTypeCastingExpression()) {
// type cast // type cast
auto exprPtr = static_cast<TypeCastingExpression*>(col->expr()); auto exprPtr = dynamic_cast<TypeCastingExpression*>(col->expr());
colTypes_.back() = ColumnTypeToSupportedType(exprPtr->getType()); colTypes_.back() = ColumnTypeToSupportedType(exprPtr->getType());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment