[ 
https://issues.apache.org/jira/browse/CALCITE-1684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15902568#comment-15902568
 ] 

Kevin Liew edited comment on CALCITE-1684 at 3/9/17 6:38 AM:
-------------------------------------------------------------

Phoenix has a limit of 2147483647 for {{VARCHAR}} and {{VARBINARY}} when 
specifying the precision.
{noformat}
VARCHAR ( precisionInt )
{noformat}

https://phoenix.apache.org/language/datatypes.html#varchar_type
https://phoenix.apache.org/language/index.html#int

In Calcite, we will report {{RelDataType.PRECISION_NOT_SPECIFIED}} which is 
{{-1}}. In Phoenix, we will convert that value to 2147483647 when getting 
column metadata. Does that sound correct?

[~jamestaylor], if we do not specify the precision, is the string length 
unbounded (despite the max specifiable precision being 2147483647)? And in that 
case, Phoenix would have the same behavior as Calcite and print -1 for 
{{COLUMN_SIZE}} metadata?



was (Author: kliew):
Phoenix has a limit of 2147483647 for {{VARCHAR}} and {{VARBINARY}} when 
specifying the precision.
{noformat}
VARCHAR ( precisionInt )
{noformat}

https://phoenix.apache.org/language/datatypes.html#varchar_type
https://phoenix.apache.org/language/index.html#int

In Calcite, we will report {{RelDataType.PRECISION_NOT_SPECIFIED}} which is 
{{-1}}. In Phoenix, we will convert that value to 2147483647 when getting 
column metadata. Does that sound correct?

[~jamestaylor], if we do not specify the precision, is the string length 
unbounded (despite the max specifiable precision being 2147483647)? And in that 
case, we would print -1 for {{COLUMN_SIZE}} metadata?


> Set the precision for VARCHAR and VARBINARY to the maximum value when not 
> specified
> -----------------------------------------------------------------------------------
>
>                 Key: CALCITE-1684
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1684
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.11.0
>            Reporter: Kevin Liew
>            Assignee: Julian Hyde
>            Priority: Minor
>
> The behavior for Calcite (and SQL Server) is to set {{VARCHAR}} precision to 
> {{1}} when not specified whereas Phoenix sets the max integer value of 
> {{2147483647}}.
> It doesn't really make sense to create a {{VARCHAR}} for a max length of 
> {{1}} (it takes more bytes to store the length of each row than the actual 
> value) and it shouldn't be the default behavior. I think we should adopt the 
> Phoenix behavior. Do we need to make this configurable via SqlConformance or 
> other?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to