From f958526560eb4a34eba53e0bbe959b7b2d929d66 Mon Sep 17 00:00:00 2001 From: nooberfsh Date: Sun, 2 Jan 2022 15:52:52 +0800 Subject: [PATCH] support empty array expression in presto --- dialects/presto/src/Database/Sql/Presto/Parser.hs | 2 +- test/Database/Sql/Presto/Parser/Test.hs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dialects/presto/src/Database/Sql/Presto/Parser.hs b/dialects/presto/src/Database/Sql/Presto/Parser.hs index 6b4b709..84485fc 100644 --- a/dialects/presto/src/Database/Sql/Presto/Parser.hs +++ b/dialects/presto/src/Database/Sql/Presto/Parser.hs @@ -948,7 +948,7 @@ arrayPrimaryExprP :: Parser (Expr RawNames Range) arrayPrimaryExprP = do r <- Tok.arrayP _ <- Tok.openBracketP - exprs <- exprP `sepBy1` Tok.commaP + exprs <- exprP `sepBy` Tok.commaP r' <- Tok.closeBracketP return $ ArrayExpr (r <> r') exprs diff --git a/test/Database/Sql/Presto/Parser/Test.hs b/test/Database/Sql/Presto/Parser/Test.hs index fe03b4e..4b92f61 100644 --- a/test/Database/Sql/Presto/Parser/Test.hs +++ b/test/Database/Sql/Presto/Parser/Test.hs @@ -119,6 +119,7 @@ testParser = test , "SELECT CURRENT_TIME(1);" , "SELECT CURRENT_DATE;" , "SELECT ARRAY[1+1, LOCALTIME];" + , "SELECT ARRAY[];" , "SELECT CAST(NULL AS BIGINT);" , "SELECT TRY_CAST(NULL AS BIGINT);" , "SELECT TRY_CAST(NULL AS BIGINT ARRAY);"