Giter Site home page Giter Site logo

podyn's People

Contributors

khamasaki avatar marcocitus avatar marcoslot avatar maxarndt avatar

Watchers

 avatar

podyn's Issues

replicateData() throws a NullPointerException

The following statement throws a NullPointerException.

for(Future<Long> futureResult : futureResults) {
futureResult.get();
}

To fix this problem I need to debug the following function:

public long replicateData(int maxScanRate) {
RateLimiter rateLimiter = RateLimiter.create(maxScanRate);
Map<String,AttributeValue> lastEvaluatedScanKey = null;
long numRowsReplicated = 0;
while(true) {
ScanResult scanResult = scanWithRetries(lastEvaluatedScanKey);
if (addColumnsEnabled) {
for(Map<String,AttributeValue> dynamoItem : scanResult.getItems()) {
addNewColumns(dynamoItem);
}
}
TableRowBatch tableRowBatch = new TableRowBatch();
for(Map<String,AttributeValue> dynamoItem : scanResult.getItems()) {
TableRow tableRow = rowFromDynamoRecord(dynamoItem);
tableRowBatch.addRow(tableRow);
}
LOG.info(String.format("Replicated %d rows to table %s", tableRowBatch.size(), tableSchema.tableName));
numRowsReplicated += tableRowBatch.size();
/* load the batch using COPY */
emitter.copyFromReader(tableSchema, tableRowBatch.asCopyReader());
lastEvaluatedScanKey = scanResult.getLastEvaluatedKey();
if(lastEvaluatedScanKey == null) {
break;
}
// Account for the rest of the throughput we consumed,
// now that we know how much that scan request cost
double consumedCapacity = scanResult.getConsumedCapacity() != null ? scanResult.getConsumedCapacity().getCapacityUnits() : 0;
int permitsToConsume = (int)(consumedCapacity - 1.0);
if (permitsToConsume <= 0) {
permitsToConsume = 1;
}
// Let the rate limiter wait until our desired throughput "recharges"
rateLimiter.acquire(permitsToConsume);
}
return numRowsReplicated;
}

Nested objects are mistakenly be escaped using jsonb conversion mode

Podyn generates tables with the following schema in the data (jsonb) column:

{
    "name": "Mike",
    "lastName": "Miller",
    "address": "{\"city\":\"Berlin\",\"code\":10115,\"street\":\"Some street 83\",\"country\":\"Germany\"}"
}

The value of the attribute address is escaped which leads to problems if you want for example to use an ORM to cast this JSON to a (nested) POCO.

The output of podyn should look like:

{
    "name": "Mike",
    "lastName": "Miller",
    "address": {"city":"Berlin","code":10115,"street":"Some street 83","country":"Germany"}
}

Numerics are treated as strings

If there is a numeric type in your dynamoDB, podyn treats them as strings and this ends up in the following in your PostgreSQL using jsonb mode:

{
    "someNumeric": "0.234",
    "name": "Mike",
    "lastName": "Miller"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.