[
https://issues.apache.org/jira/browse/BEAM-10213?focusedWorklogId=443227&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-443227
]
ASF GitHub Bot logged work on BEAM-10213:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Jun/20 16:43
Start Date: 09/Jun/20 16:43
Worklog Time Spent: 10m
Work Description: amaliujia commented on a change in pull request #11948:
URL: https://github.com/apache/beam/pull/11948#discussion_r436967724
##########
File path:
sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java
##########
@@ -3565,19 +3566,16 @@ public void testCaseWithValueNoElseNoMatch() {
}
@Test
- @Ignore(
- "Codegen generates code that Janino cannot compile, need further
investigation on root"
- + " cause.")
public void testCastToDateWithCase() {
String sql =
"SELECT f_int, \n"
+ "CASE WHEN CHAR_LENGTH(TRIM(f_string)) = 8 \n"
+ " THEN CAST (CONCAT(\n"
- + " SUBSTR(TRIM(f_string), 0, 4) \n"
+ + " SUBSTR(TRIM(f_string), 1, 4) \n"
Review comment:
SUBSTR count the first char from position 1.
##########
File path:
sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java
##########
@@ -3565,19 +3566,16 @@ public void testCaseWithValueNoElseNoMatch() {
}
@Test
- @Ignore(
- "Codegen generates code that Janino cannot compile, need further
investigation on root"
- + " cause.")
public void testCastToDateWithCase() {
String sql =
"SELECT f_int, \n"
+ "CASE WHEN CHAR_LENGTH(TRIM(f_string)) = 8 \n"
+ " THEN CAST (CONCAT(\n"
- + " SUBSTR(TRIM(f_string), 0, 4) \n"
+ + " SUBSTR(TRIM(f_string), 1, 4) \n"
Review comment:
SUBSTR counts the first char from position 1.
##########
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:
Thanks!
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 443227)
Time Spent: 50m (was: 40m)
> @Ignore: fix the test for testCastToDateWithCase
> ------------------------------------------------
>
> Key: BEAM-10213
> URL: https://issues.apache.org/jira/browse/BEAM-10213
> Project: Beam
> Issue Type: Bug
> Components: dsl-sql-zetasql
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: P2
> Labels: beam-fixit
> Fix For: Not applicable
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Fix this ignored test: testCastToDateWithCase()
> There are two improvements:
> 1. SUBSTR's usage is wrong in the original test. E.g. ZetaSQL SUBSTR count
> position from 1.
> 2. Expected output row was't used DATE as a logical type.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)