Skip to content

fix(tvf): validate non-negative width and height in pattern_match#17515

Open
linxt20 wants to merge 1 commit intoapache:masterfrom
linxt20:fix/shape_pattern_v2
Open

fix(tvf): validate non-negative width and height in pattern_match#17515
linxt20 wants to merge 1 commit intoapache:masterfrom
linxt20:fix/shape_pattern_v2

Conversation

@linxt20
Copy link
Copy Markdown
Contributor

@linxt20 linxt20 commented Apr 18, 2026

Description

Add validation for negative width and height parameters in the pattern_match table-valued function. Previously, passing a negative value for either parameter was silently accepted and produced an empty result set with no indication of misuse, which is inconsistent with how smooth and threshold are already validated.

Changes

  • PatternMatchTableFunction.analyze(): Add non-negative checks for WIDTH_PARAM and HEIGHT_PARAM. A negative value now throws UDFException with a clear message, matching the existing behavior of smooth / threshold.
  • IoTDBWindowTVFIT: Add two integration test cases asserting that width => -1.0 and height => -10.0 are rejected with the expected error messages.

Before

IoTDB:test_db> select * from pattern_match(
  ..., width => -1.0, height => 500.0, ...);
Empty set.    -- silently returns nothing

After

IoTDB:test_db> select * from pattern_match(
  ..., width => -1.0, ...);
Error: width must be a non-negative number, but got: -1.0

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Test case

Compatibility

No behavioral change for valid (non-negative) inputs. Only previously-undefined behavior with negative inputs is now rejected at analysis time.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant