Skip to content

Commit

Permalink
fix: extract magic number into a named constant
Browse files Browse the repository at this point in the history
Signed-off-by: yuxiqian <34335406+yuxiqian@users.noreply.github.com>
  • Loading branch information
yuxiqian committed Sep 30, 2024
1 parent fd469c2 commit 0b5a57d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class MySqlTypeUtils {
private static final String MULTIPOLYGON = "MULTIPOLYGON";
private static final String MULTILINESTRING = "MULTILINESTRING";
private static final String UNKNOWN = "UNKNOWN";
private static final int FLOAT_LENGTH_UNSPECIFIED_FLAG = -1;

/** Returns a corresponding Flink data type from a debezium {@link Column}. */
public static DataType fromDbzColumn(Column column) {
Expand Down Expand Up @@ -164,7 +165,7 @@ private static DataType convertFromColumn(Column column) {
case FLOAT:
case FLOAT_UNSIGNED:
case FLOAT_UNSIGNED_ZEROFILL:
if (column.length() != -1) {
if (column.length() != FLOAT_LENGTH_UNSPECIFIED_FLAG) {
// For FLOAT types with length provided explicitly, treat it like DOUBLE
return DataTypes.DOUBLE();
} else {
Expand Down

0 comments on commit 0b5a57d

Please sign in to comment.