Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5196

Osisoft Translator - Wrong data returned for some JOIN queries when integer and float columns are compared

    XMLWordPrintable

    Details

      Description

      When using equality comparison between an integer and float columns in a WHERE or ON clause, Teiid pushes it to Osisoft PI with both columns cast as double.

      There seems to be a bug in Osisoft PI which causes the non-positive float values in the result for such a query to be returned as NULL (or not at all).

      E.g.

      Teiid query

      SELECT BQT1.MediumA.IntNum, BQT1.MediumB.FloatNum 
      	FROM BQT1.MediumA 
      	FULL JOIN BQT1.MediumB 
      		ON BQT1.MediumA.IntNum = BQT1.MediumB.FloatNum 
      	WHERE 
      		BQT1.MediumA.IntNum >= -10 
      		AND BQT1.MediumA.IntNum < 5 
      		AND (BQT1.MediumB.FloatNum >= -10 
      		AND BQT1.MediumB.FloatNum < 5)
      

      is translated to

      Pushed Osisoft PI query

      SELECT g_0.IntNum, g_1.FloatNum
      	FROM dvqe..MediumA AS g_0, dvqe..MediumB AS g_1 
      	WHERE 
      		cast(g_0.IntNum AS Double) = cast(g_1.FloatNum AS Double)
      		AND g_0.IntNum < 5 
      		AND g_1.FloatNum >= -10.0
      		AND g_1.FloatNum < 5.0
      		AND g_0.IntNum >= -10
      

      which seems to be correct, but returns the wrong result:

      IntNum FloatNum
      1 1
      2 2
      3 3
      4 4

      Note that the only the positive values are returned, even though the criteria match also negative values (which are present in the source table).

      If the cast to double in the source query is removed (or replaced with cast to single), the query returns the expected results.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rareddy Ramesh Reddy
                Reporter:
                asmigala Andrej Šmigala
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: