Skip to content

Commit

Permalink
fix types for other DBs
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao committed Jul 21, 2022
1 parent 0219384 commit d2139dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public Date getDateValue(final FieldValue fieldValue, final DateFormat dateForma
public JsonSchemaType getJsonType(final StandardSQLTypeName bigQueryType) {
return switch (bigQueryType) {
case BOOL -> JsonSchemaType.BOOLEAN;
case INT64, FLOAT64, NUMERIC, BIGNUMERIC -> JsonSchemaType.NUMBER;
case INT64 -> JsonSchemaType.NUMBER_BIGINT;
case FLOAT64, NUMERIC, BIGNUMERIC -> JsonSchemaType.NUMBER;
case STRING, BYTES, TIMESTAMP, DATE, TIME, DATETIME -> JsonSchemaType.STRING;
case ARRAY -> JsonSchemaType.ARRAY;
case STRUCT -> JsonSchemaType.OBJECT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ public JsonSchemaType getJsonType(MysqlType mysqlType) {
case
// TINYINT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link
// getFieldType}
TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED, INT, INT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED, BIGINT, BIGINT_UNSIGNED, FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED -> JsonSchemaType.NUMBER;
TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED, INT, INT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED -> JsonSchemaType.INTEGER;
case BIGINT, BIGINT_UNSIGNED -> JsonSchemaType.NUMBER_BIGINT;
case FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED -> JsonSchemaType.NUMBER;
case BOOLEAN -> JsonSchemaType.BOOLEAN;
case NULL -> JsonSchemaType.NULL;
// BIT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link getFieldType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ public JsonSchemaType getJsonType(MysqlType mysqlType) {
case
// TINYINT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link
// getFieldType}
TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED, INT, INT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED, BIGINT, BIGINT_UNSIGNED, FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED -> JsonSchemaType.NUMBER;
TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED, INT, INT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED -> JsonSchemaType.INTEGER;
case BIGINT, BIGINT_UNSIGNED -> JsonSchemaType.NUMBER_BIGINT;
case FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED -> JsonSchemaType.NUMBER;
case BOOLEAN -> JsonSchemaType.BOOLEAN;
case NULL -> JsonSchemaType.NULL;
// BIT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link getFieldType}
Expand Down

0 comments on commit d2139dc

Please sign in to comment.