rdblue commented on code in PR #17138:
URL: https://github.com/apache/iceberg/pull/17138#discussion_r3591183648


##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -2606,7 +2630,194 @@ components:
         child:
           $ref: '#/components/schemas/Expression'
 
+    UnaryPredicate:
+      description: >
+        A predicate that tests a single value expression. Replaces the 
deprecated
+        UnaryExpression that used 'term'.
+      type: object
+      required:
+        - type
+        - child
+      properties:
+        type:
+          $ref: '#/components/schemas/ExpressionType'
+          enum: ["is-null", "not-null", "is-nan", "not-nan"]
+        child:
+          $ref: '#/components/schemas/ValueExpression'
+
+    ComparisonPredicate:
+      description: >
+        A predicate that compares two value expressions. Replaces the 
deprecated
+        LiteralExpression that used 'term' and 'value'.
+      type: object
+      required:
+        - type
+        - left
+        - right
+      properties:
+        type:
+          $ref: '#/components/schemas/ExpressionType'
+          enum: ["lt", "lt-eq", "gt", "gt-eq", "eq", "not-eq", "starts-with", 
"not-starts-with"]
+        left:
+          $ref: '#/components/schemas/ValueExpression'
+        right:
+          $ref: '#/components/schemas/ValueExpression'
+
+    SetPredicate:
+      description: >
+        A predicate that tests whether a value expression is in a set of 
literals.
+        Replaces the deprecated SetExpression that used 'term'.
+      type: object
+      required:
+        - type
+        - child
+        - values
+      properties:
+        type:
+          $ref: '#/components/schemas/ExpressionType'
+          enum: ["in", "not-in"]
+        child:
+          $ref: '#/components/schemas/ValueExpression'
+        values:
+          $ref: '#/components/schemas/Literals'
+
+    Literal:
+      description: >
+        A literal value expression per Iceberg Expressions spec, Appendix B.
+        Three JSON forms are accepted: a bare scalar value, a typed literal
+        object without a data-type, or a typed literal object with an
+        explicit data-type.
+      oneOf:
+        - type: string
+        - type: number
+        - type: integer
+        - type: boolean
+        - type: 'null'
+        - type: object
+          required:
+            - type
+            - value
+          properties:
+            type:
+              type: string
+              const: "literal"
+            value:
+              $ref: '#/components/schemas/PrimitiveTypeValue'
+            data-type:
+              $ref: '#/components/schemas/PrimitiveType'
+
+    Literals:
+      description: >
+        A set of literal values per Iceberg Expressions spec, Appendix B.
+        Two JSON forms: a bare array of literals, or a typed object with an
+        explicit data-type applied to all values.
+      oneOf:
+        - type: array
+          items:
+            $ref: '#/components/schemas/Literal'
+        - type: object
+          required:
+            - type
+            - values
+          properties:
+            type:
+              type: string
+              const: "literals"
+            values:
+              type: array
+              items:
+                $ref: '#/components/schemas/PrimitiveTypeValue'
+            data-type:
+              $ref: '#/components/schemas/PrimitiveType'
+
+    FieldReference:

Review Comment:
   > This allows expressions to specify which variant they accept.
   
   I don't think this is correct. We don't have a `ValueReference` that is 
limited to `FieldReferenceById` or `FieldReferenceByName`. It would be hard to 
add one given that we would have to have similarly restricted predicate types. 
That would create 2 trees (predicates and value expressions with ID references, 
predicates and value expressions with named references) as well as types that 
allow both references.
   
   I think it is better to approach this problem by specifying whether a given 
expression must use only ID or name references in its documentation rather than 
making this spec quite a bit larger to make it structural.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to