Skip to content

Commit

Permalink
Extended QPT to athena-cloudera-hive (awslabs#1826)
Browse files Browse the repository at this point in the history
Co-authored-by: AbdulRehman Faraj <[email protected]>
  • Loading branch information
AbdulR3hman and AbdulRehman Faraj committed Mar 25, 2024
1 parent dad4d78 commit 1af60c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ public GetSplitsResponse doGetSplits(BlockAllocator blockAllocator, GetSplitsReq
{
LOGGER.info("{}: Catalog {}, table {}", getSplitsRequest.getQueryId(),
getSplitsRequest.getTableName().getSchemaName(), getSplitsRequest.getTableName().getTableName());
if (getSplitsRequest.getConstraints().isQueryPassThrough()) {
LOGGER.info("QPT Split Requested");
return setupQueryPassthroughSplit(getSplitsRequest);
}

int partitionContd = decodeContinuationToken(getSplitsRequest);
Set<Split> splits = new HashSet<>();
Block partitions = getSplitsRequest.getPartitions();
Expand Down Expand Up @@ -271,6 +276,7 @@ public GetDataSourceCapabilitiesResponse doGetDataSourceCapabilities(BlockAlloca
LimitPushdownSubType.INTEGER_CONSTANT
));

jdbcQueryPassthrough.addQueryPassthroughCapabilityIfEnabled(capabilities, configOptions);
return new GetDataSourceCapabilitiesResponse(request.getCatalogName(), capabilities.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ public HiveRecordHandler(DatabaseConnectionConfig databaseConnectionConfig, Jdbc
@Override
public PreparedStatement buildSplitSql(Connection jdbcConnection, String catalogName, TableName tableName, Schema schema, Constraints constraints, Split split) throws SQLException
{
PreparedStatement preparedStatement = jdbcSplitQueryBuilder.buildSql(jdbcConnection, null, tableName.getSchemaName(), tableName.getTableName(), schema, constraints, split);
PreparedStatement preparedStatement;

if (constraints.isQueryPassThrough()) {
preparedStatement = buildQueryPassthroughSql(jdbcConnection, constraints);
}
else {
preparedStatement = jdbcSplitQueryBuilder.buildSql(jdbcConnection, null, tableName.getSchemaName(), tableName.getTableName(), schema, constraints, split);
}
preparedStatement.setFetchSize(FETCH_SIZE);
return preparedStatement;
}
Expand Down

0 comments on commit 1af60c9

Please sign in to comment.