Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support push down Sort/Filter into TableScanBuilder through Project #2894

Open
qianheng-aws opened this issue Aug 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@qianheng-aws
Copy link
Contributor

Is your feature request related to a problem?
Sort or Filter cannot be pushed down into TableScan due to Project.

POST _plugins/_ppl/_explain
{
  "query": """
    source=opensearch_dashboards_sample_data_flights | fields FlightTimeMin |where FlightTimeMin > 0  |  sort FlightTimeMin 
  """
}

# response

{
  "root": {
    "name": "ProjectOperator",
    "description": {
      "fields": "[FlightTimeMin]"
    },
    "children": [
      {
        "name": "SortOperator",
        "description": {
          "sortList": {
            "FlightTimeMin": {
              "sortOrder": "ASC",
              "nullOrder": "NULL_FIRST"
            }
          }
        },
        "children": [
          {
            "name": "FilterOperator",
            "description": {
              "conditions": ">(FlightTimeMin, 0)"
            },
            "children": [
              {
                "name": "ProjectOperator",
                "description": {
                  "fields": "[FlightTimeMin]"
                },
                "children": [
                  {
                    "name": "OpenSearchIndexScan",
                    "description": {
                      "request": """OpenSearchQueryRequest(indexName=opensearch_dashboards_sample_data_flights, sourceBuilder={"from":0,"size":200,"timeout":"1m","_source":{"includes":["FlightTimeMin"],"excludes":[]}}, searchDone=false)"""
                    },
                    "children": []
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

What solution would you like?
Option1: remove ProjectOperator after pushed it down into TableScan. Not clear of the background why we intentionally wants to keep it here.

public boolean pushDownProject(LogicalProject project) {
requestBuilder.pushDownProjects(findReferenceExpressions(project.getProjectList()));
// Return false intentionally to keep the original project operator
return false;

Option2: support push down Sort/Filter under Project.

What alternatives have you considered?

Do you have any additional context?
Add any other context or screenshots about the feature request here.

@qianheng-aws qianheng-aws added enhancement New feature or request untriaged labels Aug 2, 2024
@dblock dblock removed the untriaged label Aug 26, 2024
@dblock
Copy link
Member

dblock commented Aug 26, 2024

[Catch All Triage - 1, 2, 3, 4, 5]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants