नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Applies to:
Databricks SQL
Databricks Runtime
Returns the nth expression in an inline provided list of values. Provides a compact way to convert a numeric index into a corresponding string from a predefined list.
It works well for translating stored codes into readable labels. For dynamic labels (e.g., stored in a domain table or non-consecutive), a JOIN or CASE expression is more maintainable.
Syntax
elt(index, expr1 [, ...])
Arguments
index: An INTEGER expression greater than 0.exprN: Any expression that shares a least common type with allexprN.
Returns
The result has the type of the least common type of the exprN.
Index must be between 1 and the number of expr. If index is out of bounds, an INVALID_ARRAY_INDEX error is raised.
Note
In Databricks Runtime, if spark.sql.ansi.enabled is false, the function returns NULL instead of an error if the index is out of bounds.
Examples
> SELECT elt(1, 'scala', 'java');
scala