Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-6114

Incorrect type deduction causing analysis exception to be thrown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 2.10.0, Impala 2.11.0
    • Impala 2.11.0
    • Frontend
    • None
    • Ubuntu 16.04, OS independent
    • ghx-label-3

    Description

      The SELECT statement

      SELECT DISTINCT CAST(0 AS DECIMAL(14)) AS foo, 0 AS bar FROM t;

      fails with the following exception:

      ERROR: AnalysisException: Possible loss of precision for target table 'default.t'.
      Expression '0' (type: DECIMAL(14,0)) would need to be cast to INT for column 'bar'

      The query succeeds if we remove the DISTINCT constraint.

      The exception stack trace follows:

      I1026 15:54:53.231101 17398 jni-util.cc:211] org.apache.impala.common.AnalysisException: Possible loss of precision for target table 'default.t'.
      Expression '0' (type: DECIMAL(14,0)) would need to be cast to INT for column 'bar'
      at org.apache.impala.analysis.StatementBase.checkTypeCompatibility(StatementBase.java:190)
      at org.apache.impala.analysis.InsertStmt.prepareExpressions(InsertStmt.java:674)
      at org.apache.impala.analysis.InsertStmt.analyze(InsertStmt.java:383)
      at org.apache.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:418)
      at org.apache.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:369)
      at org.apache.impala.service.Frontend.analyzeStmt(Frontend.java:900)
      at org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1049)
      at org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:156)
      I1026 15:54:53.269991 17398 status.cc:122] AnalysisException: Possible loss of precision for target table 'default.t'.
      Expression '0' (type: DECIMAL(14,0)) would need to be cast to INT for column 'bar'
      @ 0x1598f53 impala::Status::Status()
      @ 0x1993a5e impala::JniUtil::GetJniExceptionMsg()
      @ 0x1843e50 impala::JniUtil::CallJniMethod<>()
      @ 0x1840325 impala::Frontend::GetExecRequest()
      @ 0x1860fca impala::ImpalaServer::ExecuteInternal()
      @ 0x1860b12 impala::ImpalaServer::Execute()
      @ 0x18cd0b6 impala::ImpalaServer::query()
      @ 0x1df8ca0 beeswax::BeeswaxServiceProcessor::process_query()
      @ 0x1df89ee beeswax::BeeswaxServiceProcessor::dispatchCall()
      @ 0x1de11e9 impala::ImpalaServiceProcessor::dispatchCall()
      @ 0x153fb5c apache::thrift::TDispatchProcessor::process()
      @ 0x170eecd apache::thrift::server::TAcceptQueueServer::Task::run()
      @ 0x170ada7 impala::ThriftThread::RunRunnable()
      @ 0x170c4b3 boost::_mfi::mf2<>::operator()()
      @ 0x170c349 boost::_bi::list3<>::operator()<>()
      @ 0x170c095 boost::_bi::bind_t<>::operator()()
      @ 0x170bfa8 boost::detail::function::void_function_obj_invoker0<>::invoke()
      @ 0x171a89e boost::function0<>::operator()()
      @ 0x19f289b impala::Thread::SuperviseThread()
      @ 0x19fb42e boost::_bi::list4<>::operator()<>()
      @ 0x19fb371 boost::_bi::bind_t<>::operator()()
      @ 0x19fb334 boost::detail::thread_data<>::run()
      @ 0x20a698a thread_proxy
      @ 0x7f33eeb496ba start_thread
      @ 0x7f33ee87f3dd clone

      Attachments

        Issue Links

          Activity

            People

              zoram Zoram Thanga
              zoram Zoram Thanga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: