Skip to content

feat: sql fast path impl #509

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

Merged
merged 25 commits into from
Sep 22, 2020
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f6e93cc
feat: sql fast path impl
stephaniewang526 Jun 26, 2020
d8ab960
add logic for DML and DDL queries
stephaniewang526 Jul 7, 2020
780b836
update ITs to check table content correctness, update fastquery logic
stephaniewang526 Jul 10, 2020
7126437
add test for bogus query
stephaniewang526 Jul 13, 2020
08d6c7e
add check for idempotent requestId
stephaniewang526 Jul 13, 2020
31a55ce
update QueryRequestInfo and error handling logic
stephaniewang526 Jul 15, 2020
bcecbb0
add mock test for query JobException
stephaniewang526 Jul 16, 2020
81937fc
update mock test
stephaniewang526 Jul 16, 2020
b62b569
fix unit tests, nit update
stephaniewang526 Jul 16, 2020
7225101
update exception handling from JobException to BigQueryException
stephaniewang526 Jul 17, 2020
79bc75f
update based on comments
stephaniewang526 Aug 7, 2020
0fcb5b6
nit
stephaniewang526 Aug 7, 2020
2495fbb
update based on comments
stephaniewang526 Aug 7, 2020
7c2ae39
add maxResult support
stephaniewang526 Aug 21, 2020
293f3e6
Merge branch 'master' into sql-client
stephaniewang526 Aug 27, 2020
187c86e
Merge remote-tracking branch 'upstream/master' into sql-client
Sep 3, 2020
2862ad8
update code
Sep 3, 2020
d8f1229
add test coverage
stephaniewang526 Sep 3, 2020
f7d73c4
Merge remote-tracking branch 'origin/sql-client' into sql-client
stephaniewang526 Sep 3, 2020
fd9dcae
lint fix
stephaniewang526 Sep 3, 2020
0cdf672
feat: add more code cov
Sep 11, 2020
27d1a63
set method back
stephaniewang526 Sep 11, 2020
23c9008
Merge branch 'master' into sql-client
stephaniewang526 Sep 11, 2020
48397ad
feat: code cove
Sep 15, 2020
e161cf9
add codecov
stephaniewang526 Sep 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add mock test for query JobException
  • Loading branch information
stephaniewang526 committed Jul 16, 2020
commit bcecbb0e552de85c89b1c9cb88ff8d1c9d3c9175
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@ public class BigQueryImplTest {
.setDefaultDataset(DatasetId.of(PROJECT, DATASET))
.setUseQueryCache(false)
.build();
private static final QueryJobConfiguration QUERY_JOB_CONFIGURATION_FOR_INVALIDQUERY =
QueryJobConfiguration.newBuilder("INVALID_SQL")
.setDefaultDataset(DatasetId.of(PROJECT, DATASET))
.setUseQueryCache(false)
.build();
private static final JobInfo JOB_INFO =
JobInfo.newBuilder(QUERY_JOB_CONFIGURATION_FOR_QUERY)
.setJobId(JobId.of(PROJECT, JOB))
Expand Down Expand Up @@ -2260,6 +2255,38 @@ public void testFastQueryDDLShouldRetry() throws Exception {
verify(bigqueryRpcMock, times(5)).fastQuery(PROJECT, requestPb);
}

@Test
public void testFastQueryJobException() throws InterruptedException {
com.google.api.services.bigquery.model.QueryResponse responsePb =
new com.google.api.services.bigquery.model.QueryResponse()
.setCacheHit(false)
.setJobReference(JOB_INFO.getJobId().toPb())
.setJobComplete(true)
.setRows(ImmutableList.of(TABLE_ROW))
.setPageToken(null)
.setTotalBytesProcessed(42L)
.setSchema(TABLE_SCHEMA.toPb())
.setErrors(ImmutableList.of(new ErrorProto().setMessage("Backend Query Job Error")));

QueryRequestInfo requestInfo = new QueryRequestInfo(QUERY_JOB_CONFIGURATION_FOR_QUERY);
QueryRequest requestPb = requestInfo.toPb();

when(bigqueryRpcMock.fastQuery(PROJECT, requestPb))
.thenReturn(responsePb)
.thenThrow(
new JobException(
JOB_INFO.getJobId(),
ImmutableList.of(
new BigQueryError(null, null, "Backend Query Job Error"))));

bigquery = options.getService();
try {
bigquery.query(QUERY_JOB_CONFIGURATION_FOR_QUERY);
} catch (JobException ex) {
Assert.assertNotNull(ex.getMessage());
}
}

@Test
public void testCreateRoutine() {
RoutineInfo routineInfo = ROUTINE_INFO.setProjectId(OTHER_PROJECT);
Expand Down