Skip to content

Feature Request: Implement MATCH_RECOGNIZE for Advanced Pattern Matching #13583

Closed

Description

@zhuliquan

Is your feature request related to a problem or challenge?

The MATCH_RECOGNIZE clause, introduced in SQL:2016, provides powerful capabilities for pattern matching in data streams or tables. It is particularly useful for scenarios such as identifying user behavior patterns—for example, determining which users followed a specific sequence of page views and actions on a website before opening a support ticket or completing a purchase. I noticed that datafusion-sqlparser-rs can parse SQL queries which contain the MATCH_RECOGNIZE clause, which could serve as a foundation for implementation. Is there any interest in implementing this feature?

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. geoffreyclaude commented on Jul 1, 2025

    @geoffreyclaude
    Contributor

    take

  2. geoffreyclaude commented on Jul 1, 2025

    @geoffreyclaude
    Contributor

    I've got a pretty terrible hackathon POC which more or less works. I'll clean it up and hopefully open up a draft PR by the end of the week for follow up discussions!

  3. geoffreyclaude commented on Jul 8, 2025

    @geoffreyclaude
    Contributor

    I'm pretty much AFK until September, so sharing what I've got so far: #16685

    As written in the PR description, this is a partial POC of MATCH_RECOGNIZE, restricted to no cross referencing symbols in the DEFINE clause, and no streaming support (fully buffered as the WindowAgg node.)

    The goal was really to explore if MATCH_RECOGNIZE could be built using existing DataFusion operators. Besides the core pattern matching part, it does seem pretty feasible!

  4. added
    PROPOSAL EPICA proposal being discussed that is not yet fully underway
    on Sep 26, 2025
  5. geoffreyclaude commented on Oct 15, 2025

    @geoffreyclaude
    Contributor

    MATCH_RECOGNIZE is most probably too complex to integrate in the core DataFusion. As mentioned in #16505 (comment) for TABLESAMPLE, I believe it would make more sense to develop it as an extension in datafusion-contrib.
    I've opened #18078, which is a prerequisite to allow building such extensions.

  6. alamb commented on Aug 11, 2026

    @alamb
    Contributor

    Thanks to @geoffreyclaude 's work to enable extensibility in planning, this is now possible

    You can read about how this works in the blog Extending SQL in DataFusion: from ->> to TABLESAMPLE (https://datafusion.apache.org/blog/2026/01/12/extending-sql/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

PROPOSAL EPICA proposal being discussed that is not yet fully underwayenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions