diff --git a/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java b/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java index 7ec09681a6ec1..10217d48a741e 100644 --- a/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java +++ b/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java @@ -148,7 +148,7 @@ public static double castToDouble(@SqlType("varchar(x)") Slice slice) return Double.parseDouble(slice.toStringUtf8()); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to DOUBLE", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to DOUBLE", slice.toStringUtf8())); } } @@ -161,7 +161,7 @@ public static long castToFloat(@SqlType("varchar(x)") Slice slice) return Float.floatToIntBits(Float.parseFloat(slice.toStringUtf8())); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to REAL", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to REAL", slice.toStringUtf8())); } } @@ -174,7 +174,7 @@ public static long castToBigint(@SqlType("varchar(x)") Slice slice) return Long.parseLong(slice.toStringUtf8()); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to BIGINT", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to BIGINT", slice.toStringUtf8())); } } @@ -187,7 +187,7 @@ public static long castToInteger(@SqlType("varchar(x)") Slice slice) return Integer.parseInt(slice.toStringUtf8()); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to INT", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to INT", slice.toStringUtf8())); } } @@ -200,7 +200,7 @@ public static long castToSmallint(@SqlType("varchar(x)") Slice slice) return Short.parseShort(slice.toStringUtf8()); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to SMALLINT", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to SMALLINT", slice.toStringUtf8())); } } @@ -213,7 +213,7 @@ public static long castToTinyint(@SqlType("varchar(x)") Slice slice) return Byte.parseByte(slice.toStringUtf8()); } catch (Exception e) { - throw new PrestoException(INVALID_CAST_ARGUMENT, format("Can not cast '%s' to TINYINT", slice.toStringUtf8())); + throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to TINYINT", slice.toStringUtf8())); } } diff --git a/presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java b/presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java index 42d364bad440f..8b4b61e2ad70e 100644 --- a/presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java +++ b/presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java @@ -290,7 +290,7 @@ public void testJsonToArray() assertInvalidCast("CAST(unchecked_to_json('[1] 2') AS ARRAY)", "Cannot cast to array(bigint). Unexpected trailing token: 2\n[1] 2"); assertInvalidCast("CAST(unchecked_to_json('[1, 2, 3') AS ARRAY)", "Cannot cast to array(bigint).\n[1, 2, 3"); - assertInvalidCast("CAST(JSON '[\"a\", \"b\"]' AS ARRAY)", "Cannot cast to array(bigint). Can not cast 'a' to BIGINT\n[\"a\",\"b\"]"); + assertInvalidCast("CAST(JSON '[\"a\", \"b\"]' AS ARRAY)", "Cannot cast to array(bigint). Cannot cast 'a' to BIGINT\n[\"a\",\"b\"]"); assertInvalidCast("CAST(JSON '[1234567890123.456]' AS ARRAY)", "Cannot cast to array(integer). Out of range for integer: 1.234567890123456E12\n[1.234567890123456E12]"); } diff --git a/presto-main/src/test/java/com/facebook/presto/type/TestMapOperators.java b/presto-main/src/test/java/com/facebook/presto/type/TestMapOperators.java index c7f40895db93a..955bd2d6027dd 100644 --- a/presto-main/src/test/java/com/facebook/presto/type/TestMapOperators.java +++ b/presto-main/src/test/java/com/facebook/presto/type/TestMapOperators.java @@ -455,7 +455,7 @@ public void testJsonToMap() assertInvalidCast("CAST(unchecked_to_json('{\"a\": 1} 2') AS MAP)", "Cannot cast to map(varchar,bigint). Unexpected trailing token: 2\n{\"a\": 1} 2"); assertInvalidCast("CAST(unchecked_to_json('{\"a\": 1') AS MAP)", "Cannot cast to map(varchar,bigint).\n{\"a\": 1"); - assertInvalidCast("CAST(JSON '{\"a\": \"b\"}' AS MAP)", "Cannot cast to map(varchar,bigint). Can not cast 'b' to BIGINT\n{\"a\":\"b\"}"); + assertInvalidCast("CAST(JSON '{\"a\": \"b\"}' AS MAP)", "Cannot cast to map(varchar,bigint). Cannot cast 'b' to BIGINT\n{\"a\":\"b\"}"); assertInvalidCast("CAST(JSON '{\"a\": 1234567890123.456}' AS MAP)", "Cannot cast to map(varchar,integer). Out of range for integer: 1.234567890123456E12\n{\"a\":1.234567890123456E12}"); assertInvalidCast("CAST(JSON '{\"1\":1, \"01\": 2}' AS MAP)", "Cannot cast to map(bigint,bigint). Duplicate keys are not allowed\n{\"01\":2,\"1\":1}");