You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2025/05/13 13:08:31 UTC

(camel) branch 22040-part-1 created (now ee6d6f72dcf)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch 22040-part-1
in repository https://gitbox.apache.org/repos/asf/camel.git


      at ee6d6f72dcf CAMEL-22040 - AWS-DDB: Support filter expressions in scan and query operation

This branch includes the following new commits:

     new ee6d6f72dcf CAMEL-22040 - AWS-DDB: Support filter expressions in scan and query operation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 01/01: CAMEL-22040 - AWS-DDB: Support filter expressions in scan and query operation

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch 22040-part-1
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ee6d6f72dcf63504ddec53d58c8b2ff626dc38d4
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue May 13 15:07:41 2025 +0200

    CAMEL-22040 - AWS-DDB: Support filter expressions in scan and query operation
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../apache/camel/catalog/components/aws2-ddb.json  |  5 ++-
 .../apache/camel/component/aws2/ddb/aws2-ddb.json  |  5 ++-
 .../camel/component/aws2/ddb/Ddb2Constants.java    |  9 +++++
 .../camel/component/aws2/ddb/QueryCommand.java     | 31 ++++++++++++++++++
 .../camel/component/aws2/ddb/ScanCommand.java      | 19 +++++++++++
 .../aws2/ddb/localstack/AWS2QueryRuleIT.java       | 37 +++++++++++++++++++++
 .../aws2/ddb/localstack/AWS2ScanRuleIT.java        | 38 ++++++++++++++++++++++
 .../endpoint/dsl/Ddb2EndpointBuilderFactory.java   | 38 ++++++++++++++++++++++
 8 files changed, 180 insertions(+), 2 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
index 26f67e97cfe..6d271bc7436 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
@@ -85,7 +85,10 @@
     "CamelAwsDdbUpdateCondition": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
     "CamelAwsDdbUpdateValues": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
     "CamelAwsDdbUnprocessedKeys": { "index": 30, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
-    "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" }
+    "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
+    "CamelAwsDdbFilterExpression": { "index": 32, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
+    "CamelAwsDdbFilterExpressionAttributeNames": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
+    "CamelAwsDdbFilterExpressionAttributeValues": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" }
   },
   "properties": {
     "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." },
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
index 26f67e97cfe..6d271bc7436 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
@@ -85,7 +85,10 @@
     "CamelAwsDdbUpdateCondition": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
     "CamelAwsDdbUpdateValues": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
     "CamelAwsDdbUnprocessedKeys": { "index": 30, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
-    "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" }
+    "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
+    "CamelAwsDdbFilterExpression": { "index": 32, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
+    "CamelAwsDdbFilterExpressionAttributeNames": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
+    "CamelAwsDdbFilterExpressionAttributeValues": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" }
   },
   "properties": {
     "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." },
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
index 10d6cc80360..8efabe29103 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
@@ -138,4 +138,13 @@ public interface Ddb2Constants {
     @Metadata(label = "UpdateTable DescribeTable", description = "WriteCapacityUnits property of this table.",
               javaType = "Long")
     String WRITE_CAPACITY = "CamelAwsDdbWriteCapacity";
+    @Metadata(label = "Query Scan", description = "The Filter Expression.",
+              javaType = "String")
+    String FILTER_EXPRESSION = "CamelAwsDdbFilterExpression";
+    @Metadata(label = "Query Scan", description = "The Filter Expression Attribute Names.",
+              javaType = "Map<String, String>")
+    String FILTER_EXPRESSION_ATTRIBUTE_NAMES = "CamelAwsDdbFilterExpressionAttributeNames";
+    @Metadata(label = "Query Scan", description = "The Filter Expression Attribute Values.",
+              javaType = "Map<String, String>")
+    String FILTER_EXPRESSION_ATTRIBUTE_VALUES = "CamelAwsDdbFilterExpressionAttributeValues";
 }
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
index 288b30e2d9b..27152496d4d 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.camel.Exchange;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
 import software.amazon.awssdk.services.dynamodb.model.Condition;
 import software.amazon.awssdk.services.dynamodb.model.QueryRequest;
 import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
@@ -50,6 +51,21 @@ public class QueryCommand extends AbstractDdbCommand {
             query.attributesToGet(determineAttributeNames());
         }
 
+        if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION) != null &&
+                !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class).isEmpty()) {
+            query.filterExpression(determineFilterExpression());
+        }
+
+        if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES) != null &&
+                !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class).isEmpty()) {
+            query.expressionAttributeNames(determineFilterExpressionAttributeNames());
+        }
+
+        if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES) != null &&
+                !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class).isEmpty()) {
+            query.expressionAttributeValues(determineFilterExpressionAttributeValues());
+        }
+
         QueryResponse result = ddbClient.query(query.build());
 
         Map<Object, Object> tmp = new HashMap<>();
