EXTERNAL_COLUMNS()
All functions > SOURCE > EXTERNAL_COLUMNS()
Mapping of source columns to features.
Signatures
Returns: Row of data from table source
EXTERNAL_COLUMNS(source_columns: ARRAY<FEATURE>, aliases: ARRAY<FEATURE>, types: ARRAY<TYPE>, bound_columns: ARRAY<FEATURE>, bound_features: ARRAY<FEATURE>, source_type: VARCHAR, source_content: VARCHAR) → ROW sql
| Parameter | Type | Required | Description |
|---|---|---|---|
source_columns | ARRAY<FEATURE> | Yes | Array of source column names |
aliases | ARRAY<FEATURE> | Yes | Array of alias names |
types | ARRAY<TYPE> | Yes | Array of types |
bound_columns | ARRAY<FEATURE> | Yes | Array of bound column names |
bound_features | ARRAY<FEATURE> | Yes | Array of bound feature names |
source_type | VARCHAR | Yes | Source type: TABLE, SQL, CSV, TSV, JSON |
source_content | VARCHAR | Yes | Source content: table name, SQL query, CSV text, TSV text, JSON text |
Examples
CSV mapping with INLINE_COLUMNS (rewrites to EXTERNAL_COLUMNS)
FeatureQL
WITH
orders := ENTITY(),
order_id := INPUT(BIGINT#orders),
fct := INLINE_COLUMNS(
order_id BIGINT#orders BIND TO order_id,
amount DOUBLE
FROM CSV(
order_id,amount
10,99.9
11,50.0
)
),
order_fk := fct[order_id]
SELECT
order_id,
order_fk
FOR
order_id := BIND_VALUES(ARRAY(10, 11))
;Result
| ORDER_ID BIGINT | ORDER_FK BIGINT |
|---|---|
| 10 | 10 |
| 11 | 11 |
EXTERNAL_COLUMNS inside VARIANT (FROM SQL subquery)
FeatureQL
WITH
id := INPUT(VARCHAR),
expr := INPUT(BIGINT),
power := INPUT(BIGINT),
operation := POW(expr, power)
SELECT
expr2 := 2,
result1 := VARIANT(
operation REPLACING expr, power WITH 2, INLINE_COLUMNS(
id VARCHAR BIND TO id,
val BIGINT
FROM CSV(
id,val
a,1
b,1
)
)[val]
)
FOR
id := BIND_VALUES(ARRAY('a', 'b'))
;Result
| EXPR2 BIGINT | RESULT1 BIGINT |
|---|---|
| 2 | 2 |
| 2 | 2 |