[
https://issues.apache.org/jira/browse/CALCITE-6817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17925840#comment-17925840
]
ZheHu commented on CALCITE-6817:
--------------------------------
I re-test your PR around testUnnestRow(), for the following case.
actualType.toString() results in "RecordType(INTEGER EXPR$0, CHAR(5) EXPR$1)".
However, if you use actualType.digest, you will get "RecordType(INTEGER NOT
NULL EXPR$0, CHAR(5) EXPR$1) NOT NULL".
{code:java}
sql("with orders(data) as\n"
+ " (values (ARRAY[ARRAY[ROW(1, 'Alice'), ROW(2, NULL)], NULL]))\n"
+ "select e.*\n"
+ "from orders, UNNEST(orders.data[1]) as e")
.type(actualType -> {
// The inner array that is unnested is nullable in this example
assertThat(actualType, hasToString("RecordType(INTEGER EXPR$0,
CHAR(5) EXPR$1)"));
assertTrue(actualType.isStruct());
assertThat(actualType.getFieldList().get(0).getType().isNullable(),
is(false));
assertTrue(actualType.getFieldList().get(1).getType().isNullable());
});
{code}
> 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)