Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-4977

sum(expression) 转换数据类型出现错误

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • v3.0.0
    • Future
    • Query Engine
    • None

    Description

      问题1: 使用 sum case when 的时候,数据类型转换报错:

      SQL:" select unit_code, sum(case when task_type='11' then amount else 0 end ) amount1, sum(case when task_type='12' then amount else 0 end ) amount2 from im_tasks group by unit_code"

      amount 是double类型,sum(amount)也是double,在查询时报错:

      java.math.BigDecimal cannot be cast to java.lang.Double while executing SQL

       

      问题2:加了强制转换类型,执行后超时了:

      SQL:" select unit_code, sum(case when task_type='11' then amount else cast('0.0' as double) end ) amount1, sum(case when task_type='12' then amount else cast('0.0' as double) end ) amount2 from im_tasks group by unit_code"

      在查询时报错:

      Coprocessor passed deadline! Maybe server is overloaded as ……

      Attachments

        Activity

          People

            Unassigned Unassigned
            irisking603 陈虹
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: