Query Aggregation

7 posts / 0 new
Last post
Offline
Last seen: 1 year 7 months ago
Joined: 03/03/2022
Posts: 3
Query Aggregation

Is it possible to aggregate samples in the DataWriter cache with DDS? (SUM, AVG, MAX, MIN) I have looked into query conditions and topic queries. From the subset of supported SQL, it doesn't seem to be an option for query conditions or content filters, but I was wondering about topic queries. I have tried the multi-topic syntax with a single topic and it errors out, seems to only work with the where clause by itself.

SELECT * FROM 'MyTopic' WHERE field MATCH 'value'

It says unsupported in the docs for multi-topic queries, is that a future feature?

Thanks,

Adam

Howard's picture
Offline
Last seen: 1 day 2 hours ago
Joined: 11/29/2012
Posts: 565

Not sure what you mean by aggregate samples?

If you mean do calculations on the samples stored in a DataWriter cache and return the results, then no.

Also, if you are referring to the DDS Multitopic feature, no, that is not supported and there are no plans to support that feature.

I'm not sure what you mean by a "multi-topic syntax with a single topic".

Offline
Last seen: 1 year 7 months ago
Joined: 03/03/2022
Posts: 3

Yes, which would require some sort of meta sample, which may not make sense for DDS. Thanks for the clarification. So, only the contents of a where clause is supported. I also had issue getting ORDER BY working, so seems just a boolean filter statement is supported.

Multitopic syntax is at the bottom of this page: 

http://community.rti.com/rti-doc/510/ndds/doc/html/api_cpp/group__DDSQueryAndFilterSyntaxModule.html

 Thanks,

Adam

Howard's picture
Offline
Last seen: 1 day 2 hours ago
Joined: 11/29/2012
Posts: 565

Thanks for the link that shows the syntax of using Multitopics with an SQL query.

Unfortunately, that documentation page is showing the full documentation of the BNF grammer of a SQL query as per the OMG DDS specification...and not what Connext DDS supports...which is only a subset.

Since Connext DDS doesn't (and isn't going to) support DDS Multitopic, the SQL query syntax for Multitopics won't be supported either.

I think that "ORDER BY" should be supported by TopicQueries.  How is it not working for you?

I'll file an issue to ask for the documentation to be cleaned up to only discuss what is supported by Connext.

Offline
Last seen: 1 year 7 months ago
Joined: 03/03/2022
Posts: 3

When running the following query:

field MATCH %0 ORDER BY fieldName

I get:

DDS_SqlFiltererror:syntax error, unexpected FIELDNAMESTART, expecting $end or "OR" or "AND"

Howard's picture
Offline
Last seen: 1 day 2 hours ago
Joined: 11/29/2012
Posts: 565

What is the data type of the Topic that you're apply this too?  "field" and "fieldName" have to be the names of members of the data type.

NOTE:  DDS is not an RDBM...it is "borrowing" the syntax of SQL to do some very DDS-specific things...

Howard's picture
Offline
Last seen: 1 day 2 hours ago
Joined: 11/29/2012
Posts: 565

OOPS, so, "ORDER BY" is *not* supported.

Neither is the "SELECT" clause, so "FROM" and "WHERE" are also not accepted as keywords.  Neither is anything associated with "JOIN".

Fundamentally, all DDS is doing is using/borrowing the syntax of SQL to implement what is essentially the "WHERE" clause of an SQL statement (except you don't use the "WHERE" keyword).

In our next release, the documentation of the "SQL" statement will be cleaned up tremendously to drop all references to keywords that aren't supported as well as make it clear what DDS does (and importantly doesn't do) with SQL syntax.

Sorry for the confusion both in my previous post and in the current documentation!