|
46 | 46 | import java.util.Collections; |
47 | 47 | import java.util.List; |
48 | 48 | import java.util.Map; |
| 49 | +import java.util.Objects; |
49 | 50 | import java.util.Properties; |
50 | 51 | import java.util.stream.Collectors; |
51 | 52 | import java.util.stream.Stream; |
@@ -293,4 +294,78 @@ private MetadataConverter[] getMetadataConverters() { |
293 | 294 | .map(TiDBReadableMetadata::getConverter) |
294 | 295 | .toArray(MetadataConverter[]::new); |
295 | 296 | } |
| 297 | + |
| 298 | + @Override |
| 299 | + public boolean equals(Object o) { |
| 300 | + if (this == o) { |
| 301 | + return true; |
| 302 | + } |
| 303 | + if (o == null || getClass() != o.getClass()) { |
| 304 | + return false; |
| 305 | + } |
| 306 | + TiDBTableSource that = (TiDBTableSource) o; |
| 307 | + return port == that.port |
| 308 | + && enableParallelRead == that.enableParallelRead |
| 309 | + && splitSize == that.splitSize |
| 310 | + && splitMetaGroupSize == that.splitMetaGroupSize |
| 311 | + && fetchSize == that.fetchSize |
| 312 | + && connectionPoolSize == that.connectionPoolSize |
| 313 | + && connectMaxRetries == that.connectMaxRetries |
| 314 | + && Double.compare(that.distributionFactorUpper, distributionFactorUpper) == 0 |
| 315 | + && Double.compare(that.distributionFactorLower, distributionFactorLower) == 0 |
| 316 | + && physicalSchema.equals(that.physicalSchema) |
| 317 | + && startupOptions.equals(that.startupOptions) |
| 318 | + && Objects.equals(tableList, that.tableList) |
| 319 | + && Objects.equals(tableName, that.tableName) |
| 320 | + && Objects.equals(connectTimeout, that.connectTimeout) |
| 321 | + && Objects.equals(jdbcDriver, that.jdbcDriver) |
| 322 | + && Objects.equals(serverTimeZone, that.serverTimeZone) |
| 323 | + && Objects.equals(pdAddresses, that.pdAddresses) |
| 324 | + && Objects.equals(hostMapping, that.hostMapping) |
| 325 | + && Objects.equals(hostName, that.hostName) |
| 326 | + && Objects.equals(database, that.database) |
| 327 | + && Objects.equals(username, that.username) |
| 328 | + && Objects.equals(password, that.password) |
| 329 | + && Objects.equals(heartbeatInterval, that.heartbeatInterval) |
| 330 | + && Objects.equals(chunkKeyColumn, that.chunkKeyColumn) |
| 331 | + && Objects.equals(chunkKeyColumns, that.chunkKeyColumns) |
| 332 | + && Objects.equals(jdbcProperties, that.jdbcProperties) |
| 333 | + && Objects.equals(options, that.options) |
| 334 | + && Objects.equals(producedDataType, that.producedDataType) |
| 335 | + && Objects.equals(metadataKeys, that.metadataKeys); |
| 336 | + } |
| 337 | + |
| 338 | + @Override |
| 339 | + public int hashCode() { |
| 340 | + return Objects.hash( |
| 341 | + physicalSchema, |
| 342 | + startupOptions, |
| 343 | + tableList, |
| 344 | + tableName, |
| 345 | + connectTimeout, |
| 346 | + jdbcDriver, |
| 347 | + serverTimeZone, |
| 348 | + pdAddresses, |
| 349 | + hostMapping, |
| 350 | + port, |
| 351 | + hostName, |
| 352 | + database, |
| 353 | + username, |
| 354 | + password, |
| 355 | + heartbeatInterval, |
| 356 | + splitSize, |
| 357 | + splitMetaGroupSize, |
| 358 | + fetchSize, |
| 359 | + connectMaxRetries, |
| 360 | + connectionPoolSize, |
| 361 | + distributionFactorUpper, |
| 362 | + distributionFactorLower, |
| 363 | + chunkKeyColumn, |
| 364 | + chunkKeyColumns, |
| 365 | + jdbcProperties, |
| 366 | + options, |
| 367 | + enableParallelRead, |
| 368 | + producedDataType, |
| 369 | + metadataKeys); |
| 370 | + } |
296 | 371 | } |
0 commit comments