我试图在DynamoDB Local中保存具有空值的项目:
{
"TableName": "test",
"Key": {
"userId": {
"N": "3"
}
},
"UpdateExpression": "set #name_0 = :val_0, #name_1 = :val_1",
"ExpressionAttributeValues": {
":val_0": {
"NULL": true
},
":val_1": {
"N": "1541446796742"
}
},
"ExpressionAttributeNames": {
"#name_0": "value",
"#name_1": "time"
},
"ReturnValues": "UPDATED_NEW"
}
在DynamoDB Local控制台日志上,它会打印出以下错误:
13|Dynamodb | Nov 05, 2018 11:59:10 AM com.almworks.sqlite4java.Internal log
13|Dynamodb | WARNING: [sqlite] SQLiteDBAccess$17@19065fc8: job exception
13|Dynamodb | java.lang.IllegalArgumentException: Unknown AttributeValue type: {NULL: true,}
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.translateKeyAttributeValue(SQLiteDBAccess.java:2539)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.getColumnNameToValueMap(SQLiteDBAccess.java:1771)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.sqliteColumnBindingsForAllAttributes(SQLiteDBAccess.java:1714)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.access$1000(SQLiteDBAccess.java:83)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess$17.doWork(SQLiteDBAccess.java:1511)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess$17.doWork(SQLiteDBAccess.java:1501)
13|Dynamodb | at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.AmazonDynamoDBOfflineSQLiteJob.job(AmazonDynamoDBOfflineSQLiteJob.java:97)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteJob.execute(SQLiteJob.java:372)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteQueue.executeJob(SQLiteQueue.java:534)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:667)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
13|Dynamodb | at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
13|Dynamodb | at java.base/java.lang.Thread.run(Thread.java:844)
在我看来,DynamoDB Local不支持空值。如果是这样,有人知道解决该问题的方法吗?