-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3036 from kuzudb/issue-3004
Fix issue-3004
- Loading branch information
Showing
27 changed files
with
185 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "binder/expression/literal_expression.h" | ||
|
||
#include "common/exception/binder.h" | ||
|
||
namespace kuzu { | ||
using namespace common; | ||
|
||
namespace binder { | ||
|
||
void LiteralExpression::cast(const LogicalType& type) { | ||
if (dataType.getLogicalTypeID() != LogicalTypeID::ANY) { | ||
// LCOV_EXCL_START | ||
throw BinderException( | ||
stringFormat("Cannot change literal expression data type from {} to {}.", | ||
dataType.toString(), type.toString())); | ||
// LCOV_EXCL_STOP | ||
} | ||
dataType = type; | ||
value->setDataType(type); | ||
} | ||
|
||
} // namespace binder | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "binder/expression/parameter_expression.h" | ||
|
||
#include "common/exception/binder.h" | ||
|
||
namespace kuzu { | ||
using namespace common; | ||
|
||
namespace binder { | ||
|
||
void ParameterExpression::cast(const LogicalType& type) { | ||
if (dataType.getLogicalTypeID() != LogicalTypeID::ANY) { | ||
// LCOV_EXCL_START | ||
throw BinderException( | ||
stringFormat("Cannot change parameter expression data type from {} to {}.", | ||
dataType.toString(), type.toString())); | ||
// LCOV_EXCL_STOP | ||
} | ||
dataType = type; | ||
value->setDataType(type); | ||
} | ||
|
||
} // namespace binder | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
add_library( | ||
kuzu_binder_visitor | ||
OBJECT | ||
default_type_solver.cpp | ||
property_collector.cpp) | ||
|
||
set(ALL_OBJECT_FILES | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "binder/visitor/default_type_solver.h" | ||
|
||
using namespace kuzu::common; | ||
|
||
namespace kuzu { | ||
namespace binder { | ||
|
||
static void resolveAnyType(Expression& expr) { | ||
if (expr.getDataType().getLogicalTypeID() != LogicalTypeID::ANY) { | ||
return; | ||
} | ||
expr.cast(*LogicalType::STRING()); | ||
} | ||
|
||
void DefaultTypeSolver::visitProjectionBody(const BoundProjectionBody& projectionBody) { | ||
for (auto& expr : projectionBody.getProjectionExpressions()) { | ||
resolveAnyType(*expr); | ||
} | ||
for (auto& expr : projectionBody.getOrderByExpressions()) { | ||
resolveAnyType(*expr); | ||
} | ||
} | ||
|
||
} // namespace binder | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.