robinyqiu commented on a change in pull request #11948: URL: https://github.com/apache/beam/pull/11948#discussion_r436981137
########## File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java ########## @@ -3587,11 +3585,14 @@ public void testCastToDateWithCase() { PCollection<Row> stream = BeamSqlRelUtils.toPCollection(pipeline, beamRelNode); Schema resultType = - Schema.builder().addInt32Field("f_int").addNullableField("f_date", DATETIME).build(); + Schema.builder() + .addInt64Field("f_long") + .addNullableField("f_date", FieldType.logicalType(SqlTypes.DATE)) + .build(); PAssert.that(stream) .containsInAnyOrder( - Row.withSchema(resultType).addValues(1, parseDate("2018-10-18")).build()); + Row.withSchema(resultType).addValues(1L, parseDateToLocalDate("2018-10-18")).build()); Review comment: I think you don't have to implement a 'parseDateToLocalDate' function yourself. You can use `LocalDate.of(y, m, d)` or 'LocalDate.parse("yyyy-mm-dd")' directly. ########## File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java ########## @@ -3587,11 +3585,14 @@ public void testCastToDateWithCase() { PCollection<Row> stream = BeamSqlRelUtils.toPCollection(pipeline, beamRelNode); Schema resultType = - Schema.builder().addInt32Field("f_int").addNullableField("f_date", DATETIME).build(); + Schema.builder() + .addInt64Field("f_long") + .addNullableField("f_date", FieldType.logicalType(SqlTypes.DATE)) + .build(); PAssert.that(stream) .containsInAnyOrder( - Row.withSchema(resultType).addValues(1, parseDate("2018-10-18")).build()); + Row.withSchema(resultType).addValues(1L, parseDateToLocalDate("2018-10-18")).build()); Review comment: I think you don't have to implement a 'parseDateToLocalDate' function yourself. You can use `LocalDate.of(y, m, d)` or `LocalDate.parse("yyyy-mm-dd")` directly. ########## File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java ########## @@ -3587,11 +3585,14 @@ public void testCastToDateWithCase() { PCollection<Row> stream = BeamSqlRelUtils.toPCollection(pipeline, beamRelNode); Schema resultType = - Schema.builder().addInt32Field("f_int").addNullableField("f_date", DATETIME).build(); + Schema.builder() + .addInt64Field("f_long") + .addNullableField("f_date", FieldType.logicalType(SqlTypes.DATE)) + .build(); PAssert.that(stream) .containsInAnyOrder( - Row.withSchema(resultType).addValues(1, parseDate("2018-10-18")).build()); + Row.withSchema(resultType).addValues(1L, parseDateToLocalDate("2018-10-18")).build()); Review comment: I think you don't have to implement a `parseDateToLocalDate` function yourself. You can use `LocalDate.of(y, m, d)` or `LocalDate.parse("yyyy-mm-dd")` directly. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org