Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4845,9 +4845,11 @@ private ColumnTypeInfo getColumnTypeInfoForSqlType(StandardSQLTypeName bqType) {
case TIME:
return new ColumnTypeInfo(Types.TIME, "TIME", 15, null, null);
case GEOGRAPHY:
return new ColumnTypeInfo(Types.OTHER, "GEOGRAPHY", null, null, null);
case JSON:
return new ColumnTypeInfo(Types.OTHER, "JSON", null, null, null);
case INTERVAL:
return new ColumnTypeInfo(Types.VARCHAR, "VARCHAR", null, null, null);
return new ColumnTypeInfo(Types.OTHER, "INTERVAL", null, null, null);
case BYTES:
return new ColumnTypeInfo(Types.VARBINARY, "VARBINARY", null, null, null);
case STRUCT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,37 @@ public void testMapBigQueryTypeToJdbc_ScalarTypes() {
assertEquals(Integer.valueOf(38), infoBigNumeric.decimalDigits);
assertEquals(Integer.valueOf(10), infoBigNumeric.numPrecRadix);

// GEOGRAPHY -> VARCHAR
// GEOGRAPHY -> OTHER
Field fieldGeo =
Field.newBuilder("test_geo", StandardSQLTypeName.GEOGRAPHY)
.setMode(Field.Mode.NULLABLE)
.build();
BigQueryDatabaseMetaData.ColumnTypeInfo infoGeo = dbMetadata.mapBigQueryTypeToJdbc(fieldGeo);
assertEquals(Types.VARCHAR, infoGeo.jdbcType);
assertEquals("VARCHAR", infoGeo.typeName);
assertEquals(Types.OTHER, infoGeo.jdbcType);
assertEquals("GEOGRAPHY", infoGeo.typeName);
assertNull(infoGeo.columnSize);

// JSON -> OTHER
Field fieldJson =
Field.newBuilder("test_json", StandardSQLTypeName.JSON)
.setMode(Field.Mode.NULLABLE)
.build();
BigQueryDatabaseMetaData.ColumnTypeInfo infoJson = dbMetadata.mapBigQueryTypeToJdbc(fieldJson);
assertEquals(Types.OTHER, infoJson.jdbcType);
assertEquals("JSON", infoJson.typeName);
assertNull(infoJson.columnSize);

// INTERVAL -> OTHER
Field fieldInterval =
Field.newBuilder("test_interval", StandardSQLTypeName.INTERVAL)
.setMode(Field.Mode.NULLABLE)
.build();
BigQueryDatabaseMetaData.ColumnTypeInfo infoInterval =
dbMetadata.mapBigQueryTypeToJdbc(fieldInterval);
assertEquals(Types.OTHER, infoInterval.jdbcType);
assertEquals("INTERVAL", infoInterval.typeName);
assertNull(infoInterval.columnSize);

// DATE
Field fieldDate =
Field.newBuilder("test_date", StandardSQLTypeName.DATE)
Expand Down
Loading