diff --git a/presto-postgresql/src/test/java/io/prestosql/plugin/postgresql/TestPostgreSqlTypeMapping.java b/presto-postgresql/src/test/java/io/prestosql/plugin/postgresql/TestPostgreSqlTypeMapping.java index 564dd2b863e3b..0618a94d6484e 100644 --- a/presto-postgresql/src/test/java/io/prestosql/plugin/postgresql/TestPostgreSqlTypeMapping.java +++ b/presto-postgresql/src/test/java/io/prestosql/plugin/postgresql/TestPostgreSqlTypeMapping.java @@ -34,7 +34,6 @@ import java.time.ZoneId; import java.util.function.Function; -import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Verify.verify; import static com.google.common.io.BaseEncoding.base16; @@ -48,11 +47,11 @@ import static io.prestosql.tests.datatype.DataType.decimalDataType; import static io.prestosql.tests.datatype.DataType.doubleDataType; import static io.prestosql.tests.datatype.DataType.integerDataType; +import static io.prestosql.tests.datatype.DataType.jsonDataType; import static io.prestosql.tests.datatype.DataType.realDataType; import static io.prestosql.tests.datatype.DataType.smallintDataType; import static io.prestosql.tests.datatype.DataType.varbinaryDataType; import static io.prestosql.tests.datatype.DataType.varcharDataType; -import static io.prestosql.type.JsonType.JSON; import static java.lang.String.format; import static java.nio.charset.StandardCharsets.UTF_16LE; import static java.nio.charset.StandardCharsets.UTF_8; @@ -352,18 +351,6 @@ private static DataType byteaDataType() identity()); } - private static DataType jsonDataType() - { - return dataType( - "json", - JSON, - value -> { - checkArgument(!value.contains("'")); - return format("JSON '%s'", value); - }, - identity()); - } - private DataSetup prestoCreateAsSelect(String tableNamePrefix) { return new CreateAsSelectDataSetup(new PrestoSqlExecutor(getQueryRunner()), tableNamePrefix); diff --git a/presto-tests/src/main/java/io/prestosql/tests/datatype/DataType.java b/presto-tests/src/main/java/io/prestosql/tests/datatype/DataType.java index 0aebae247f44b..f244eab1c0da0 100644 --- a/presto-tests/src/main/java/io/prestosql/tests/datatype/DataType.java +++ b/presto-tests/src/main/java/io/prestosql/tests/datatype/DataType.java @@ -30,12 +30,14 @@ import java.util.Optional; import java.util.function.Function; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.padEnd; import static com.google.common.io.BaseEncoding.base16; import static io.prestosql.spi.type.CharType.createCharType; import static io.prestosql.spi.type.DateType.DATE; import static io.prestosql.spi.type.DecimalType.createDecimalType; import static io.prestosql.spi.type.VarcharType.createUnboundedVarcharType; +import static io.prestosql.type.JsonType.JSON; import static java.lang.String.format; import static java.math.RoundingMode.UNNECESSARY; import static java.util.function.Function.identity; @@ -150,6 +152,18 @@ public static DataType dateDataType() identity()); } + public static DataType jsonDataType() + { + return dataType( + "json", + JSON, + value -> { + checkArgument(!value.contains("'")); + return format("JSON '%s'", value); + }, + identity()); + } + private static String quote(String value) { return "'" + value + "'";