[JBoss JIRA] (TEIID-5296) With MongoDB, timestamp operations throw exceptions when called on null or missing values
by Jan Martiska (JIRA)
[ https://issues.jboss.org/browse/TEIID-5296?page=com.atlassian.jira.plugin... ]
Jan Martiska commented on TEIID-5296:
-------------------------------------
[~shawkins], FYI what you mention in your last comment doesn't seem to work for MongoDB 3.2 and 3.4 (works with 3.6), for missing values I'm still getting an error with 3.2 and 3.4:
{noformat}
> db.test1.drop()
true
> db.test1.insertMany([
... { _id: 1, timestamp: ISODate("1999-12-31T23:05:11Z")},
... { _id: 2}
... ])
{ "acknowledged" : true, "insertedIds" : [ 1, 2 ] }
> db.test1.aggregate([
... {
... $project : {
... hour: { $cond : [ { "$eq" : [ "$timestamp" , null ]} , null , { "$hour" : [ "$timestamp"]}]}
... }
... }
... ])
assert: command failed: {
"ok" : 0,
"errmsg" : "can't convert from BSON type missing to Date",
"code" : 16006,
"codeName" : "Location16006"
} : aggregate failed
{noformat}
So if we decide to backport this to JDV (which supports 3.2/3.4) at some point, we would probably need to first substitute missing values with nulls, as I suggested in the first comment, or find a different solution.
> With MongoDB, timestamp operations throw exceptions when called on null or missing values
> -----------------------------------------------------------------------------------------
>
> Key: TEIID-5296
> URL: https://issues.jboss.org/browse/TEIID-5296
> Project: Teiid
> Issue Type: Bug
> Components: Misc. Connectors
> Affects Versions: 8.12.11.6_4
> Reporter: Jan Martiska
> Assignee: Steven Hawkins
> Fix For: 10.3, 10.1.3, 10.0.5, 10.2.1
>
>
> When a query contains timestamp operations like {{DAYOFMONTH}}, {{DAYOFWEEK}},.. and these are executed when some cells contain null (or missing field), MongoDB throws an exception. This exception is not handled by Teiid in any way and will fail the whole VDB query:
> {noformat}
> Remote com.mongodb.CommandFailureException:
> { "serverUsed" : "localhost:27017" ,
> "ok" : 0.0 , "errmsg" : "can't convert from BSON type null to Date" ,
> "code" : 16006 , "
> codeName" : "Location16006"}
> {noformat}
> Perhaps Teiid could work around this somehow so that the VDB query will not fail and affected cells will contain null in the result?
> For example, this Mongo aggregation pipeline which extracts hours from timestamps:
> {noformat}
> db.collection.aggregate([
> {
> $project : {
> hour: {$hour: "$DATEVALUE"}
> }
> }
> ])
> {noformat}
> could be transformed to this:
> {noformat}
> db.collection.aggregate([
> {
> $project : {
> hour: { $cond:
> [ { $or: [
> { $eq: [ "$DATEVALUE", null ] },
> { $eq: [ { $type: "$DATEVALUE" }, "missing" ] }
> ]
> },
> null,
> { $hour: "$DATEVALUE" }
> ]
> }
> }
> }
> ])
> {noformat}
> after this transformation, the {{hour}} field will be null as expected for documents where {{DATEVALUE}} is null or missing completely
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (TEIID-5326) SAP IQ timestamp conversion to varchar wrong resulting format
by Johnathon Lee (JIRA)
[ https://issues.jboss.org/browse/TEIID-5326?page=com.atlassian.jira.plugin... ]
Johnathon Lee updated TEIID-5326:
---------------------------------
Fix Version/s: 8.12.13.6_4
> SAP IQ timestamp conversion to varchar wrong resulting format
> -------------------------------------------------------------
>
> Key: TEIID-5326
> URL: https://issues.jboss.org/browse/TEIID-5326
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 8.12.13.6_4
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
> Fix For: 10.3, 10.2.1, 8.12.13.6_4, 10.1.4
>
>
> Following Teiid query:
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM BQT1.SmallA
> {code}
> is pushed as:
> {code:sql}
> SELECT g_0."timestampvalue" AS c_0, lcase(stuff(stuff(convert(varchar, g_0."timestampvalue", 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, g_0."timestampvalue", 8)) AS c_1 FROM "bqt-server"."dvqe"."SmallA" AS g_0
> {code}
> and returns the string representation of timestamp as:
> 2000-01-0100:00:00
> 2000-01-0100:00:01
> ...
> Notice the missing space between date and time part.
> SAP IQ is capable of converting the value implicitly, e.g. when I issue query
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM SmallA
> {code}
> directly against SAP IQ instance, I get following string format:
> 2000-01-01 00:00:00.000
> 2000-01-01 00:00:01.000
> ....
> The same results are returned if I use an explicit convert like:
> {code:sql}
> SELECT TimeStampValue, LOWER(CONVERT(varchar,TimeStampValue,121)) FROM SmallA
> {code}
> For more formatting options see [SyBooks Online|http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.info...]
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (TEIID-5327) Add support to push timestampadd to oracle
by Debbie Steigner (JIRA)
Debbie Steigner created TEIID-5327:
--------------------------------------
Summary: Add support to push timestampadd to oracle
Key: TEIID-5327
URL: https://issues.jboss.org/browse/TEIID-5327
Project: Teiid
Issue Type: Enhancement
Components: XML Planner/Processor
Affects Versions: 8.12.12.6_4
Reporter: Debbie Steigner
Assignee: Steven Hawkins
Add pushdown support for timestampadd function to Oracle.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (TEIID-5326) SAP IQ timestamp conversion to varchar wrong resulting format
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-5326?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-5326.
-----------------------------------
Fix Version/s: 10.3
10.1.4
10.2.1
Resolution: Done
Correct the sybase iq (using the explicit convert format shown) and the sybase translator (using a space) timestamp to string conversion logic. Also added a simpler timestamp conversion for newer versions of sybase.
> SAP IQ timestamp conversion to varchar wrong resulting format
> -------------------------------------------------------------
>
> Key: TEIID-5326
> URL: https://issues.jboss.org/browse/TEIID-5326
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 8.12.13.6_4
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
> Fix For: 10.3, 10.1.4, 10.2.1
>
>
> Following Teiid query:
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM BQT1.SmallA
> {code}
> is pushed as:
> {code:sql}
> SELECT g_0."timestampvalue" AS c_0, lcase(stuff(stuff(convert(varchar, g_0."timestampvalue", 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, g_0."timestampvalue", 8)) AS c_1 FROM "bqt-server"."dvqe"."SmallA" AS g_0
> {code}
> and returns the string representation of timestamp as:
> 2000-01-0100:00:00
> 2000-01-0100:00:01
> ...
> Notice the missing space between date and time part.
> SAP IQ is capable of converting the value implicitly, e.g. when I issue query
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM SmallA
> {code}
> directly against SAP IQ instance, I get following string format:
> 2000-01-01 00:00:00.000
> 2000-01-01 00:00:01.000
> ....
> The same results are returned if I use an explicit convert like:
> {code:sql}
> SELECT TimeStampValue, LOWER(CONVERT(varchar,TimeStampValue,121)) FROM SmallA
> {code}
> For more formatting options see [SyBooks Online|http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.info...]
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (TEIID-5326) SAP IQ timestamp conversion to varchar wrong resulting format
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-5326?page=com.atlassian.jira.plugin... ]
Work on TEIID-5326 started by Steven Hawkins.
---------------------------------------------
> SAP IQ timestamp conversion to varchar wrong resulting format
> -------------------------------------------------------------
>
> Key: TEIID-5326
> URL: https://issues.jboss.org/browse/TEIID-5326
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 8.12.13.6_4
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
>
> Following Teiid query:
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM BQT1.SmallA
> {code}
> is pushed as:
> {code:sql}
> SELECT g_0."timestampvalue" AS c_0, lcase(stuff(stuff(convert(varchar, g_0."timestampvalue", 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, g_0."timestampvalue", 8)) AS c_1 FROM "bqt-server"."dvqe"."SmallA" AS g_0
> {code}
> and returns the string representation of timestamp as:
> 2000-01-0100:00:00
> 2000-01-0100:00:01
> ...
> Notice the missing space between date and time part.
> SAP IQ is capable of converting the value implicitly, e.g. when I issue query
> {code:sql}
> SELECT TimeStampValue, LOWER(TimeStampValue) FROM SmallA
> {code}
> directly against SAP IQ instance, I get following string format:
> 2000-01-01 00:00:00.000
> 2000-01-01 00:00:01.000
> ....
> The same results are returned if I use an explicit convert like:
> {code:sql}
> SELECT TimeStampValue, LOWER(CONVERT(varchar,TimeStampValue,121)) FROM SmallA
> {code}
> For more formatting options see [SyBooks Online|http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.info...]
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months