RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

    • Overview
    • Quick Start
    • Core Concepts
    • SQL Reference
    • API Reference
    • RuleGo Integration
    • functions

      • Aggregate Functions
      • Analytical Functions
      • Window Functions
        • WINDOW_START - Window Start Time
        • WINDOW_END - Window End Time
        • Extended Window Functions
          • ROW_NUMBER - Row Number Function
          • FIRST_VALUE - First Value Function
          • LEAD - Lead Function
          • NTH_VALUE - Nth Value Function
        • 📚 Related Documentation
      • Math Functions
      • String Functions
      • Conversion Functions
      • DateTime Functions
      • JSON Functions
      • Hash Functions
      • Array Functions
      • Type Check Functions
      • Conditional Functions
      • Multi-row Functions
      • Expression Functions
      • Custom Functions
    • case-studies

目录

Window Functions

# StreamSQL Window Functions

Window functions provide window-related information.

# WINDOW_START - Window Start Time

Syntax: window_start()
Description: Returns the start time of the current window.
Incremental Calculation: ✅ Supported
Example:

SELECT device, window_start() as window_begin, avg(temperature) as avg_temp 
FROM stream 
GROUP BY device, TumblingWindow('10s')
1
2
3

# WINDOW_END - Window End Time

Syntax: window_end()
Description: Returns the end time of the current window.
Incremental Calculation: ✅ Supported
Example:

SELECT device, window_end() as window_finish, avg(temperature) as avg_temp 
FROM stream 
GROUP BY device, TumblingWindow('10s')
1
2
3

# Extended Window Functions

Extended window functions provide more window-related functionality.

# ROW_NUMBER - Row Number Function

Syntax: row_number() OVER (ORDER BY col)
Description: Assigns a unique row number to each row in the result set.
Incremental Calculation: ✅ Supported

# FIRST_VALUE - First Value Function

Syntax: first_value(col) OVER (ORDER BY col)
Description: Returns the value from the first row in the window.
Incremental Calculation: ✅ Supported

# LEAD - Lead Function

Syntax: lead(col, offset, default_value) OVER (ORDER BY col)
Description: Returns the value from the Nth row after the current row.
Incremental Calculation: ✅ Supported

# NTH_VALUE - Nth Value Function

Syntax: nth_value(col, n) OVER (ORDER BY col)
Description: Returns the value from the Nth row in the window.
Incremental Calculation: ✅ Supported

# 📚 Related Documentation

  • Aggregate Functions - Learn detailed usage of aggregate functions
  • Analytical Functions - Learn detailed usage of analytical functions
  • SQL Reference - View complete SQL syntax reference
Edit this page on GitHub (opens new window)
Last Updated: 2025/08/05, 02:24:31
Analytical Functions
Math Functions

← Analytical Functions Math Functions→

Theme by Vdoing | Copyright © 2023-2025 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式