[ 
https://issues.apache.org/jira/browse/FLINK-27888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

songwenbin updated FLINK-27888:
-------------------------------
    Docs Text: 
In Flink1.15 
1. put attachment jar to directory:  ./flink-release-1.15/build-target/lib/ , 
eg: ./flink-release-1.15/build-target/lib/flink-demo-1.0-SNAPSHOT.jar
2. start flink local cluster:  
./flink-release-1.15/build-target/start-cluster.sh
3. start sql-client:./flink-release-1.15/build-target/sql-client.sh
4. step by step exec below sql script in sql-client: 

CREATE  FUNCTION ddd AS 'org.example.SumHopWindowUpsertVal';


CREATE TABLE monthly_source_5 (
        item            STRING,
        val             DOUBLE,
        ts              BIGINT,
        isEnergy        BIGINT,
        shiftId         INTEGER,
        eventTime       BIGINT,
        event_time      AS TO_TIMESTAMP_LTZ(eventTime, 3),
        process_time    AS PROCTIME(),
        projectId       AS 1,        
        WATERMARK FOR event_time AS event_time)
    WITH ('connector' = 'kafka','topic' = 
'daily-consumption','properties.bootstrap.servers' = 
'KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS', 'properties.group.id' = 
'poem-consumergroup-flink-v2',  'value.format' = 'json','scan.startup.mode' = 
'latest-offset');

CREATE VIEW daily_last_value_with_monthly_frame5 AS
    SELECT
        item AS tag,
        val,
        ts,        
        process_time,
        isEnergy,
        eventTime,
        event_time,
        1  AS frame
    FROM monthly_source_5
    WHERE shiftId =0;

CREATE VIEW energy_monthly_consumptions5 AS
    SELECT
        tag,
        ts                               AS ts,
        1  AS monthFrameTs,
        val                              AS val,
        eventTime,
        event_time,
        isEnergy
    FROM daily_last_value_with_monthly_frame5;

CREATE VIEW monthly_consumption_result_10 AS    
    SELECT
        tag                         AS tag,
        monthFrameTs                AS ts,
        ddd(
            ts,
            val,
            monthFrameTs)           AS val,
        MAX(eventTime)              AS eventTime,
        1                           AS isEnergy                
    FROM TABLE(
        HOP(TABLE energy_monthly_consumptions5, DESCRIPTOR(event_time), 
INTERVAL '1' DAYS, INTERVAL '31' DAYS))
    WHERE isEnergy = 1
    GROUP BY tag, monthFrameTs, window_start, window_end;

select * from monthly_consumption_result_10;

  was:
In Flink1.15 
1. put attachment jar to directory:  ./flink-release-1.15/build-target/lib/ , 
eg: ./flink-release-1.15/build-target/lib/flink-demo-1.0-SNAPSHOT.jar
2. start flink local cluster:  
./flink-release-1.15/build-target/start-cluster.sh
3. start sql-client:./flink-release-1.15/build-target/sql-client.sh
4. step by step exec below sql script in sql-client: 

SET 'execution.runtime-mode' = 'streaming';

CREATE  FUNCTION ddd AS 'org.example.SumHopWindowUpsertVal';


CREATE TABLE monthly_source_5 (
        item            STRING,
        val             DOUBLE,
        ts              BIGINT,
        isEnergy        BIGINT,
        shiftId         INTEGER,
        eventTime       BIGINT,
        event_time      AS TO_TIMESTAMP_LTZ(eventTime, 3),
        process_time    AS PROCTIME(),
        projectId       AS 1,        
        WATERMARK FOR event_time AS event_time)
    WITH ('connector' = 'kafka','topic' = 
'daily-consumption','properties.bootstrap.servers' = 
'KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS', 'properties.group.id' = 
'poem-consumergroup-flink-v2',  'value.format' = 'json','scan.startup.mode' = 
'latest-offset');

CREATE VIEW daily_last_value_with_monthly_frame5 AS
    SELECT
        item AS tag,
        val,
        ts,        
        process_time,
        isEnergy,
        eventTime,
        event_time,
        1  AS frame
    FROM monthly_source_5
    WHERE shiftId =0;

CREATE VIEW energy_monthly_consumptions5 AS
    SELECT
        tag,
        ts                               AS ts,
        1  AS monthFrameTs,
        val                              AS val,
        eventTime,
        event_time,
        isEnergy
    FROM daily_last_value_with_monthly_frame5;

CREATE VIEW monthly_consumption_result_10 AS    
    SELECT
        tag                         AS tag,
        monthFrameTs                AS ts,
        ddd(
            ts,
            val,
            monthFrameTs)           AS val,
        MAX(eventTime)              AS eventTime,
        1                           AS isEnergy                
    FROM TABLE(
        HOP(TABLE energy_monthly_consumptions5, DESCRIPTOR(event_time), 
INTERVAL '1' DAYS, INTERVAL '31' DAYS))
    WHERE isEnergy = 1
    GROUP BY tag, monthFrameTs, window_start, window_end;

select * from monthly_consumption_result_10;


> SQL Error in Flink1.15
> ----------------------
>
>                 Key: FLINK-27888
>                 URL: https://issues.apache.org/jira/browse/FLINK-27888
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 1.15.0
>         Environment: mac os , linux
>            Reporter: songwenbin
>            Priority: Major
>         Attachments: flink-sql-demo-1.0-SNAPSHOT.jar
>
>
> In flink1.15 ,  if sql include UDF(AggregateFunction) and HOP windown , it 
> execute error : Cannot determine simple type name 'org' .
> Flink1.14 or flink1.15 is fine.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to