[ 
https://issues.apache.org/jira/browse/CALCITE-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-970:
--------------------------------
    Description: 
We have not specified what Calcite does if you do not specify NULLS FIRST or 
NULLS LAST. The policy seems to have been to always sort nulls first, but was 
not consistent (see CALCITE-969).

Now Calcite will treat nulls as HIGH by default. That means NULLS LAST is 
assumed for ASC, NULLS FIRST is assumed for DESC. This is the same behavior as 
Oracle.

If a project does not like this behavior, they can change the new parameter 
"defaultNullCollation", which allows alternative policies. Its value is defined 
by {code}enum NullCollation { LOW, HIGH, FIRST, LAST }{code}.

The "defaultNullCollation" parameter only applies to user SQL. If you create a 
RelFieldCollation via RelBuilder or directly, and do not specify a 
NullDirection value, you will get HIGH semantics. We used to use 
NullDirection.UNSPECIFIED quite widely in RelNode land, and now it is very 
rarely used, except with Direction.CLUSTERED.

> If NULLS FIRST/LAST not specified, sort NULL values HIGH
> --------------------------------------------------------
>
>                 Key: CALCITE-970
>                 URL: https://issues.apache.org/jira/browse/CALCITE-970
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> We have not specified what Calcite does if you do not specify NULLS FIRST or 
> NULLS LAST. The policy seems to have been to always sort nulls first, but was 
> not consistent (see CALCITE-969).
> Now Calcite will treat nulls as HIGH by default. That means NULLS LAST is 
> assumed for ASC, NULLS FIRST is assumed for DESC. This is the same behavior 
> as Oracle.
> If a project does not like this behavior, they can change the new parameter 
> "defaultNullCollation", which allows alternative policies. Its value is 
> defined by {code}enum NullCollation { LOW, HIGH, FIRST, LAST }{code}.
> The "defaultNullCollation" parameter only applies to user SQL. If you create 
> a RelFieldCollation via RelBuilder or directly, and do not specify a 
> NullDirection value, you will get HIGH semantics. We used to use 
> NullDirection.UNSPECIFIED quite widely in RelNode land, and now it is very 
> rarely used, except with Direction.CLUSTERED.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to