jackye1995 commented on code in PR #6862:
URL: https://github.com/apache/iceberg/pull/6862#discussion_r1120693804
##########
aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbCatalog.java:
##########
@@ -207,6 +210,47 @@ public void createNamespace(Namespace namespace,
Map<String, String> metadata) {
@Override
public List<Namespace> listNamespaces(Namespace namespace) throws
NoSuchNamespaceException {
+ return awsProperties.dynamoDbSchemaVersion() ==
AwsProperties.DynamoDbSchemaVersion.V1
+ ? listNamespacesForV1(namespace)
+ : listNamespacesForV2(namespace);
+ }
+
+ private List<Namespace> listNamespacesForV2(Namespace namespace) throws
NoSuchNamespaceException {
+ validateNamespace(namespace);
+ List<Namespace> namespaces = Lists.newArrayList();
+ Map<String, AttributeValue> lastEvaluatedKey = null;
+ String condition = COL_NAMESPACE + " = :namespace";
+ Map<String, AttributeValue> conditionValues = Maps.newHashMap();
+ conditionValues.put(":namespace",
AttributeValue.builder().s(COL_IDENTIFIER_NAMESPACE).build());
+ if (!namespace.isEmpty()) {
+ condition += " AND " + "begins_with(" + COL_IDENTIFIER + ",:identifier)";
+ conditionValues.put(":identifier",
AttributeValue.builder().s(namespace.toString()).build());
+ }
+ do {
Review Comment:
we can do some refactoring here and use the paginator to simplify the
codepath:
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/dynamodb/paginators/BatchGetItemIterable.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]