Closed jwillemsen closed 3 years ago
This value shouldn't have single quotes in it, unless the intent is to compare to an actual single quote in the data sample:
param[0] = "'hello world'"; // NO
param[0] = "hello world"; // YES
The filter parameters themselves are strings, not expressions in the filter language. This is consistent with SQL usage.
My testing showed that with OpenDDS it should be "hello world"
but seems RTI requires "'hello world'"
which is very very annoying. I have also opened an issue at RTI to get their feedback on this.
See https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/api/connext_dds/api_cpp/group__DDSQueryAndFilterSyntaxModule.html for the RTI documentation, they clearly state that single quotes should be used around string parameters.
Is there a specific reason why OpenDDS decided to not use single quotes for strings, or is this an oversight?
OpenDDS is only based on the spec, not on RTI's implementation decisions. The spec doesn't have any requirement to treat the content of a filter parameter as a certain special kind of expression, it's just a string.
We opened an issue at RTI and an issue at the OMG for the DDS spec itself, this should be clear to users, the current mismatch between implementations makes portability of user code harder. I will update my PR to use "data_B"
If it needs to change in OpenDDS it could be controlled by an option that defaults to the current behavior. I'd rather not have to maintain that, but it should be a simple change to deal with locally. Discovery may be a bit more complex.
Looks OpenSplice also doesn't use the single quote, see https://github.com/ADLINK-IST/opensplice/blob/629d6bf19b0df658723d41a56b5452f43e97d065/examples/dcps/WaitSet/java/src/WaitSetDataSubscriber.java#L72. At the moment I have a concrete feedback from RTI I will add it here
This looks something to me that should be documented in the OpenDDS dev guide, add an example using a string and add a note that some other DDS vendors do require the single quotes, that is something anyone migrating from RTI to OpenDDS should be aware of.
RTI reported back that they also now find the specification ambiguous and that this should be addressed in the next DDS standard revision. When this becomes a bigger problems for the user code we should look at making the quoting an option. They have an internal issue with ID CORE-11236.
This looks something to me that should be documented in the OpenDDS dev guide, add an example using a string and add a note that some other DDS vendors do require the single quotes, that is something anyone migrating from RTI to OpenDDS should be aware of.
Yes, we can add to the DevGuide. All three Content Subscription features (query condition, content-filtered topic, multitopic) can use these parameters which the spec calls "query parameters" or "expression parameters" depending on the context -- but they're the same either way.
This is now in the Developer's Guide.
Thanks for adding this to the DevGuide
We identified a difference in how OpenDDS and RTI Connext DDS handle string parameters. When we have a query as
"name = %0"
where name is a string, should the string passed as query parameter for %0 be single quoted or not?RTI Connext DDS expects that the query parameter passed for %0 should have quotes, see https://community.rti.com/comment/5669#comment-5669 and https://community.rti.com/examples/polling-query-condition.
OpenDDS seems to expect that the query parameter passed for %0 should not have quotes, will create a PR with a test extension
The OMG DDS 1.4 specification says in B2 page 167 the following:
This difference is a challenge in writing portable user code, especially when the user shouldn't be aware of the concrete DDS vendor. Is there a specific reason why OpenDDS decided to not use single quotes for strings, or is this an oversight?