asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (ASTERIXDB-1876) UDF fails in select statement in SQL++
Date Fri, 07 Apr 2017 22:28:42 GMT

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

Yingyi Bu edited comment on ASTERIXDB-1876 at 4/7/17 10:28 PM:
---------------------------------------------------------------

[~idleft]  we just need to check if projections are null - if so it's select * and then you
don't do anything in SqlppInlineUdfsVisitor.visit(SelectRegular selectRegular, List<FunctionDecl>
funcs).


>> `select udf( * ) from ...` 

That should be rejected at the parser, even in standard SQL.  You can only have COUNT( * )
-- no other functions can call * as a parameter.


was (Author: buyingyi):
[~idleft]  we just need to check if projections are null - if so it's select * and then you
don't do anything in SqlppInlineUdfsVisitor.visit(SelectRegular selectRegular, List<FunctionDecl>
funcs).

>> `select udf(*) from ...` 

That should be rejected at the parser, even in standard SQL.  You can only have COUNT(*) --
no other functions can call * as a parameter.

> UDF fails in select statement in SQL++
> --------------------------------------
>
>                 Key: ASTERIXDB-1876
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1876
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Steven Jacobs
>            Assignee: Xikui Wang
>
> drop dataverse channels if exists;
> create dataverse channels;
> use channels;
> create type UserLocation as closed {
> 	recordId: integer,
> 	userName: string
> }
> create dataset UserLocations(UserLocation)
> primary key recordId;
> create function RecentEmergenciesNearUser(userName) {  
>   (SELECT r AS report
>   FROM EmergencyReports r, UserLocations l
>   where l.userName = userName 
>   and spatial_intersect(r.location,l.location))
> }
> select *
> from channels.UserLocations location,
> channels.RecentEmergenciesNearUser(location.userName) result;
> Stack Trace:
> java.lang.NullPointerException
> 	at org.apache.asterix.lang.common.visitor.AbstractInlineUdfsVisitor.inlineUdfsInExpr(AbstractInlineUdfsVisitor.java:265)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:122)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.clause.Projection.accept(Projection.java:45)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:178)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.clause.SelectRegular.accept(SelectRegular.java:40)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:162)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.clause.SelectClause.accept(SelectClause.java:42)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:152)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.struct.SetOperationInput.accept(SetOperationInput.java:56)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:186)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.clause.SelectSetOperation.accept(SelectSetOperation.java:47)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:201)
> 	at org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor.visit(SqlppInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.sqlpp.expression.SelectExpression.accept(SelectExpression.java:55)
> 	at org.apache.asterix.lang.common.visitor.AbstractInlineUdfsVisitor.inlineUdfsInExpr(AbstractInlineUdfsVisitor.java:266)
> 	at org.apache.asterix.lang.common.visitor.AbstractInlineUdfsVisitor.visit(AbstractInlineUdfsVisitor.java:91)
> 	at org.apache.asterix.lang.common.visitor.AbstractInlineUdfsVisitor.visit(AbstractInlineUdfsVisitor.java:1)
> 	at org.apache.asterix.lang.common.statement.Query.accept(Query.java:93)
> 	at org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter.inlineDeclaredUdfs(SqlppQueryRewriter.java:234)
> 	at org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter.rewrite(SqlppQueryRewriter.java:127)
> 	at org.apache.asterix.api.common.APIFramework.reWriteQuery(APIFramework.java:184)
> 	at org.apache.asterix.app.translator.QueryTranslator.rewriteCompileQuery(QueryTranslator.java:1803



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message