[ISSUE-358] Implement ISO-GQL labeled predicate - #824
Open
yyyCode wants to merge 1 commit into
Open
Conversation
Adds the ISO-GQL <labeled predicate> (ISO/IEC 39075 Section 19.9), which tests whether a graph element (vertex or edge) carries a given label. Following the pattern of the already-merged source/destination predicate (apache#366), this is implemented as built-in UDFs rather than a grammar change: - `IS_LABELED(element, label)` — TRUE if the element has the label. - `IS_NOT_LABELED(element, label)` — the negation. Both follow ISO-GQL three-valued logic: a null element or null label yields Unknown (null). The shared logic lives in `LabeledPredicateFunctions` (geaflow-dsl-common); the UDFs delegate to it and are registered in `BuildInSqlFunctionTable`. Tests: - `LabeledPredicateFunctionsTest` (geaflow-dsl-common) unit-tests the logic directly: vertex/edge labels, negation, three-valued null handling, and rejection of non-graph-element operands. - `GQLLabeledPredicateTest` (geaflow-dsl-runtime) is an end-to-end `.sql`/`.txt` case over the modern graph; expected outputs were computed by hand from the graph data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yaozhongq
self-requested a review
August 3, 2026 07:58
yaozhongq
reviewed
Aug 3, 2026
Contributor
There was a problem hiding this comment.
This package is intended for general-purpose interfaces. There is no need to split the current function into a separate Func; I suggest placing it directly into the UDF.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Closes #358.
Implements the ISO-GQL
<labeled predicate>(ISO/IEC 39075 Section 19.9), which tests whether a graph element (vertex or edge) carries a given label.Following the pattern of the already-merged source/destination predicate (#366 / PR #675), this is implemented as built-in UDFs rather than a grammar change:
IS_LABELED(element, label)— returns TRUE if the vertex/edge has the given label, FALSE otherwise.IS_NOT_LABELED(element, label)— the negation.Both follow ISO-GQL three-valued logic: a null element or null label yields Unknown (
null). A non-graph-element first operand raises a clearIllegalArgumentException.Files:
LabeledPredicateFunctions(geaflow-dsl-common) — shared static logic.IsLabeled/IsNotLabeled(geaflow-dsl-plan) — UDFs delegating to the logic, registered inBuildInSqlFunctionTable.Example:
How was this PR tested?
Tests have Added for the changes
Production environment verified
LabeledPredicateFunctionsTest(geaflow-dsl-common): unit-tests the logic directly — vertex/edge label matching, negation, three-valued null handling, and rejection of non-graph-element operands. Passes 5/5 locally.GQLLabeledPredicateTest(geaflow-dsl-runtime): an end-to-end.sql/.txtcase over themoderngraph, exercisingIS_LABELED/IS_NOT_LABELEDon both vertices and edges. Expected outputs were computed by hand from the graph data (not copied from program output).mvn checkstyle:checkreports 0 violations across the three touched modules.