Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ private ImmutableMap<String, SourceColumnType> getTableCols(
.put("TINYTEXT", IndexType.STRING)
.put("DATETIME", IndexType.TIME_STAMP)
.put("TIMESTAMP", IndexType.TIME_STAMP)
.put("BOOL", IndexType.NUMERIC)
.put("YEAR", IndexType.NUMERIC)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void testDiscoverTablesRsException() throws SQLException {
public void testDiscoverIndexesBasic() throws SQLException, RetriableSchemaDiscoveryException {
ImmutableList<String> testTables = ImmutableList.of("testTable1");
ImmutableList<String> colTypes =
ImmutableList.of("float", "integer", "bit", "char", "varbinary", "binary", "year");
ImmutableList.of("float", "integer", "bit", "char", "varbinary", "binary", "year", "bool");
ImmutableList<SourceColumnIndexInfo> expectedSourceColumnIndexInfos =
ImmutableList.of(
SourceColumnIndexInfo.builder()
Expand Down Expand Up @@ -343,6 +343,15 @@ public void testDiscoverIndexesBasic() throws SQLException, RetriableSchemaDisco
.setCardinality(42L)
.setIndexType(IndexType.BINARY)
.setOrdinalPosition(4)
.build(),
SourceColumnIndexInfo.builder()
.setColumnName("testColBool")
.setIndexName("primary")
.setIsUnique(true)
.setIsPrimary(true)
.setCardinality(2L)
.setIndexType(IndexType.NUMERIC)
.setOrdinalPosition(5)
.build());
SourceColumnIndexInfo.builder()
.setColumnName("testColYear")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private Map<String, List<Map<String, Object>>> getExpectedData() {
"2005-01-01T00:01:54.123456000Z",
"2037-12-30T23:59:59Z",
"2038-01-18T23:59:59Z"));
expectedData.put("bool_pk", createRows("bool_pk", false, true));
expectedData.put("year_pk", createRows("year_pk", "1901", "2000"));
return expectedData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ CREATE TABLE year_pk_table (
year_pk_col YEAR NOT NULL
);

CREATE TABLE bool_pk_table (
id BOOL PRIMARY KEY,
bool_pk_col BOOL NOT NULL
);


ALTER TABLE `bigint_table` MODIFY `id` INT AUTO_INCREMENT;
ALTER TABLE `bigint_unsigned_table` MODIFY `id` INT AUTO_INCREMENT;
ALTER TABLE `binary_table` MODIFY `id` INT AUTO_INCREMENT;
Expand Down Expand Up @@ -454,6 +460,8 @@ INSERT INTO `timestamp_pk_table` (`id`, `timestamp_pk_col`) VALUES ('2005-01-01
SET time_zone = SYSTEM;
INSERT INTO `year_pk_table` (`id`, `year_pk_col`) VALUES (1901, 1901), (2000, 2000);

INSERT INTO `bool_pk_table` (`id`, `bool_pk_col`) VALUES (TRUE, TRUE), (FALSE, FALSE);

INSERT INTO `bigint_table` (`bigint_col`) VALUES (NULL);
INSERT INTO `bigint_unsigned_table` (`bigint_unsigned_col`) VALUES (NULL);
INSERT INTO `binary_table` (`binary_col`) VALUES (NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ CREATE TABLE IF NOT EXISTS timestamp_pk_table (
timestamp_pk_col TIMESTAMP NOT NULL,
) PRIMARY KEY(id);

CREATE TABLE IF NOT EXISTS bool_pk_table (
id BOOL NOT NULL,
bool_pk_col BOOL NOT NULL,
) PRIMARY KEY(id);

CREATE TABLE IF NOT EXISTS year_pk_table (
id INT64 NOT NULL,
year_pk_col INT64 NOT NULL,
Expand Down
Loading