Xikui Wang created ASTERIXDB-1978:
-------------------------------------
Summary: Type inference exception after
RemoveUnusedAssignAndAggregateRule
Key: ASTERIXDB-1978
URL: https://issues.apache.org/jira/browse/ASTERIXDB-1978
Project: Apache AsterixDB
Issue Type: Bug
Reporter: Xikui Wang
The original exception is spotted in the BAD extension. However, with following
query running on AsterixDB, NullPointerException will be thrown during the
query optimization.
{noformat}
drop dataverse Starbucks if exists;
create dataverse Starbucks;
use Starbucks;
create type StarbucksType as {
id: string,
location: point
};
create type FollowersType as {
user_id: string,
twitter_id: string,
followers: [string]
};
create dataset Starbucks(StarbucksType)
primary key id
create dataset Followers(FollowersType)
primary key user_id
create type TwitterUser as closed {
id: int64,
id_str: string,
screen_name: string
};
create type Tweet as open {
id: int64,
user: TwitterUser,
timestamp_ms: string
}
create dataset Tweets (Tweet)
primary key id;
use Starbucks;
create function StarbucksFriends(userId) {
(select distinct tweet.user.screen_name, tweet.coordinates.coordinates,
tweet.timestamp_ms
from Tweets tweet join (
select w
from Followers f
unnest f.followers w
where f.user_id = userId
) id on tweet.user.id_str = id.w
where tweet.coordinates is not null and
(datetime_from_unix_time_in_ms(bigint(tweet.timestamp_ms)) > current_datetime()
- day_time_duration("PT24H"))
union all
select star.Starbucks
from (select distinct s as Starbucks
from Starbucks s, Tweets tweet, Followers follower
where tweet.coordinates is not null
and tweet.user.id_str = follower.twitter_id
and follower.user_id = userId
and
spatial_intersect(create_circle(create_point(tweet.coordinates.coordinates[0],
tweet.coordinates.coordinates[1]), .01), create_circle(s.location, 5.0)))
star)};
use Starbucks;
create type SubType as open{
subscriptionId: int64,
BrokerName: string,
DataverseName: string,
param0: string
}
create type ResType as open {
id: int64
}
create dataset starsSubscriptions(SubType) primary key subscriptionId;
create dataset starsResults(ResType) primary key id;
use Starbucks;
SET inline_with "false"
insert into Starbucks.starsResults as a (
with channelExecutionTime as current_datetime()
select result, channelExecutionTime, sub.subscriptionId as
subscriptionId,current_datetime() as deliveryTime
from Starbucks.starsSubscriptions sub,
Metadata.Broker b,
Starbucks.StarbucksFriends(sub.param0) result
where b.BrokerName = sub.BrokerName
and b.DataverseName = sub.DataverseName
) returning a;
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)