[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 updated TEIID-5296:
--------------------------------
Summary: With MongoDB, timestamp operations throw exceptions when called on null or missing values (was: With MongoDB, timestamp operations throw exceptions when called on null values)
> 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
>
> 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, 9 months
[JBoss JIRA] (TEIID-5296) With MongoDB, timestamp operations throw exceptions when called on null values
by Jan Martiska (JIRA)
[ https://issues.jboss.org/browse/TEIID-5296?page=com.atlassian.jira.plugin... ]
Jan Martiska commented on TEIID-5296:
-------------------------------------
Hm, I noticed that the {{$type}} function is not available before MongoDB 3.4 so the exact transformation I added as example might not be usable for us (we need to support 3.0).
Alternative solution compatible with 3.0 would be:
{noformat}
db.test1.aggregate([
{
$project : {
HOURNOTMISSING: { $ifNull: [ "$DATEVALUE", null ] } // while this looks silly, it also transforms missing values to null values, that's what we need
}
},
{
$project : {
hour: { $cond:
[ { $eq: [ "$HOURNOTMISSING", null ] }, null, { $hour: "$HOURNOTMISSING" } ]
}
}
}
])
{noformat}
Hm, that's really getting ugly.
> With MongoDB, timestamp operations throw exceptions when called on null 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
>
> 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, 9 months
[JBoss JIRA] (TEIID-5296) With MongoDB, timestamp operations throw exceptions when called on null values
by Jan Martiska (JIRA)
[ https://issues.jboss.org/browse/TEIID-5296?page=com.atlassian.jira.plugin... ]
Jan Martiska updated TEIID-5296:
--------------------------------
Affects Version/s: 8.12.11.6_4
> With MongoDB, timestamp operations throw exceptions when called on null 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
>
> 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, 9 months
[JBoss JIRA] (TEIID-5296) With MongoDB, timestamp operations throw exceptions when called on null values
by Jan Martiska (JIRA)
Jan Martiska created TEIID-5296:
-----------------------------------
Summary: With MongoDB, timestamp operations throw exceptions when called on null values
Key: TEIID-5296
URL: https://issues.jboss.org/browse/TEIID-5296
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Reporter: Jan Martiska
Assignee: Steven Hawkins
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, 9 months
[JBoss JIRA] (TEIID-5295) Comparisons of timestamps don't work correctly for MongoDB
by Jan Martiska (JIRA)
Jan Martiska created TEIID-5295:
-----------------------------------
Summary: Comparisons of timestamps don't work correctly for MongoDB
Key: TEIID-5295
URL: https://issues.jboss.org/browse/TEIID-5295
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.11.6_4
Reporter: Jan Martiska
Assignee: Steven Hawkins
Examples of queries which don't behave as expected when running against MongoDB:
{noformat}
SELECT BQT1.SmallA.TimeValue FROM BQT1.SmallA WHERE BQT1.SmallA.TimeValue > '17:00:00'
{noformat}
returns ALL timevalues which are not null
{noformat}
SELECT BQT1.SmallA.TimeValue FROM BQT1.SmallA WHERE BQT1.SmallA.TimeValue < '17:00:00'
{noformat}
returns NO timevalues even though there are some less than 17:00
{noformat}
SELECT BQT1.SmallA.TimeValue FROM BQT1.SmallA WHERE BQT1.SmallA.TimeValue = '15:00:00'
{noformat}
returns nothing
{noformat}
SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA WHERE BQT1.SmallA.TimeValue IN (convert('05:00:00', time), convert('15:00:00', time))
{noformat}
returns nothing
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months
[JBoss JIRA] (TEIID-5294) Bug with the name correction logic (TEIID30151 eror)
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-5294?page=com.atlassian.jira.plugin... ]
Work on TEIID-5294 started by Steven Hawkins.
---------------------------------------------
> Bug with the name correction logic (TEIID30151 eror)
> ----------------------------------------------------
>
> Key: TEIID-5294
> URL: https://issues.jboss.org/browse/TEIID-5294
> Project: Teiid
> Issue Type: Bug
> Components: VDB
> Affects Versions: 10.1.2
> Reporter: Andreas Krück
> Assignee: Steven Hawkins
>
> Error message "TEIID30151 Error building Source for context item" when calling SQL statement on VDB connected to REST service:
> 13:13:24,572 WARN [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue1728) TEIID30020 Processing exception for request ikch7WEdCSyt.10 'TEIID30151 Error building Source for context item.'. Originally TeiidProcessingException '12' XMLSystemFunctions.java:911.: org.teiid.core.TeiidProcessingException: TEIID30151 Error building Source for context item.
> at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:148)
> at org.teiid.query.processor.relational.XMLTableNode$1.run(XMLTableNode.java:269)
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:284)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Caused by: nu.xom.ParsingException: 12
> at nu.xom.Builder.build(Unknown Source)
> at nu.xom.Builder.build(Unknown Source)
> at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:142)
> ... 7 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 12
> at org.teiid.query.function.source.XMLSystemFunctions.escapeName(XMLSystemFunctions.java:911)
> at org.teiid.query.function.source.XMLSystemFunctions$JsonToXmlContentHandler.startObjectEntry(XMLSystemFunctions.java:226)
> at org.teiid.json.simple.JSONParser.parse(JSONParser.java:232)
> at org.teiid.query.function.source.XMLSystemFunctions$JsonToXmlContentHandler.nextEvent(XMLSystemFunctions.java:351)
> at org.teiid.query.xquery.saxon.XMLEventStreamReader.next(XMLEventStreamReader.java:194)
> at net.sf.saxon.evpull.StaxToEventBridge.next(StaxToEventBridge.java:159)
> at net.sf.saxon.evpull.EventStackIterator.next(EventStackIterator.java:61)
> at net.sf.saxon.evpull.EventIteratorToReceiver.copy(EventIteratorToReceiver.java:44)
> at net.sf.saxon.event.Sender.sendPullEventSource(Sender.java:559)
> at net.sf.saxon.event.Sender.send(Sender.java:132)
> at net.sf.saxon.Configuration.buildDocument(Configuration.java:3361)
> at net.sf.saxon.Configuration.buildDocument(Configuration.java:3303)
> at org.teiid.query.xquery.saxon.SaxonReader.parse(StreamingUtils.java:179)
> ... 10 more
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months
[JBoss JIRA] (TEIID-5294) Bug with the name correction logic (TEIID30151 eror)
by Andreas Krück (JIRA)
Andreas Krück created TEIID-5294:
------------------------------------
Summary: Bug with the name correction logic (TEIID30151 eror)
Key: TEIID-5294
URL: https://issues.jboss.org/browse/TEIID-5294
Project: Teiid
Issue Type: Bug
Components: VDB
Affects Versions: 10.1.2
Reporter: Andreas Krück
Assignee: Barry LaFond
Error message "TEIID30151 Error building Source for context item" when calling SQL statement on VDB connected to REST service:
13:13:24,572 WARN [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue1728) TEIID30020 Processing exception for request ikch7WEdCSyt.10 'TEIID30151 Error building Source for context item.'. Originally TeiidProcessingException '12' XMLSystemFunctions.java:911.: org.teiid.core.TeiidProcessingException: TEIID30151 Error building Source for context item.
at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:148)
at org.teiid.query.processor.relational.XMLTableNode$1.run(XMLTableNode.java:269)
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:284)
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: nu.xom.ParsingException: 12
at nu.xom.Builder.build(Unknown Source)
at nu.xom.Builder.build(Unknown Source)
at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:142)
... 7 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 12
at org.teiid.query.function.source.XMLSystemFunctions.escapeName(XMLSystemFunctions.java:911)
at org.teiid.query.function.source.XMLSystemFunctions$JsonToXmlContentHandler.startObjectEntry(XMLSystemFunctions.java:226)
at org.teiid.json.simple.JSONParser.parse(JSONParser.java:232)
at org.teiid.query.function.source.XMLSystemFunctions$JsonToXmlContentHandler.nextEvent(XMLSystemFunctions.java:351)
at org.teiid.query.xquery.saxon.XMLEventStreamReader.next(XMLEventStreamReader.java:194)
at net.sf.saxon.evpull.StaxToEventBridge.next(StaxToEventBridge.java:159)
at net.sf.saxon.evpull.EventStackIterator.next(EventStackIterator.java:61)
at net.sf.saxon.evpull.EventIteratorToReceiver.copy(EventIteratorToReceiver.java:44)
at net.sf.saxon.event.Sender.sendPullEventSource(Sender.java:559)
at net.sf.saxon.event.Sender.send(Sender.java:132)
at net.sf.saxon.Configuration.buildDocument(Configuration.java:3361)
at net.sf.saxon.Configuration.buildDocument(Configuration.java:3303)
at org.teiid.query.xquery.saxon.SaxonReader.parse(StreamingUtils.java:179)
... 10 more
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months