Skip to content

Commit

Permalink
Simplify options for disable_projection_and_casing
Browse files Browse the repository at this point in the history
Since `auto` is mostly the same as `false`, we can limit the options to just
`auto` and `always`.
  • Loading branch information
henrymai committed Jul 29, 2022
1 parent 235cd33 commit 6ed5bb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
9 changes: 2 additions & 7 deletions athena-dynamodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,12 @@ If glue is disabled, we perform schema inference. Under schema inference, we eva
- This disables projection and casing when we see a previously unsupported type
and we see that the user does not have column name mapping on their table.
- This is the default setting.
- true
- always
- This disables projection and casing unconditionally.
This is useful when users have casing in their ddb column names but do not want to
specify a column name mapping at all.
- false
- This enables projection and casing unconditionally.
This is useful when the users want projection enabled (mainly for bandwidth and latency)
and are not worried about their columns with casing or already have a column name mapping
for those columns.

Caveats with setting this to true or auto:
Caveats with this new feature:

- May incur higher bandwidth usage depending on your query.
This not a problem if your lambda is in the same region as your ddb table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ protected void readWithConstraint(BlockSpiller spiller, ReadRecordsRequest recor
logger.info(DISABLE_PROJECTION_AND_CASING_ENV + " environment variable set to: " + disableProjectionAndCasingEnvValue);

boolean disableProjectionAndCasing = false;
if (disableProjectionAndCasingEnvValue.equals("auto")) {
if (disableProjectionAndCasingEnvValue.equals("always")) {
// This is when the user wants to turn this on unconditionally to
// solve their casing issues even when they do not have `set` or
// `decimal` columns.
disableProjectionAndCasing = true;
}
else { // *** We default to auto when the variable is not set ***
// In the automatic case, we will try to mimic the behavior prior to the support of `set` and `decimal` types as much
// as possible.
//
Expand All @@ -165,11 +171,6 @@ protected void readWithConstraint(BlockSpiller spiller, ReadRecordsRequest recor
logger.info("ColumnNameMapping isEmpty: " + recordMetadata.getColumnNameMapping().isEmpty());
logger.info("Resolving disableProjectionAndCasing to: " + disableProjectionAndCasing);
}
else {
// We also support the user turning this on unconditionally to solve their casing issues even when they do not have `set` or `decimal`
// columns.
disableProjectionAndCasing = disableProjectionAndCasingEnvValue.equals("true");
}

Iterator<Map<String, AttributeValue>> itemIterator = getIterator(split, tableName, recordsRequest.getSchema(), disableProjectionAndCasing);
DynamoDBFieldResolver resolver = new DynamoDBFieldResolver(recordMetadata);
Expand Down

0 comments on commit 6ed5bb1

Please sign in to comment.