Amazon web services androidstudio,DynamoDB查询也使用排序键

Amazon web services androidstudio,DynamoDB查询也使用排序键,amazon-web-services,android-studio,dynamodb-queries,Amazon Web Services,Android Studio,Dynamodb Queries,我遇到了一个问题,我试图将数据从DynamoDB直接传输到我的android studio。如果我想用PK查询,用random列过滤,这一切都很好,但是无论我做什么,我都无法使用sort键。表达式不能用作partion键的一部分,但也不能将两个基元类型放入查询中 我也尝试过使用QueryFilter,但是,我在下面的代码中获得了受保护的访问权限,即使我扩展了这个类 QueryFilter queryFilter = new QueryFilter(); 这是只使用Partion键而不使用Sor

我遇到了一个问题,我试图将数据从DynamoDB直接传输到我的android studio。如果我想用PK查询,用random列过滤,这一切都很好,但是无论我做什么,我都无法使用sort键。表达式不能用作partion键的一部分,但也不能将两个基元类型放入查询中

我也尝试过使用QueryFilter,但是,我在下面的代码中获得了受保护的访问权限,即使我扩展了这个类

QueryFilter queryFilter = new QueryFilter();
这是只使用Partion键而不使用Sort键进行查询的代码

final Expression expression = new Expression();
expression.setExpressionStatement("#t < :time");
//expression.setExpressionStatement("begins_with (#t, :time)");
expression.withExpressionAttibuteValues(":time", new Primitive(timeNow.format(format)));
expression.addExpressionAttributeNames("#t", "time");

Search searchResult = dbTable.query(new Primitive("Location1"), expression);
final Expression=new Expression();
expression.setExpressionStatement(#t<:time));
//expression.setExpressionStatement(“以(#t,:time)开头”);
expression.withexpressionattibutevalue(“:time”,新原语(timeNow.format(format));
表达式.addexpressionTributenames(“#t”,“time”);
Search searchResult=dbTable.query(新原语(“Location1”),表达式);

尝试了一段时间后,我找到了一个使用QueryOperationConfig的解决方案。由于有人可能会发现这是有用的,我将张贴的解决方案,为我工作

    final Expression expression2 = new Expression();
    expression2.setExpressionStatement("#p = :PK AND begins_with(#s, :SK)");
    expression2.withExpressionAttibuteValues(":PK", new Primitive("Location1"));
    expression2.withExpressionAttibuteValues(":SK", new Primitive("2021-04-11 22:08"));
    expression2.addExpressionAttributeNames("#p", "location");
    expression2.addExpressionAttributeNames("#s", "device # MAC # UUID");

    QueryOperationConfig queryOperationConfig = new QueryOperationConfig();
    queryOperationConfig.withKeyExpression(expression2);
    Search searchResult = dbTable.query(queryOperationConfig);