Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
PPLfunzioni di stringa
Nota
Per vedere quali integrazioni di fonti di AWS dati supportano questa PPL funzione, consultaFunzioni.
CONCAT
Utilizzo: CONCAT(str1,
str2, ...., str_9)
somma fino a 9 stringhe insieme.
Tipo di argomento:
STRING, STRING, ...., STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `CONCAT('hello', 'world')` = CONCAT('hello', 'world'), `CONCAT('hello ', 'whole ', 'world', '!')` = CONCAT('hello ', 'whole ', 'world', '!') | fields `CONCAT('hello', 'world')`, `CONCAT('hello ', 'whole ', 'world', '!')` fetched rows / total rows = 1/1 +----------------------------+--------------------------------------------+ | CONCAT('hello', 'world') | CONCAT('hello ', 'whole ', 'world', '!') | |----------------------------+--------------------------------------------| | helloworld | hello whole world! | +----------------------------+--------------------------------------------+
CONCAT_WS
Utilizzo: CONCAT_WS(sep, str1,
str2)
concatena due o più stringhe utilizzando un separatore specificato tra di loro.
Tipo di argomento:
STRING, STRING, ...., STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `CONCAT_WS(',', 'hello', 'world')` = CONCAT_WS(',', 'hello', 'world') | fields `CONCAT_WS(',', 'hello', 'world')` fetched rows / total rows = 1/1 +------------------------------------+ | CONCAT_WS(',', 'hello', 'world') | |------------------------------------| | hello,world | +------------------------------------+
LENGTH
Utilizzo: length(str)
restituisce la lunghezza della stringa di input misurata in byte.
Tipo di argomento:
STRING
Tipo di restituzione: INTEGER
Esempio:
os> source=people | eval `LENGTH('helloworld')` = LENGTH('helloworld') | fields `LENGTH('helloworld')` fetched rows / total rows = 1/1 +------------------------+ | LENGTH('helloworld') | |------------------------| | 10 | +------------------------+
LOWER
Utilizzo: lower(string)
converte la stringa di input in lettere minuscole.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `LOWER('helloworld')` = LOWER('helloworld'), `LOWER('HELLOWORLD')` = LOWER('HELLOWORLD') | fields `LOWER('helloworld')`, `LOWER('HELLOWORLD')` fetched rows / total rows = 1/1 +-----------------------+-----------------------+ | LOWER('helloworld') | LOWER('HELLOWORLD') | |-----------------------+-----------------------| | helloworld | helloworld | +-----------------------+-----------------------+
LTRIM
Utilizzo: ltrim(str)
rimuove i caratteri spaziali iniziali dalla stringa di input.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `LTRIM(' hello')` = LTRIM(' hello'), `LTRIM('hello ')` = LTRIM('hello ') | fields `LTRIM(' hello')`, `LTRIM('hello ')` fetched rows / total rows = 1/1 +---------------------+---------------------+ | LTRIM(' hello') | LTRIM('hello ') | |---------------------+---------------------| | hello | hello | +---------------------+---------------------+
POSITION
Utilizzo: POSITION(substr
IN str)
restituisce la posizione della prima occorrenza della sottostringa nella stringa. Restituisce 0 se la sottostringa non è nella stringa. Restituisce NULL se un argomento èNULL.
Tipo di argomento:
STRING, STRING
Tipo di restituzione INTEGER
Esempio:
os> source=people | eval `POSITION('world' IN 'helloworld')` = POSITION('world' IN 'helloworld'), `POSITION('invalid' IN 'helloworld')`= POSITION('invalid' IN 'helloworld') | fields `POSITION('world' IN 'helloworld')`, `POSITION('invalid' IN 'helloworld')` fetched rows / total rows = 1/1 +-------------------------------------+---------------------------------------+ | POSITION('world' IN 'helloworld') | POSITION('invalid' IN 'helloworld') | |-------------------------------------+---------------------------------------| | 6 | 0 | +-------------------------------------+---------------------------------------+
REVERSE
Utilizzo: REVERSE(str)
restituisce la stringa invertita della stringa di input.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `REVERSE('abcde')` = REVERSE('abcde') | fields `REVERSE('abcde')` fetched rows / total rows = 1/1 +--------------------+ | REVERSE('abcde') | |--------------------| | edcba | +--------------------+
RIGHT
Utilizzo: right(str,
len)
restituisce i caratteri più a destra della stringa di input. Restituisce 0 se la sottostringa non è nella stringa. Restituisce NULL se un argomento èNULL.
Tipo di argomento:
STRING, INTEGER
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `RIGHT('helloworld', 5)` = RIGHT('helloworld', 5), `RIGHT('HELLOWORLD', 0)` = RIGHT('HELLOWORLD', 0) | fields `RIGHT('helloworld', 5)`, `RIGHT('HELLOWORLD', 0)` fetched rows / total rows = 1/1 +--------------------------+--------------------------+ | RIGHT('helloworld', 5) | RIGHT('HELLOWORLD', 0) | |--------------------------+--------------------------| | world | | +--------------------------+--------------------------+
RTRIM
Utilizzo: rtrim(str)
elimina i caratteri spaziali finali dalla stringa di input.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `RTRIM(' hello')` = RTRIM(' hello'), `RTRIM('hello ')` = RTRIM('hello ') | fields `RTRIM(' hello')`, `RTRIM('hello ')` fetched rows / total rows = 1/1 +---------------------+---------------------+ | RTRIM(' hello') | RTRIM('hello ') | |---------------------+---------------------| | hello | hello | +---------------------+---------------------+
SUBSTRING
Utilizzo: substring(str,
start)
o substring(str, start, length)
restituisce una sottostringa della stringa di input. Senza una lunghezza specificata, restituisce l'intera stringa dalla posizione iniziale.
Tipo di argomento:
STRING, INTEGER, INTEGER
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `SUBSTRING('helloworld', 5)` = SUBSTRING('helloworld', 5), `SUBSTRING('helloworld', 5, 3)` = SUBSTRING('helloworld', 5, 3) | fields `SUBSTRING('helloworld', 5)`, `SUBSTRING('helloworld', 5, 3)` fetched rows / total rows = 1/1 +------------------------------+---------------------------------+ | SUBSTRING('helloworld', 5) | SUBSTRING('helloworld', 5, 3) | |------------------------------+---------------------------------| | oworld | owo | +------------------------------+---------------------------------+
TRIM
Utilizzo: trim(string)
rimuove gli spazi bianchi iniziali e finali dalla stringa di input.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `TRIM(' hello')` = TRIM(' hello'), `TRIM('hello ')` = TRIM('hello ') | fields `TRIM(' hello')`, `TRIM('hello ')` fetched rows / total rows = 1/1 +--------------------+--------------------+ | TRIM(' hello') | TRIM('hello ') | |--------------------+--------------------| | hello | hello | +--------------------+--------------------+
UPPER
Utilizzo: upper(string)
converte la stringa di input in maiuscolo.
Tipo di argomento:
STRING
Tipo di restituzione: STRING
Esempio:
os> source=people | eval `UPPER('helloworld')` = UPPER('helloworld'), `UPPER('HELLOWORLD')` = UPPER('HELLOWORLD') | fields `UPPER('helloworld')`, `UPPER('HELLOWORLD')` fetched rows / total rows = 1/1 +-----------------------+-----------------------+ | UPPER('helloworld') | UPPER('HELLOWORLD') | |-----------------------+-----------------------| | HELLOWORLD | HELLOWORLD | +-----------------------+-----------------------+