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

ZheHu commented on CALCITE-6817:
--------------------------------

In RelDataTypeImpl.generateTypeString(StringBuilder sb, boolean withDetail), we 
can get type's full detail info by setting withDetail parameter, which is 
generated through computeDigest method. And whether type is null or not is 
added here.
For example, in PigRelExTest.testCast(), map keys and map values nullability is 
shown in RelNode:
{code:java}
checkTranslation("(map[]) b", inTree("CAST($1):(VARCHAR NOT NULL, BINARY(1) NOT 
NULL) MAP"))
{code}
[~mbudiu] I'm not sure this is satisfied for your context, and it will be 
better if you can give an example.

> Add string representation of default nulls direction for RelNode
> ----------------------------------------------------------------
>
>                 Key: CALCITE-6817
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6817
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: ZheHu
>            Assignee: ZheHu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.39.0
>
>
> Calcite has the same hehavior with Oracle on returning the null direction if 
> not specified, which means NULLS LAST is assumed for ASC and NULLS FIRST is 
> assumed for DESC.
> However, the default nulls direction is not presented in plan traces. For 
> example:
> {code:java}
> select empno from emp order by empno desc
> {code}
> has the following plan:
> {code:java}
> LogicalSort(sort0=[$0], dir0=[DESC])
>   LogicalProject(EMPNO=[$0])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> It makes RelNode clearer if adding nulls direction, so the above plan will be 
> like:
> {code:java}
> LogicalSort(sort0=[$0], dir0=[DESC-nulls-first])
>   LogicalProject(EMPNO=[$0])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to