Skip to content

Commit 37555fb

Browse files
authored
fix(bqjdbc): metadata methods & getSqlTypeName for struct (#12947)
1 parent 24b1719 commit 37555fb

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryBaseStruct.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import com.google.cloud.bigquery.Field;
2323
import com.google.cloud.bigquery.FieldList;
24+
import com.google.cloud.bigquery.StandardSQLTypeName;
2425
import com.google.cloud.bigquery.exception.BigQueryJdbcSqlFeatureNotSupportedException;
2526
import java.sql.Date;
2627
import java.sql.SQLException;
@@ -42,7 +43,7 @@ abstract class BigQueryBaseStruct implements java.sql.Struct {
4243

4344
@Override
4445
public final String getSQLTypeName() throws SQLException {
45-
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
46+
return StandardSQLTypeName.STRUCT.name();
4647
}
4748

4849
@Override

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryDatabaseMetaData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,27 +515,27 @@ public boolean supportsSchemasInPrivilegeDefinitions() {
515515

516516
@Override
517517
public boolean supportsCatalogsInDataManipulation() {
518-
return false;
518+
return true;
519519
}
520520

521521
@Override
522522
public boolean supportsCatalogsInProcedureCalls() {
523-
return false;
523+
return true;
524524
}
525525

526526
@Override
527527
public boolean supportsCatalogsInTableDefinitions() {
528-
return false;
528+
return true;
529529
}
530530

531531
@Override
532532
public boolean supportsCatalogsInIndexDefinitions() {
533-
return false;
533+
return true;
534534
}
535535

536536
@Override
537537
public boolean supportsCatalogsInPrivilegeDefinitions() {
538-
return false;
538+
return true;
539539
}
540540

541541
@Override
@@ -3305,7 +3305,7 @@ public boolean insertsAreDetected(int type) {
33053305

33063306
@Override
33073307
public boolean supportsBatchUpdates() {
3308-
return false;
3308+
return true;
33093309
}
33103310

33113311
@Override

java-bigquery/google-cloud-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryArrowStructTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,8 @@ public void structOfStructs() throws SQLException {
227227
}
228228

229229
@Test
230-
public void getSQLTypeNameIsNotSupported() {
231-
Exception exception =
232-
assertThrows(
233-
SQLFeatureNotSupportedException.class, structWithPrimitiveValues::getSQLTypeName);
234-
assertThat(exception.getMessage()).isEqualTo(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
230+
public void getSQLTypeNameReturnsStruct() throws SQLException {
231+
assertThat(structWithPrimitiveValues.getSQLTypeName()).isEqualTo("STRUCT");
235232
}
236233

237234
@Test

java-bigquery/google-cloud-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryJsonStructTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,8 @@ public void structWithNullValue() throws SQLException {
246246
}
247247

248248
@Test
249-
public void getSQLTypeNameIsNotSupported() {
250-
Exception exception =
251-
assertThrows(
252-
SQLFeatureNotSupportedException.class, structWithPrimitiveValues::getSQLTypeName);
253-
assertThat(exception.getMessage()).isEqualTo(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
249+
public void getSQLTypeName() throws SQLException {
250+
assertThat(structWithPrimitiveValues.getSQLTypeName()).isEqualTo("STRUCT");
254251
}
255252

256253
@Test

0 commit comments

Comments
 (0)