根据错误消息,问题出在对Int64和UInt64类型的处理上。您可以尝试将max(CAST(MergedViewCount AS Int64))改为toInt64(max(MergedViewCount)),以便将UInt64类型的值转换为Int64类型。修改后的查询如下所示:

SELECT 
  toStartOfDay(toDateTime(Ds)) AS datetime_day_Ds,
  AppIdentifier AS AppIdentifier,
  GREATEST(
    count(DISTINCT ViewContent2),
    toInt64(max(MergedViewCount))
  ) AS index_mergedviewcount_0
FROM log_iMonkey_iOS_overview
WHERE 
  (TotalDeviceTime NOT IN (-1) OR TotalDeviceTime IS NULL)
  AND (Ds >= toDateTime(#day_views_time.start#) AND Ds <= toDateTime(#day_views_time.end#))
GROUP BY datetime_day_Ds, AppIdentifier
ORDER BY datetime_day_Ds DESC, AppIdentifier DESC

UNION ALL

SELECT 
  toStartOfDay(toDateTime(Ds)) AS datetime_day_Ds,
  AppIdentifier AS AppIdentifier,
  sum(MergedViewCount) AS index_mergedviewcount_0
FROM log_iMonkey_Android_overview
WHERE 
  Ds >= toDateTime(#day_views_time.start#)
  AND Ds <= toDateTime(#day_views_time.end#)
  AND AppIdentifier != 'identifier'
GROUP BY datetime_day_Ds, AppIdentifier
ORDER BY datetime_day_Ds DESC, AppIdentifier DESC

请注意,这只是针对错误消息的推测,实际上的问题可能与此不同。如果问题仍然存在,请提供更多详细信息以便我们更好地帮助您

SELECT toStartOfDaytoDateTimeDs AS datetime_day_Ds AppIdentifier AS AppIdentifier -- sumMergedViewCount AS index_mergedviewcount_0 GREATEST countDISTINCT ViewContent2 maxCASTMergedViewCount

原文地址: https://www.cveoy.top/t/topic/iGAm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录