Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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 @@ -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)
.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");
ImmutableList.of("float", "integer", "bit", "char", "varbinary", "binary", "bool");
ImmutableList<SourceColumnIndexInfo> expectedSourceColumnIndexInfos =
ImmutableList.of(
SourceColumnIndexInfo.builder()
Expand Down Expand Up @@ -344,6 +344,16 @@ public void testDiscoverIndexesBasic() throws SQLException, RetriableSchemaDisco
.setIndexType(IndexType.BINARY)
.setOrdinalPosition(4)
.build());
SourceColumnIndexInfo.builder()
.setColumnName("testColBool")
.setIndexName("primary")
.setIsUnique(true)
.setIsPrimary(true)
.setCardinality(2L)
.setIndexType(IndexType.NUMERIC)
.setOrdinalPosition(5)
.build(),


final JdbcSchemaReference sourceSchemaReference =
JdbcSchemaReference.builder().setDbName("testDB").build();
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"));
return expectedData;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ CREATE TABLE timestamp_pk_table (
CONSTRAINT PRIMARY KEY (id)
);

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 @@ -449,6 +455,8 @@ SET time_zone = 'Asia/Kolkata';
INSERT INTO `timestamp_pk_table` (`id`, `timestamp_pk_col`) VALUES ('2005-01-01 05:31:54.123456', '2005-01-01 05:31:54.123456');
SET time_zone = SYSTEM;

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 @@ -322,3 +322,8 @@ CREATE TABLE IF NOT EXISTS timestamp_pk_table (
id TIMESTAMP NOT NULL,
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);
Loading