@@ -68,4 +84,19 @@ public class QueryCommand extends AbstractDdbCommand {
     private Map<String, Condition> determineKeyConditions() {
         return exchange.getIn().getHeader(Ddb2Constants.KEY_CONDITIONS, Map.class);
     }
+
+    @SuppressWarnings("unchecked")
+    private String determineFilterExpression() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    private Map<String, String> determineFilterExpressionAttributeNames() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    private Map<String, AttributeValue> determineFilterExpressionAttributeValues() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
+    }
 }
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
index 61411a18de0..6e38f9d5998 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.camel.Exchange;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
 import software.amazon.awssdk.services.dynamodb.model.Condition;
 import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
 import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
@@ -37,6 +38,9 @@ public class ScanCommand extends AbstractDdbCommand {
         ScanResponse result = ddbClient.scan(ScanRequest.builder().tableName(determineTableName()).limit(determineLimit())
                 .exclusiveStartKey(determineExclusiveStartKey())
                 .attributesToGet(determineAttributesToGet())
+                .filterExpression(determineFilterExpression())
+                .expressionAttributeNames(determineFilterExpressionAttributeNames())
+                .expressionAttributeValues(determineFilterExpressionAttributeValues())
                 .scanFilter(determineScanFilter()).build());
 
         Map<Object, Object> tmp = new HashMap<>();
@@ -57,4 +61,19 @@ public class ScanCommand extends AbstractDdbCommand {
     private Collection<String> determineAttributesToGet() {
         return exchange.getIn().getHeader(Ddb2Constants.ATTRIBUTE_NAMES, Collection.class);
     }
+
+    @SuppressWarnings("unchecked")
+    private String determineFilterExpression() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    private Map<String, String> determineFilterExpressionAttributeNames() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    private Map<String, AttributeValue> determineFilterExpressionAttributeValues() {
+        return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
+    }
 }
diff --git a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2QueryRuleIT.java b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2QueryRuleIT.java
index c9cde61bde8..32eb80652de 100644
--- a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2QueryRuleIT.java
+++ b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2QueryRuleIT.java
@@ -149,6 +149,43 @@ public class AWS2QueryRuleIT extends Aws2DDBBase {
         assertEquals(3, exchange.getIn().getHeader(Ddb2Constants.COUNT));
     }
 
+    @Test
+    public void queryItemsWithFilterExpression() {
+
+        putItem(retrieveValue, "uno");
+        putItem(retrieveValue, "dos");
+        putItem(retrieveValue, "tres");
+        putItem(notRetrieveValue, "Ignore me");
+        putItem(notRetrieveValue, "I should not be returned");
+
+        Exchange exchange = template.send("direct:start", e -> {
+            e.getIn().setHeader(Ddb2Constants.OPERATION, Ddb2Operations.Scan);
+            e.getIn().setHeader(Ddb2Constants.CONSISTENT_READ, true);
+            Map<String, Condition> keyConditions = new HashMap<>();
+            keyConditions.put(attributeName, Condition.builder().comparisonOperator(
+                    ComparisonOperator.EQ.toString())
+                    .attributeValueList(AttributeValue.builder().s(retrieveValue).build())
+                    .build());
+            Collection<String> coll = new ArrayList<>();
+            coll.add("clave");
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION, "#v <> :num");
+            Map<String, AttributeValue> filterAttrValues = new HashMap<>();
+            filterAttrValues.put(":num", AttributeValue.builder().s("retrieve").build());
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.of("#v", "clave"));
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, filterAttrValues);
+        });
+
+        assertNotNull(exchange.getIn().getHeader(Ddb2Constants.ITEMS));
+        List<Map<String, AttributeValue>> items = exchange.getIn().getHeader(Ddb2Constants.ITEMS, List.class);
+        assertTrue(items.get(0).containsKey("clave"));
+        assertTrue(items.get(0).containsKey("secondary_attribute"));
+        assertTrue(items.get(0).get("clave").equals(AttributeValue.builder().s("ignore").build()));
+        assertTrue(items.get(1).containsKey("clave"));
+        assertTrue(items.get(1).get("clave").equals(AttributeValue.builder().s("ignore").build()));
+        assertTrue(items.get(1).containsKey("secondary_attribute"));
+        assertEquals(2, exchange.getIn().getHeader(Ddb2Constants.COUNT));
+    }
+
     private void putItem(String value1, String value2) {
         final Map<String, AttributeValue> attributeMap = new HashMap<>();
         attributeMap.put(attributeName, AttributeValue.builder().s(value1).build());
diff --git a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2ScanRuleIT.java b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2ScanRuleIT.java
index d8377109282..dfbe11e33f7 100644
--- a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2ScanRuleIT.java
+++ b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/localstack/AWS2ScanRuleIT.java
@@ -151,6 +151,44 @@ public class AWS2ScanRuleIT extends Aws2DDBBase {
         assertEquals(3, exchange.getIn().getHeader(Ddb2Constants.COUNT));
     }
 
+    @Test
+    public void scanWithAttributeToGetAndFilterExpression() {
+
+        putItem(notRetrieveValue, "0");
+        putItem(notRetrieveValue, "4");
+
+        putItem(retrieveValue, "1");
+        putItem(retrieveValue, "2");
+        putItem(retrieveValue, "3");
+
+        Exchange exchange = template.send("direct:start", e -> {
+            e.getIn().setHeader(Ddb2Constants.OPERATION, Ddb2Operations.Scan);
+            e.getIn().setHeader(Ddb2Constants.CONSISTENT_READ, true);
+            Map<String, Condition> keyConditions = new HashMap<>();
+            keyConditions.put(attributeName, Condition.builder().comparisonOperator(
+                    ComparisonOperator.EQ.toString())
+                    .attributeValueList(AttributeValue.builder().s(retrieveValue).build())
+                    .build());
+            Collection<String> coll = new ArrayList<>();
+            coll.add("clave");
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION, "#v <> :num");
+            Map<String, AttributeValue> filterAttrValues = new HashMap<>();
+            filterAttrValues.put(":num", AttributeValue.builder().s("retrieve").build());
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.of("#v", "clave"));
+            e.getIn().setHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, filterAttrValues);
+        });
+
+        assertNotNull(exchange.getIn().getHeader(Ddb2Constants.ITEMS));
+        List<Map<String, AttributeValue>> items = exchange.getIn().getHeader(Ddb2Constants.ITEMS, List.class);
+        assertTrue(items.get(0).containsKey("clave"));
+        assertTrue(items.get(0).containsKey("secondary_attribute"));
+        assertTrue(items.get(0).get("clave").equals(AttributeValue.builder().s("ignore").build()));
+        assertTrue(items.get(1).containsKey("clave"));
+        assertTrue(items.get(1).get("clave").equals(AttributeValue.builder().s("ignore").build()));
+        assertTrue(items.get(1).containsKey("secondary_attribute"));
+        assertEquals(2, exchange.getIn().getHeader(Ddb2Constants.COUNT));
+    }
+
     private void putItem(String value1, String value2) {
         final Map<String, AttributeValue> attributeMap = new HashMap<>();
         attributeMap.put(attributeName, AttributeValue.builder().s(value1).build());
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
index 4c7c378e2db..58535e28544 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
@@ -1130,6 +1130,44 @@ public interface Ddb2EndpointBuilderFactory {
         public String awsDdbWriteCapacity() {
             return "CamelAwsDdbWriteCapacity";
         }
+        /**
+         * The Filter Expression.
+         * 
+         * The option is a: {@code String} type.
+         * 
+         * Group: Query Scan
+         * 
+         * @return the name of the header {@code AwsDdbFilterExpression}.
+         */
+        public String awsDdbFilterExpression() {
+            return "CamelAwsDdbFilterExpression";
+        }
+        /**
+         * The Filter Expression Attribute Names.
+         * 
+         * The option is a: {@code Map<String, String>} type.
+         * 
+         * Group: Query Scan
+         * 
+         * @return the name of the header {@code
+         * AwsDdbFilterExpressionAttributeNames}.
+         */
+        public String awsDdbFilterExpressionAttributeNames() {
+            return "CamelAwsDdbFilterExpressionAttributeNames";
+        }
+        /**
+         * The Filter Expression Attribute Values.
+         * 
+         * The option is a: {@code Map<String, String>} type.
+         * 
+         * Group: Query Scan
+         * 
+         * @return the name of the header {@code
+         * AwsDdbFilterExpressionAttributeValues}.
+         */
+        public String awsDdbFilterExpressionAttributeValues() {
+            return "CamelAwsDdbFilterExpressionAttributeValues";
+        }
     }
     static Ddb2EndpointBuilder endpointBuilder(String componentName, String path) {
         class Ddb2EndpointBuilderImpl extends AbstractEndpointBuilder implements Ddb2EndpointBuilder, AdvancedDdb2EndpointBuilder {