From 0f46c9c73b751ed6e9ed80b3fb5e124e2b6c5fc4 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Mon, 9 Mar 2026 13:02:42 +0100 Subject: [PATCH] Add documentation for SQL filter expression limits (#1224) * Refs #24181. Add properties in non-consolidated QoS. Signed-off-by: Miguel Company * Refs #24181. Add example. Signed-off-by: Miguel Company * Refs #24181. Add link from the filtering section. Signed-off-by: Miguel Company * Refs #24181. Fix doc8. Signed-off-by: Miguel Company * Refs #24181. Apply suggestions. Signed-off-by: Miguel Company --------- Signed-off-by: Miguel Company (cherry picked from commit 7bb4e28693c01533b3f6b7375648c94d682616d1) --- code/DDSCodeTester.cpp | 13 ++++++ code/XMLTester.xml | 28 ++++++++++++ .../contentFilteredTopic/defaultFilter.rst | 3 ++ .../non_consolidated_qos.rst | 43 +++++++++++++++++++ 4 files changed, 87 insertions(+) diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index 27b7206cc..8fc8322c0 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -995,6 +995,19 @@ void dds_domain_examples() "true"); // true or True or TRUE or 1 //!-- } + + { + // DDS_SQL_LIMITS_PROPERTY + DomainParticipantQos pqos; + + pqos.properties().properties().emplace_back( + "dds.sql.expression.max_expression_length", + "20000"); + pqos.properties().properties().emplace_back( + "dds.sql.expression.max_subexpressions", + "10"); + //!-- + } } //DOMAINPARTICIPANTLISTENER-DISCOVERY-CALLBACKS diff --git a/code/XMLTester.xml b/code/XMLTester.xml index 63617ba79..481fbd355 100644 --- a/code/XMLTester.xml +++ b/code/XMLTester.xml @@ -3317,6 +3317,34 @@ --> <--> +DDS_SQL_LIMITS_PROPERTY<--> + + + + + + + dds.sql.expression.max_expression_length + 20000 + + + dds.sql.expression.max_subexpressions + 10 + + + + + + +<--> + FASTDDS_STATISTICS_MODULE<--> diff --git a/docs/fastdds/dds_layer/topic/contentFilteredTopic/defaultFilter.rst b/docs/fastdds/dds_layer/topic/contentFilteredTopic/defaultFilter.rst index e413a4727..317eeb236 100644 --- a/docs/fastdds/dds_layer/topic/contentFilteredTopic/defaultFilter.rst +++ b/docs/fastdds/dds_layer/topic/contentFilteredTopic/defaultFilter.rst @@ -9,6 +9,9 @@ The default SQL-like filter Filter expressions used by :ref:`dds_layer_topic_contentFilteredTopic` API may use a subset of SQL syntax, extended with the possibility to use program variables in the SQL expression. This section shows this default SQL-like syntax and how to use it. +Apart from the syntax described in this section, certain restrictions apply to the allowed SQL expressions. +These restrictions can be relaxed or tightened by the user, as explained in +:ref:`properties_sql_filter_expression_limits`. * :ref:`default_sql_filter_grammar` * :ref:`default_sql_filter_like` diff --git a/docs/fastdds/property_policies/non_consolidated_qos.rst b/docs/fastdds/property_policies/non_consolidated_qos.rst index 3f4ceaf5e..a6f17fff2 100644 --- a/docs/fastdds/property_policies/non_consolidated_qos.rst +++ b/docs/fastdds/property_policies/non_consolidated_qos.rst @@ -543,3 +543,46 @@ The following table lists all the optional QoS that can be serialized in the dis :start-after: SERIALIZE_OPTIONAL_QOS_PROPERTY<--> :end-before: <--> :lines: 2-4,6-17,19-20 + +.. _properties_sql_filter_expression_limits: + +SQL Filter Expression limits +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When creating content-filtered topics using the +:ref:`default SQL-like filter `, some restrictions apply to the +SQL expressions that can be used for content-based filtering. +The default limits are set to values that should be enough for most use cases, but they can be customized using the +following properties when a participant is created: + +.. list-table:: + :header-rows: 1 + :align: left + + * - PropertyPolicyQos name + - PropertyPolicyQos value + - Default value + * - ``"dds.sql.expression.max_expression_length"`` + - Maximum length of the SQL expression, in characters. + - ``16384`` + * - ``"dds.sql.expression.max_subexpressions"`` + - Maximum number of sub-expressions in the SQL expression. + - ``256`` + +Creating content-filtered topics with expressions exceeding any of these limits will fail. +Expressions received in discovery messages exceeding any of these limits will be ignored, and filtering will happen +in the reader side. + +.. tab-set-code:: + + .. literalinclude:: /../code/DDSCodeTester.cpp + :language: c++ + :start-after: // DDS_SQL_LIMITS_PROPERTY + :end-before: //!-- + :dedent: 8 + + .. literalinclude:: /../code/XMLTester.xml + :language: xml + :start-after: DDS_SQL_LIMITS_PROPERTY<--> + :end-before: <--> + :lines: 2-4,6-21,23-24