Skip to content

[FEATURE] Predicate Push Down Abstract Implementation #223

Closed

Description

@jeffreyaven

Feature Description
Design and implement an abstract interface (through a provider's x-stackQL-resources object) to take advantage of predicate push down to limit data (columns and/or rows) returned.

Example(s)
Given API operations which map to SELECT verbs in StackQL, identify the optional query parameters which can be mapped to the following operation:

  • column list for projection, invoked using SELECT <field1>, <field2> including fields operated on by scalar functions (such as SPLIT_PART, JSON_EXTRACT, etc.)
  • limiting records returned, invoked using LIMIT <num>
  • filter expressions, invoked using WHERE <field> = '<something>'
  • ordering predicates, invoked using ORDER BY <field>

for example...

  parameters:
    fields:
      description: Selector specifying which fields to include in a partial response.
      in: query
      name: fields
      schema:
        type: string

Create a document based interface to map verbs in the parser to the specified query parameters.

Possible Approaches or Libraries to Consider
A possible approach would be to create an extension to the provider interface for example...

components:
    x-stackQL-resources:
        databases:
          id: google.spanner.databases
          name: databases
          title: Databases
          methods:
            projects_instances_databases_get:
              operation:
                $ref: '#/paths/~1v1~1projects~1{projectsId}~1instances~1{instancesId}~1databases~1{databasesId}/get'
              response:
                mediaType: application/json
                openAPIDocKey: '200'
            projects_instances_databases_list:
              operation:
                $ref: '#/paths/~1v1~1projects~1{projectsId}~1instances~1{instancesId}~1databases/get'
              response:
                mediaType: application/json
                openAPIDocKey: '200'
                objectKey: $.databases
            ...
          sqlVerbs:
            select:
              - $ref: '#/components/x-stackQL-resources/databases/methods/projects_instances_databases_get'
              - $ref: '#/components/x-stackQL-resources/databases/methods/projects_instances_databases_list'
            insert:
              - $ref: '#/components/x-stackQL-resources/databases/methods/projects_instances_databases_create'
            update: []
            delete: []
          predicates:
            select:
              rowFilter: 
                param: filter
                example: "column1 = 'value1' AND column2 = 'value2'"
              colFilter:
                param: fields
                example: "column1,column2"
              orderBy:
                param: orderBy
                example: "column1 ASC"
              limit:
                param: limit
                example: 10

may need to implement generalized formats for each type of predicate.

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

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions