Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saphana glue get table api issue fix #2505

Merged

Conversation

VenkatasivareddyTR
Copy link
Contributor

Issue #, if available:

Description of changes:
The Saphana Glue Get Table API was not retrieving data as expected due to a case-sensitivity issue with the PART_ID column. By converting the PART_ID column to lowercase, we achieved successful data retrieval through the Glue API.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AbdulR3hman AbdulR3hman force-pushed the saphana_phase2_tablelist_issue branch from 03c1d41 to f57df7c Compare January 8, 2025 18:37
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.18%. Comparing base (7b40bf4) to head (401275f).
Report is 8 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2505      +/-   ##
============================================
+ Coverage     61.09%   61.18%   +0.09%     
- Complexity     3738     3751      +13     
============================================
  Files           576      577       +1     
  Lines         21348    21430      +82     
  Branches       2654     2659       +5     
============================================
+ Hits          13043    13113      +70     
- Misses         7037     7046       +9     
- Partials       1268     1271       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -32,15 +32,15 @@ public final class SaphanaConstants
public static final int SAPHANA_DEFAULT_PORT = 1025;
static final Map<String, String> JDBC_PROPERTIES = ImmutableMap.of("databaseTerm", "SCHEMA");
static final String ALL_PARTITIONS = "0";
static final String BLOCK_PARTITION_COLUMN_NAME = "PART_ID";
static final String BLOCK_PARTITION_COLUMN_NAME = "PART_ID".toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; BLOCK_PARTITION_COLUMN_NAME = "part_id";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated with above changes.

GetTableLayoutRequest getTableLayoutRequest = new GetTableLayoutRequest(this.federatedIdentity, "testQueryId", "testCatalogName", tableName, constraints, partitionSchema, partitionCols);

PreparedStatement preparedStatement = Mockito.mock(PreparedStatement.class);

Mockito.when(this.connection.prepareStatement(SaphanaConstants.GET_PARTITIONS_QUERY)).thenReturn(preparedStatement);

String[] columns = {"PART_ID"};
String[] columns = {"part_id"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use BLOCK_PARTITION_COLUMN_NAME; also please statically important since it is used in multiple places

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

@@ -149,7 +149,7 @@ public void doGetTableLayoutWithNoPartitions()
PreparedStatement preparedStatement = Mockito.mock(PreparedStatement.class);
Mockito.when(this.connection.prepareStatement(SaphanaConstants.GET_PARTITIONS_QUERY)).thenReturn(preparedStatement);

String[] columns = {"PART_ID"};
String[] columns = {"part_id"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here use the constant!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used same constant.

@@ -245,7 +245,7 @@ public void doGetSplitsContinuation()
PreparedStatement preparedStatement = Mockito.mock(PreparedStatement.class);
Mockito.when(this.connection.prepareStatement(SaphanaConstants.GET_PARTITIONS_QUERY)).thenReturn(preparedStatement);

String[] columns = {"PART_ID"};
String[] columns = {"part_id"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the contant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used same constant.

@@ -260,7 +260,7 @@ public void doGetSplitsContinuation()
GetSplitsResponse getSplitsResponse = this.saphanaMetadataHandler.doGetSplits(splitBlockAllocator, getSplitsRequest);

Set<Map<String, String>> expectedSplits = new HashSet<>();
expectedSplits.add(Collections.singletonMap("PART_ID", "p1"));
expectedSplits.add(Collections.singletonMap("part_id", "p1"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the constant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used same constant.

@AbdulR3hman
Copy link
Contributor

rebasing seems to cause an issue; please investigate https://github.com/awslabs/aws-athena-query-federation/actions/runs/12676924733/job/35331139283?pr=2505

Also please provide testing for both glue and non glue setup.

@Trianz-Akshay
Copy link
Contributor

rebasing seems to cause an issue; please investigate https://github.com/awslabs/aws-athena-query-federation/actions/runs/12676924733/job/35331139283?pr=2505

Also please provide testing for both glue and non glue setup.

I have updated PR branch with latest master. Please find attached results for both glue and non glue test.
Saphana_functional_test.xlsx
Saphanaph2test.xlsx

@AbdulR3hman AbdulR3hman force-pushed the saphana_phase2_tablelist_issue branch from 50aa269 to 401275f Compare January 15, 2025 16:34
@AbdulR3hman AbdulR3hman enabled auto-merge (squash) January 15, 2025 16:38
@AbdulR3hman AbdulR3hman merged commit 01bd504 into awslabs:master Jan 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants