Skip to content

Lookup Join returns 0 rows when given a literal value #19188

Description

@timothy-e

To reproduce, add the following test to pinot-query-runtime/src/test/resources/queries/LookupJoin.json:

  "lookup_join_literal_key": {
    "comment": "Tests a lookup join where one dimension primary-key component is supplied as a literal in the join condition.",
    "tables": {
      "fact_tbl": {
        "schema": [
          {"name": "rate_start_date", "type": "LONG"}
        ],
        "inputs": [
          [1]
        ]
      },
      "dim_tbl": {
        "schema": [
          {"name": "currency", "type": "STRING"},
          {"name": "rate_start_date", "type": "LONG"},
          {"name": "rate", "type": "INT"}
        ],
        "inputs": [
          ["gbp", 1, 125],
          ["usd", 1, 100]
        ],
        "replicated": true,
        "isDimTable": true,
        "primaryKeyColumns": ["currency", "rate_start_date"]
      }
    },
    "queries": [
      {
        "description": "Lookup join with a literal dimension primary-key component",
        "sql": "SELECT /*+ joinOptions(join_strategy='lookup') */ {dim_tbl}.currency, {dim_tbl}.rate FROM {fact_tbl} JOIN {dim_tbl} ON {dim_tbl}.currency = 'gbp' AND {dim_tbl}.rate_start_date = {fact_tbl}.rate_start_date",
        "outputs": [
          ["gbp", 125]
        ]
      }
    ]
  }

Then run it:

  ./mvnw -pl pinot-query-runtime -am \
    -Dtest='ResourceBasedQueriesTest#testQueryTestCasesWithOutput' \
    -Dpinot.fileFilter=LookupJoin \
    -Dsurefire.failIfNoSpecifiedTests=false \
    test

It fails with

Mismatched number of results.
Expected Rows:
[gbp, 125]
Actual Rows:
 expected [1] but found [0]

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working as expectedmulti-stageRelated to the multi-stage query enginequeryRelated to query processing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions