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 Wed, 12 Apr 2017 00:12:41 GMT

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

Yingyi Bu edited comment on ASTERIXDB-1876 at 4/12/17 12:12 AM:
----------------------------------------------------------------

[~dtabass]  it is a syntax error.

SELECT avg( * ) 
FROM [1, 2, 3] foo;

Syntax error: The parameter * can only be used in COUNT().


was (Author: buyingyi):
[~dtabass]  it is a syntax error.

SELECT avg(*) 
FROM [1, 2, 3] foo;

Syntax error: The parameter * can only be used in COUNT().

> 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