Azure-Samples/MyDriving

Stream analytics mydriving-hourlypbi return 0 rows

macimauro opened this issue · 0 comments

Hi,
the job ourlypbi returns always 0 row. The select that cuts the rows is the

TripPointAgg as
(
SELECT
TripId,
UserId,
vin,
ts,
AVG(RawLat) as lat,
AVG(RawLong) as lon,
MIN(tsDiff) as lastRecTime,
MAX(tsDiff) as firstRecTime,
MIN(spd) as minSpeed,
MAX(spd) as maxSpeed,
AVG(spd) as avgSpeed,
AVG(engineLoad) as avgEngineLoad,
AVG(shortTermFuelBank) as avgShortTermFuelBank,
AVG(longTermFuelBank) as avgLongTermFuelBank,
MAX(enginerpm) as maxEngineRpm,
AVG(flowRate) as avgFlowRate,
AVG(throttlePos) as avgThrottlePos,
MAX(runtime) as maxRuntime,
MAX(distanceWithMIL) as maxDistanceWithMIL,
AVG(relativeThrottlePos) as avgRelativeThrottlePos,
AVG(outsideTemperature) as avgOutsideTemperature,
AVG(engineFuelRate) as avgEngineFuelRate
FROM
TripPointRaw
WHERE
ts is not null
GROUP BY
TripId,
UserId,
vin,
ts,
TumblingWindow(hour,1)
),
RoughDrivingStats as
(
SELECT
t1.TripId,
t1.UserId,
t1.lat,
t1.lon,
CASE
WHEN t3.spd - t2.spd > 50 THEN 2
WHEN t2.spd - t3.spd > 70 OR t1.maxSpeed - t1.minSpeed > 70 OR t1.maxSpeed - t1.avgSpeed > t1.avgSpeed - t1.minSpeed + 0.10*(t1.maxSpeed - t1.minSpeed) THEN 1
ELSE 0
END as POIType,
t1.ts,
t1.avgSpeed,
t1.minSpeed,
t1.maxSpeed,
t1.avgEngineLoad,
t1.avgShortTermFuelBank,
t1.avgLongTermFuelBank,
t1.maxEngineRpm,
t1.avgFlowRate,
t1.avgThrottlePos,
t1.maxRuntime,
t1.maxDistanceWithMIL,
t1.avgRelativeThrottlePos,
t1.avgOutsideTemperature,
t1.avgEngineFuelRate,
t3.spd as firstSpeed,
t2.spd as lastSpeed
FROM TripPointAgg t1
JOIN TripPointRaw t2
ON t1.TripId = t2.TripId and
t1.vin = t2.vin and
t1.ts = t2.ts and
t1.lastRecTime = t2.tsDiff and
DATEDIFF(minute,t1,t2) BETWEEN 0 and 0
JOIN TripPointRaw t3
ON t1.TripId = t3.TripId and
t1.vin = t3.vin and
t1.ts = t3.ts and
t1.firstRecTime = t3.tsDiff and
DATEDIFF(minute,t1,t3) BETWEEN 0 and 0
)

In attach the input dataset for the select resulting from sampled data.
Any suggestions?

Thanks, Mauro.