5 Replies Latest reply on Dec 18, 2014 8:00 AM by shawkins

    The modeled datatype x for column y doesn't match the runtime type z

    gadeyne.bram

      Hi,

       

      I have an issue in Teiid 8.9. This might be related to TEIID-3190.

       

      I get the following exception: TEIID20001 The modeled datatype timestamp for column 4 doesn't match the runtime type "java.lang.String". Please ensure that the column's modeled datatype matches the expected data.

       

      This is also the stack trace:

       

      16:05:36,176 ERROR [org.teiid.TRANSPORT] (New I/O worker #1) null TEIID40113 Unhandled exception, aborting operation: org.teiid.transport.ObjectEncoder$FailedWriteException: org.teiid.core.TeiidRuntimeException: TEIID20001 The modeled datatype timestamp for column 4 doesn't match the runtime type "java.lang.String". Please ensure that the column's modeled datatype matches the expected data.

       

              at org.teiid.transport.ObjectEncoder.handleDownstream(ObjectEncoder.java:136) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              at org.jboss.netty.channel.Channels.write(Channels.java:704) [netty-3.6.7.Final-redhat-1.jar:3.6.7.Final-redhat-1]

       

              at org.jboss.netty.channel.Channels.write(Channels.java:671) [netty-3.6.7.Final-redhat-1.jar:3.6.7.Final-redhat-1]

       

              at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) [netty-3.6.7.Final-redhat-1.jar:3.6.7.Final-redhat-1]

       

              at org.teiid.transport.SSLAwareChannelHandler$ObjectChannelImpl.write(SSLAwareChannelHandler.java:93) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.transport.SocketClientInstance.send(SocketClientInstance.java:87) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.transport.ServerWorkItem.sendResult(ServerWorkItem.java:135) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.transport.ServerWorkItem$1.onCompletion(ServerWorkItem.java:105) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.util.ResultsFuture.done(ResultsFuture.java:135) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.util.ResultsFuture.access$200(ResultsFuture.java:40) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.util.ResultsFuture$1.receiveResults(ResultsFuture.java:79) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.RequestWorkItem.sendResultsIfNeeded(RequestWorkItem.java:953) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.RequestWorkItem$1.flushBatchDirect(RequestWorkItem.java:647) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.query.processor.BatchCollector.flushBatch(BatchCollector.java:223) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:194) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:449) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:331) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:259) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:274) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) [teiid-engine-8.9.0.Final.jar:8.9.0.Final]

       

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]

       

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]

       

              at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

       

      Caused by: org.teiid.core.TeiidRuntimeException: TEIID20001 The modeled datatype timestamp for column 4 doesn't match the runtime type "java.lang.String". Please ensure that the column's modeled datatype matches the expected data.

       

              at org.teiid.client.BatchSerializer.writeBatch(BatchSerializer.java:851) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.ResultsMessage.writeExternal(ResultsMessage.java:319) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) [rt.jar:1.7.0_25]

       

              at org.teiid.net.socket.Message.writeExternal(Message.java:61) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) [rt.jar:1.7.0_25]

       

              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) [rt.jar:1.7.0_25]

       

              at org.teiid.transport.ObjectEncoder.handleDownstream(ObjectEncoder.java:131) [teiid-runtime-8.9.0.Final.jar:8.9.0.Final]

       

              ... 25 more

       

      Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Timestamp

       

              at org.teiid.client.BatchSerializer$TimestampColumnSerializer.writeObject(BatchSerializer.java:788) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.BatchSerializer$ColumnSerializer.writeColumn(BatchSerializer.java:506) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              at org.teiid.client.BatchSerializer.writeBatch(BatchSerializer.java:840) [teiid-client-8.9.0.Final.jar:8.9.0.Final]

       

              ... 36 more

       

      I'm not sure if I can create a working example to reproduce this.

       

      The problem seems to occur on some max() columns in my select statement with group by clause. I have 12 columns in my query. If I remove 4 of them, the query is executed.

       

      Is this message counting the columns from 0 or from 1? I'm not sure about this but it seems like the column that is indicated (counting from 1) is actually reported as beiing of type for the next columns. It always expects String...

        • 1. Re: The modeled datatype x for column y doesn't match the runtime type z
          shawkins

          > I have an issue in Teiid 8.9. This might be related to TEIID-3190.

           

          That should be specific to inserts with limit 0. 

           

          > Is this message counting the columns from 0 or from 1? I'm not sure about this but it seems like the column that is indicated (counting from 1) is actually reported as beiing of type for the next columns. It always expects String...

           

          This exception would be from 0.

           

          This is occurring on the write of data to the client and should indicate a planning or rewrite issue such that the original type of the projected column does not match what is coming out of processing.  Can you show the query / query plan?

          • 2. Re: Re: The modeled datatype x for column y doesn't match the runtime type z
            gadeyne.bram

            Hi Steven,

             

            I have a different case now and I'm wondering if they are related.

             

            I have a select statement that returns the following results:

             

            select case when p.admissionid is null then f.admissionid else p.admissionid end as admissionid,

                case when p.dag is null then f.dag else p.dag end as dag, p.peep, f.fio2 as fio2

                from #tmp_peep p

                full outer join #tmp_fio2 f on f.admissionid = p.admissionid and f.dag = p.dag

                where p.admissionid = 51368

             

            admissionid    dag    peep    fio2

            51368    2014-09-07    8    46

            51368    2014-09-08    10    40

            51368    2014-09-09    6    40

            51368    2014-09-10    6    70

            51368    2014-09-11    10    65

            51368    2014-09-12    10    45

            51368    2014-09-13    8    40

            51368    2014-09-14    6    40

            51368    2014-09-15    6    35

            51368    2014-09-16    6    35

             

            Now I have the following query:

             

            select f.admissionid, f.dag,

                case when min(f.peep) < 5 then

                    5

                else

                    case when min(f.peep) > 18 then

                        18

                    else min(f.peep)

                    end

                end

            as peep2, min(f.fio2) as fio22

            from (

                //select query that returns the table above...

            ) f

            group by f.admissionid, f.dag;

             

            Now for column peep2 everything seems fine, however, for columns fio22 the same content is returned ad for column peep2:

            admissionid    dag    peep2    fio22

            51368    2014-09-07    8    8

            51368    2014-09-08    10    10

            51368    2014-09-09    6    6

            51368    2014-09-10    6    6

            51368    2014-09-11    10    10

            51368    2014-09-12    10    10

            51368    2014-09-13    8    8

            51368    2014-09-14    6    6

            51368    2014-09-15    6    6

            51368    2014-09-16    6    6

             

            I've attached the debug log for this query. Maybe you can see something in it?

            • 3. Re: Re: The modeled datatype x for column y doesn't match the runtime type z
              shawkins

              Yes there is an issue with [TEIID-3119] Improve full sort performance for dup removal and grouping - JBoss Issue Tracker when we process the group by using a combined group/sort operation.  The indexing on the final aggregate value can get the wrong value.  Logged as [TEIID-3263] Invalid aggregate value - JBoss Issue Tracker

              • 4. Re: The modeled datatype x for column y doesn't match the runtime type z
                gadeyne.bram

                Hi Steven,

                 

                Great to see that this will be resolved in 8.10. Would it be possible to provide me with a 8.9 build that contains the fix? I could then test my cases to see if the problem is resolved.

                • 5. Re: The modeled datatype x for column y doesn't match the runtime type z
                  shawkins

                  We'll produce an 8.9.1 by early next week, an 8.10 Alpha2 by end of week, or you can build off of master.