Wail Alkowaileet created ASTERIXDB-2531:
-------------------------------------------

             Summary: Normalized keys are ignored for optional fields
                 Key: ASTERIXDB-2531
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2531
             Project: Apache AsterixDB
          Issue Type: Improvement
            Reporter: Wail Alkowaileet


Normalized keys are not utilized when fields are optional.

 
{code:java}
SELECT uname, a
FROM Tweets t
GROUP BY t.user.name AS uname WITH a AS AVG(LENGTH(text))
ORDER BY a DESC
LIMIT 10
{code}
_AVG(LENGTH(text))_ should always return NULL/MISSING or DOUBLE (despite if 
_text_ is open or closed). It fails if text is not a string.

The issue is the *INormalizedKeyComputerFactory* does not know how to deal with 
MISSING/NULL. Supporting the normalized keys for sorting can improve the 
sorting time.

We might need to extend SQL++ to specify how to sort UNKNOWABLES:
{code:java}
SELECT uname, a
FROM Tweets t
GROUP BY t.user.name AS uname WITH a AS AVG(LENGTH(text))
ORDER BY a DESC (UNKNOWABLES (FIRST | LAST))?
LIMIT 10
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to