Skip to content

Commit 64f94c2

Browse files
committed
add oracle limit push down
1 parent 6f92d0f commit 64f94c2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

athena-federation-sdk/src/main/java/com/amazonaws/athena/connector/lambda/resolver/CaseResolver.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public CaseResolver(String sourceType, FederationSDKCasingMode nonGlueBasedDefau
4646

4747
public enum FederationSDKCasingMode
4848
{
49-
NONE,
49+
NONE, // casing mode to ignore adjustment.
5050
LOWER, // casing mode to lower case everything (glue and trino lower case everything)
5151
UPPER, // casing mode to upper case everything (oracle by default upper cases everything)
52-
CASE_INSENSITIVE_SEARCH, //
53-
ANNOTATION
52+
CASE_INSENSITIVE_SEARCH, // casing mode to perform case_insensitive_search mode
53+
ANNOTATION // casing mode to use annotation (legacy) in query
5454
}
5555

5656
protected final FederationSDKCasingMode getCasingMode(Map<String, String> configOptions)

athena-jdbc/src/main/java/com/amazonaws/athena/connectors/jdbc/connection/GenericJdbcConnectionFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.io.UnsupportedEncodingException;
3333
import java.net.URLEncoder;
3434
import java.nio.charset.StandardCharsets;
35-
import java.sql.Connection;;
35+
import java.sql.Connection;
3636
import java.sql.SQLException;
3737
import java.util.Map;
3838
import java.util.Properties;

athena-oracle/src/main/java/com/amazonaws/athena/connectors/oracle/OracleQueryStringBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ protected List<String> getPartitionWhereClauses(final Split split)
7676
@Override
7777
protected String appendLimitOffset(Split split, Constraints constraints)
7878
{
79-
return emptyString;
79+
return String.format(" FETCH FIRST %d ROWS ONLY ", constraints.getLimit());
8080
}
8181
}

athena-oracle/src/test/java/com/amazonaws/athena/connectors/oracle/OracleRecordHandlerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void buildSplitSql()
145145

146146
Mockito.when(constraints.getLimit()).thenReturn(5L);
147147

148-
String expectedSql = "SELECT \"testCol1\", \"testCol2\", \"testCol3\", \"testCol4\", \"testCol5\", \"testCol6\", \"testCol7\", \"testCol8\", \"testCol9\", \"testCol10\" FROM \"testSchema\".\"testTable\" PARTITION (p0) WHERE (\"testCol1\" IN (?,?)) AND ((\"testCol2\" >= ? AND \"testCol2\" < ?)) AND ((\"testCol3\" > ? AND \"testCol3\" <= ?)) AND (\"testCol4\" = ?) AND (\"testCol5\" = ?) AND (\"testCol6\" = ?) AND (\"testCol7\" = ?) AND (\"testCol8\" = ?) AND (\"testCol9\" = ?) AND (\"testCol10\" = ?)";
148+
String expectedSql = "SELECT \"testCol1\", \"testCol2\", \"testCol3\", \"testCol4\", \"testCol5\", \"testCol6\", \"testCol7\", \"testCol8\", \"testCol9\", \"testCol10\" FROM \"testSchema\".\"testTable\" PARTITION (p0) WHERE (\"testCol1\" IN (?,?)) AND ((\"testCol2\" >= ? AND \"testCol2\" < ?)) AND ((\"testCol3\" > ? AND \"testCol3\" <= ?)) AND (\"testCol4\" = ?) AND (\"testCol5\" = ?) AND (\"testCol6\" = ?) AND (\"testCol7\" = ?) AND (\"testCol8\" = ?) AND (\"testCol9\" = ?) AND (\"testCol10\" = ?) FETCH FIRST 5 ROWS ONLY ";
149149
PreparedStatement expectedPreparedStatement = Mockito.mock(PreparedStatement.class);
150150
Mockito.when(this.connection.prepareStatement(Mockito.eq(expectedSql))).thenReturn(expectedPreparedStatement);
151151
PreparedStatement preparedStatement = this.oracleRecordHandler.buildSplitSql(this.connection, "testCatalogName", tableName, schema, constraints, split);

0 commit comments

Comments
 (0)