You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Bruno Dumon (JIRA)" <ji...@apache.org> on 2014/03/18 11:28:42 UTC
[jira] [Created] (PHOENIX-867) Support length and scale parameters
for CAST
Bruno Dumon created PHOENIX-867:
-----------------------------------
Summary: Support length and scale parameters for CAST
Key: PHOENIX-867
URL: https://issues.apache.org/jira/browse/PHOENIX-867
Project: Phoenix
Issue Type: Improvement
Reporter: Bruno Dumon
PHOENIX-853 made the phoenix sql parser recognize length and scale arguments to sql types in cast statements, thus you can do things like:
{noformat}
select cast(city as varchar(10)) from ...
{noformat}
However, while the parser doesn't stumble over them, these arguments are not yet enforced.
First thing to do is to figure out the required behavior:
* for varchar it is cutting of the string at the specified length
* for numbers: not sure yet
* not to forget either: char and arrays
The implementation is basically: ExpressionCompiler should pass on length&scale to CoerceExpression, which in turn should pass them on to PDataType.coerceBytes().
Then in coerceBytes, we should enforce the parameters, but for performance reasons we should try to do this only when really necessary.
Note that most expression evaluation in Phoenix happens directly on byte arrays, cfr. e.g. LengthFunction and SubstrFunction.
--
This message was sent by Atlassian JIRA
(v6.2#6252)