[teiid-issues] [JBoss JIRA] (TEIID-5672) When using DateTime datatype with millisecond fractions, i.e DateTime(3) the resulting urls for the records are invalid

Christoph John (Jira) issues at jboss.org
Tue Mar 5 07:44:01 EST 2019


    [ https://issues.jboss.org/browse/TEIID-5672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13703590#comment-13703590 ] 

Christoph John edited comment on TEIID-5672 at 3/5/19 7:43 AM:
---------------------------------------------------------------

Hello Ramesh, 
seems like we narrowed down the bug. But this one looks very weired.

Testscenario is again with DateTime(3). I am querying the generated url from browser. 

https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-05T12:06:21.995Z)

Then I extract queries from logfile and execute from mysql workbench console.

The logfile with  "org.teiid.COMMAND_LOG" is set to TRACE. Logfile is attached to this comment.  As I have not found a log statement with "source-specific" I tried all queries that have been given in the output. The queries given in the logfile on line 14, 17 and 39 are correct and are working from the mysql console. However, the query at line 18 is not.
Query:

sourceCommand=[S        ELECT g_0.`fkProfile` AS c_0, g_0.`AddedDateTime` AS c_1, g_0.`fkIdCode` AS c_2, g_0.`product_name` AS c_3, g_0.`brands` AS c_4, g_0.`DatabaseID` AS c_5, g_0.`MealNumber` AS c_6, g_0.`AmountInG` AS c_        7 FROM `Diary` AS g_0 WHERE g_0.`fkProfile` IN (SELECT g_1.`idProfile` FROM `Account` AS g_1 WHERE g_1.`uuidUser` = ?) AND g_0.`fkProfile` = 2 AND g_0.`AddedDateTime` = {ts '2019-03-05 12:06:21.0'} OR        DER BY c_0, c_1]

The error in this line is the part of the statement 

'uuidUser'= ?

There should not be a ? but the UUID as in the two other sql queries. So this seems weird, as this has nothing to do with  fraction accuracy of the DateTime object. So if the statement at line 18 is the relevant one from the log we found the problem. Is this enough info for you to narrow down the problem? If you need more let me know what you need.
Thanks for your help!



was (Author: cjohn001):
Hello Ramesh, 
seems like we narrowed down the bug. But this one looks very weired.

Testscenario is again with DateTime(3). I am querying the generated url from browser. 

https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-05T12:06:21.995Z)

Then I extract queries from logfile and execute from mysql workbench console.

The logfile with  "org.teiid.COMMAND_LOG" is set to TRACE. Logfile is attached to this comment.  As I have not found a log statement with "source-specific" I tried all queries that have been given in the output. The queries given in the logfile on line 14 and 17 are correct and are working from the mysql console. However, the query at line 18 is not.
Query:

sourceCommand=[S        ELECT g_0.`fkProfile` AS c_0, g_0.`AddedDateTime` AS c_1, g_0.`fkIdCode` AS c_2, g_0.`product_name` AS c_3, g_0.`brands` AS c_4, g_0.`DatabaseID` AS c_5, g_0.`MealNumber` AS c_6, g_0.`AmountInG` AS c_        7 FROM `Diary` AS g_0 WHERE g_0.`fkProfile` IN (SELECT g_1.`idProfile` FROM `Account` AS g_1 WHERE g_1.`uuidUser` = ?) AND g_0.`fkProfile` = 2 AND g_0.`AddedDateTime` = {ts '2019-03-05 12:06:21.0'} OR        DER BY c_0, c_1]

The error in this line is the part of the statement 

'uuidUser'= ?

There should not be a ? but the UUID as in the two other sql queries. So this seems weird, as this has nothing to do with  fraction accuracy of the DateTime object. So if the statement at line 18 is the relevant one from the log we found the problem. Is this enough info for you to narrow down the problem? If you need more let me know what you need.
Thanks for your help!


> When using DateTime datatype with millisecond fractions, i.e DateTime(3) the resulting urls for the records are invalid
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: TEIID-5672
>                 URL: https://issues.jboss.org/browse/TEIID-5672
>             Project: Teiid
>          Issue Type: Bug
>    Affects Versions: 11.2.1
>         Environment: Docker Container
>            Reporter: Christoph John
>            Assignee: Steven Hawkins
>            Priority: Major
>         Attachments: Bildschirmfoto 2019-03-04 um 20.47.19.png, logfile4.txt
>
>
> I am using a composite key based on a BIGINT and a DATETIME(3) value. The URLs which Teiid generates are invalid in this case. When using DATETIME(0) the links or ok. Example of generated record structure
> {code:java}
> <a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" m:context="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/$metadata#Diary">
> <a:id>
> https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary
> </a:id>
> <a:entry>
> <a:id>
> https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)
> </a:id>
> <a:title/>
> <a:summary/>
> <a:updated>2019-03-03T17:53:52Z</a:updated>
> <a:author>
> <a:name/>
> </a:author>
> <a:link rel="edit" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)"/>
> <a:link rel="http://docs.oasis-open.org/odata/ns/related/fkDiaryToAccount" title="fkDiaryToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)/fkDiaryToAccount"/>
> <a:link rel="http://docs.oasis-open.org/odata/ns/related/fkDiaryToFDBProducts" title="fkDiaryToFDBProducts" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)/fkDiaryToFDBProducts"/>
> <a:link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/fkDiaryToAccount" title="fkDiaryToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)/fkDiaryToAccount/$ref"/>
> <a:link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/fkDiaryToFDBProducts" title="fkDiaryToFDBProducts" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)/fkDiaryToFDBProducts/$ref"/>
> <a:category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#svc.1.my_nutri_diary.Diary"/>
> <a:content type="application/xml">
> <m:properties>
> <d:fkProfile m:type="Int64">2</d:fkProfile>
> <d:AddedDateTime m:type="DateTimeOffset">2019-03-03T17:53:12.676Z</d:AddedDateTime>
> <d:fkIdCode m:type="Int64">1772</d:fkIdCode>
> <d:product_name>Mélange fruits secs</d:product_name>
> <d:brands>Agrosourcing</d:brands>
> <d:DatabaseID m:type="Int16">0</d:DatabaseID>
> <d:MealNumber>5</d:MealNumber>
> <d:AmountInG m:type="Double">100.0</d:AmountInG>
> <d:Calories m:type="Double">0.0</d:Calories>
> <d:ProteinsInG m:type="Double">-1.0</d:ProteinsInG>
> <d:CarbohydratesInG m:type="Double">-1.0</d:CarbohydratesInG>
> <d:SugarsInG m:type="Double">-1.0</d:SugarsInG>
> <d:FatsInG m:type="Double">-1.0</d:FatsInG>
> <d:SaturatedFatsInG m:type="Double">-1.0</d:SaturatedFatsInG>
> <d:SaltsInG m:type="Double">-1.0</d:SaltsInG>
> <d:Diarycol m:null="true"/>
> </m:properties>
> </a:content>
> </a:entry>
> {code}
> When I navigate to 
> https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary(fkProfile=2,AddedDateTime=2019-03-03T17:53:12.676Z)
> I get HTTP ERROR 404 page not found. Note: I replaced ":"with "%3A" (urlencode) in the url which was required to work with the DateTime(0) primary keys. But this did not help either.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)



More information about the teiid-issues mailing list