diff --git a/sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java b/sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java index 8a68154f2a9bd..af0a22b036030 100644 --- a/sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java +++ b/sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java @@ -216,7 +216,7 @@ private static String timestampToString(Timestamp ts) { String timestampString = String.valueOf(ts); String formatted = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(ts); - if (timestampString.length() > 19 && timestampString.substring(19) != ".0") { + if (timestampString.length() > 19 && !timestampString.substring(19).equals(".0")) { return formatted + timestampString.substring(19); } else { return formatted;