# Lookup UDF Join

Lookup UDF is used to get dimension data via primary key from a dimension table allowing a decoration join functionality. Lookup UDF can only be used with [a dimension table](https://docs.pinot.apache.org/release-0.11.0/basics/data-import/batch-ingestion/dim-table) in Pinot. The UDF signature is as below:

```
lookUp('dimTableName', 'dimColToLookUp', 'dimJoinKey1', factJoinKeyVal1, 'dimJoinKey2', factJoinKeyVal2 ... )
```

* `dimTableName` Name of the dim table to perform the lookup on.&#x20;
* `dimColToLookUp` The column name of the dim table to be retrieved to decorate our result.
* `dimJoinKey` The column name on which we want to perform the lookup i.e. the join column name for dim table.&#x20;
* `factJoinKeyVal` The value of the dim table join column for which we will retrieve the dimColToLookUp for the scope and invocation.&#x20;

Return type of the UDF will be that of the dimColToLookUp column type. There can also be multiple primary keys and corresponding values.

{% hint style="warning" %}
**Note**: If the dimension table uses a composite primary key i.e multiple primary keys, then ensure that the order of keys appearing in the lookup() UDF is same as the order defined for **"primaryKeyColumns"** in the dimension table schema.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/release-0.11.0/users/user-guide-query/lookup-udf-join.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
