[ 
https://issues.apache.org/jira/browse/FLINK-34399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17819354#comment-17819354
 ] 

Ferenc Csaky commented on FLINK-34399:
--------------------------------------

Executed the following test scenarios:
 # Simple datagen table:
{code:sql}
CREATE TABLE IF NOT EXISTS `datagen_table` (
  `col_str` STRING,
  `col_int` INT,
  `col_ts` TIMESTAMP(3),
  WATERMARK FOR `col_ts` AS col_ts - INTERVAL '5' SECOND
) WITH (
  'connector' = 'datagen'
);
{code}
{{asSerializableString()}} result:
{code:sql}
SELECT `col_str`, `col_int`, `col_ts` FROM 
`default_catalog`.`default_database`.`datagen_table`
{code}

 # Aggreagte view:
{code:sql}
CREATE TABLE IF NOT EXISTS `txn_gen` (
  `id` INT,
  `amount` INT,
  `timestamp` TIMESTAMP(3),
  WATERMARK FOR `timestamp` AS `timestamp` - INTERVAL '1' SECOND
) WITH (
  'connector' = 'datagen',
  'fields.id.max' = '5',
  'fields.id.min' = '1',
  'rows-per-second' = '1'
);

CREATE VIEW IF NOT EXISTS `aggr_five_sec` AS SELECT
  `id`,
  COUNT(`id`) AS `txn_count`,
  TUMBLE_ROWTIME(`timestamp`, INTERVAL '5' SECOND) AS `w_row_time`
FROM `txn_gen`
GROUP BY `id`, TUMBLE(`timestamp`, INTERVAL '5' SECOND)
{code}
{{asSerializableString()}} result:
{code:sql}
SELECT `id`, `txn_count`, `w_row_time` FROM 
`default_catalog`.`default_database`.`aggr_five_sec`
{code}

 # Join view:
{code:sql}
CREATE TEMPORARY TABLE IF NOT EXISTS `location_updates` (
  `character_id` INT,
  `location` STRING,
  `proctime` AS PROCTIME()
)
WITH (
  'connector' = 'faker', 
  'fields.character_id.expression' = '#{number.numberBetween ''0'',''100''}',
  'fields.location.expression' = '#{harry_potter.location}'
);

CREATE TEMPORARY TABLE IF NOT EXISTS `characters` (
  `character_id` INT,
  `name` STRING
)
WITH (
  'connector' = 'faker', 
  'fields.character_id.expression' = '#{number.numberBetween ''0'',''100''}',
  'fields.name.expression' = '#{harry_potter.characters}'
);

CREATE TEMPORARY VIEW IF NOT EXISTS `joined` AS SELECT 
  c.character_id,
  l.location,
  c.name
FROM location_updates AS l
JOIN characters FOR SYSTEM_TIME AS OF proctime AS c
ON l.character_id = c.character_id;
{code}
{{asSerializableString()}} result:
{code:sql}
SELECT `character_id`, `location`, `name` FROM 
`default_catalog`.`default_database`.`joined`
{code}

Job execution went fine, all tests gave the expected resulst. Also checked the 
related PRs for this feature, it is very well covered with unit tests, so I 
think it looks good and works as desired.

> Release Testing: Verify FLINK-33644 Make QueryOperations SQL serializable
> -------------------------------------------------------------------------
>
>                 Key: FLINK-34399
>                 URL: https://issues.apache.org/jira/browse/FLINK-34399
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Dawid Wysakowicz
>            Assignee: Ferenc Csaky
>            Priority: Major
>              Labels: release-testing
>
> Test suggestions:
> 1. Write a few Table API programs.
> 2. Call Table.getQueryOperation#asSerializableString, manually verify the 
> produced SQL query
> 3. Check the produced SQL query is runnable and produces the same results as 
> the Table API program:
> {code}
> Table table = tEnv.from("a") ...
> String sqlQuery = table.getQueryOperation().asSerializableString();
> //verify the sqlQuery is runnable
> tEnv.sqlQuery(sqlQuery).execute().collect()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to