Upsolver
Contact Support
  • Welcome to Upsolver
  • Getting Started
    • Start using Upsolver for free
    • Get started as a Upsolver user
      • Upsolver in 5 minutes
        • Upsolver Quickstart in 5 minutes
          • Additional sandbox fun
        • Amazon Athena data output
        • MySQL (AWS RDS) data output
        • Local MySQL data output
      • Upsolver free training
        • Introduction to Upsolver
          • Transform and write data to Amazon Athena
          • Pre-aggregate data for efficiency and performance
          • UPSERT streaming data to Amazon Athena
      • Prerequisites for AWS deployment
      • AWS integration
      • Deploy Upsolver on your AWS account
      • Prerequisites for Azure Deployment
      • Azure Integration
        • Prerequisites for Azure Users
        • Log into Upsolver
        • Log into Azure & Authenticate
        • Set Up and Deploy Azure Resources
        • Delegate Resource Group, and Deploy Upsolver in Azure
        • Integrate Azure with Upsolver
    • Upsolver concepts
      • Deployment models
      • Upsolver components
      • Data ingestion
    • Upsolver Amazon AWS deployment guide
      • Private VPC
      • Upsolver VPC
      • AWS role permissions
      • VPC peering
    • Tutorials and FAQ
      • Tutorials
        • How To Re-process Data
        • Create an Amazon S3 data source
        • Create an Amazon Athena data output
        • Join multiple data streams for real-time analytics
        • Use Upsolver to index less data into Splunk
        • Upsert and delete use case
        • AWS S3 to Athena use case
        • Merge data use case
        • Full vs. Partial Inbound Data Records
      • FAQ
      • Infrastructure
        • What is a dry-run cluster?
    • Glossary
      • Language guide
        • SQL syntax reference
        • Functions
          • Aggregation Functions
            • APPROX_COUNT_DISTINCT
            • APPROX_COUNT_DISTINCT_EACH
            • AVG
            • AVG_EACH
            • AVG_TIME_SERIES
            • COLLECT_SET
            • COLLECT_SET_EACH
            • COUNT
            • COUNT(*)
            • COUNT_DISTINCT
            • COUNT_EACH
            • COUNT_IF
            • DECAYED_SUM
            • DYNAMIC_SESSIONS
            • FIRST
            • FIRST_ARRAY
            • FIRST_EACH
            • FIRST_TIME_SERIES
            • LAST
            • LAST_ARRAY
            • LAST_EACH
            • LAST_K
            • LAST_K_EACH
            • LAST_TIME_SERIES
            • MAX
            • MAX_BY
            • MAX_EACH
            • MAX_TIME_SERIES
            • MIN
            • MIN_BY
            • MIN_EACH
            • MIN_TIME_SERIES
            • SESSION_COUNT
            • STD_DEV
            • STD_DEV_EACH
            • STRING_MAX_EACH
            • STRING_MIN_EACH
            • SUM
            • SUM_EACH
            • SUM_TIME_SERIES
            • WEIGHTED_AVERAGE
          • Calculated functions
            • Aerospike functions
            • Array functions
            • Conditional functions
            • Date functions
            • External API functions
            • Filter functions
            • Numeric functions
            • Spatial functions
            • String functions
            • Structural functions
              • ZIP
            • Type conversion functions
      • Data formats
      • Data types and features
      • Database output options
      • Upsolver shards
      • Permissions list
      • Index
    • Troubleshooting
      • My CloudFormation stack failed to deploy
      • My private API doesn't start or I can't connect to it
        • Elastic IPs limit reached
        • EC2 Spot Instance not running
        • DNS cache
        • Security group not open
      • My compute cluster doesn't start
      • I can't connect to my Kafka cluster
      • I can't create an S3 data source
      • Data doesn't appear in Athena table
      • I get an exception when querying my Athena table
      • Unable to define a JDBC (Postgres) connection
  • Connecting data sources
    • Amazon AWS data sources
      • Amazon S3 data source
        • Quick guide: S3 data source
        • Full guide: S3 data source
      • Amazon Kinesis Stream data source
      • Amazon S3 over SQS data source
      • Amazon AppFlow data source
        • Setup Google Analytics client ID and client secret.
    • Microsoft Azure data sources
      • Azure Blob storage data source
      • Azure Event Hubs data source
    • Kafka data source
    • Google Cloud Storage data source
    • File upload data source
    • CDC data sources (Debezium)
      • MySQL CDC data source
        • Binlog retention in MySQL
      • PostgreSQL CDC database replication
    • JDBC data source
    • HDFS data source
    • Data source UI
    • Data source properties
  • Data outputs and data transformation
    • Data outputs
      • Amazon AWS data outputs
        • Amazon S3 data output
        • Amazon Athena data output
          • Quick guide: Athena data output
          • Full guide: Athena data output
          • Output all data source fields to Amazon Athena
        • Amazon Kinesis data output
        • Amazon Redshift data output
        • Amazon Redshift Spectrum data output
          • Connect Redshift Spectrum to Glue Data Catalog
        • Amazon SageMaker data output
      • Data lake / database data outputs
        • Snowflake data output
          • Upsert data to Snowflake
        • MySQL data output
        • PostgreSQL data output
        • Microsoft SQL Server data output
        • Elasticsearch data output
        • Dremio
        • PrestoDB
      • Upsolver data output
      • HDFS data output
      • Google Storage data output
      • Microsoft Azure Storage data output
      • Qubole data output
      • Lookup table data output
        • Lookup table alias
        • API Playground
        • Serialization of EACH aggregations
      • Kafka data output
    • Data transformation
      • Transform with SQL
        • Mapping data to a desired schema
        • Transforming data with SQL
        • Aggregate streaming data
        • Query hierarchical data
      • Work with Arrays
      • View outputs
      • Create an output
        • Modify an output in SQL
          • Quick guide: SQL data transformation
        • Add calculated fields
        • Add filters
        • Add lookups
          • Add lookups from data sources
          • Add lookups from lookup tables
          • Adding lookups from reference data
        • Output properties
          • General output properties
      • Run an output
      • Edit an output
      • Duplicate an output
      • Stop an output
      • Delete an output
  • Guide for developers
    • Upsolver REST API
      • Create a data source
      • Modify a data source
      • API content formats
    • CI/CD on Upsolver
  • Administration
    • Connections
      • Amazon S3 connection
      • Amazon Kinesis connection
      • Amazon Redshift connection
      • Amazon Athena connection
      • Amazon S3 over SQS connection
      • Google Storage connection
      • Azure Blob storage connection
      • Snowflake connection
      • MySQL connection
      • Elasticsearch connection
      • HDFS connection
      • Qubole connection
      • PostgreSQL connection
      • Microsoft SQL Server connection
      • Spotinst Private VPC connection
      • Kafka connection
    • Clusters
      • Cluster types
        • Compute cluster
        • Query cluster
        • Local API cluster
      • Monitoring clusters
      • Cluster tasks
      • Cluster Elastic IPs
      • Cluster properties
      • Uploading user-provided certificates
    • Python UDF
    • Reference data
    • Workspaces
    • Monitoring
      • Credits
      • Delays In Upsolver pipelines
      • Monitoring reports
        • Monitoring system properties
        • Monitoring metrics
    • Security
      • IAM: Identity and access management
        • Manage users
        • Manage groups
        • Manage policies
      • Git integration
      • Single sign-on with SAML
        • Microsoft Azure AD with SAML sign-on
        • Okta with SAML sign-on
        • OneLogin with SAML sign-on
      • AMI security updates
  • Support
    • Upsolver support portal
  • Change log
  • Legal
Powered by GitBook
On this page
  • BASE64_DECODE
  • BYTES_SUBSTRING
  • JOIN_ARRAYS
  • MD5
  • PRESTO_SPLIT
  • REGEX
  • REGEX_MATCH_POSITION
  • REGEX_NAMED_GROUPS
  • REPLACE
  • SHA1
  • SHA256
  • SPLIT
  • SPLIT_DELIMITER_FIRST
  • SPLIT_TO_RECORD
  • STRING_FORMAT
  • STRING_LENGTH
  • STRIP_MARGIN
  • STRIP_PREFIX
  • STRIP_SUFFIX
  • STRPOS
  • SUBSTRING
  • TOP_PRIVATE_DOMAIN
  • TO_LOWER
  • TO_UPPER
  • TRANSLATE
  • TRIM
  • TRIM_CHARS
  • URL_DECODE
  • URL_ENCODE
  • URL_PARSER
  • UUID_GENERATOR

Was this helpful?

  1. Getting Started
  2. Glossary
  3. Language guide
  4. Functions
  5. Calculated functions

String functions

This page goes over the string functions in Upsolver.

BASE64_DECODE

Decode a base 64 string into a string.

value

result

"SGVsbG8gV29ybGQ="

"Hello World"

"###"

null

BYTES_SUBSTRING

Returns a substring of the input, using the offsets in bytes of the UTF-8 encoded byte representation. Partial characters and invalid UTF-8 code points are removed from the result.

Inputs

  • value - Value to substring

Properties

  • Start Index - The inclusive start index in bytes

  • End Index - The exclusive end index in bytes

value

Start Index

End Index

result

"Hello World"

0

10

"Hello Worl"

"Hello World"

1

10

"ello Worl"

"⻤Hello Wor⻤"

1

10

"Hello W"

"⻤Hello Wor⻤"

0

10

"⻤Hello W"

"Hello"

0

10

"Hello"

JOIN_ARRAYS

Joins any number of arrays by index using a MessageFormat pattern.

Properties

  • Format String - The format string where {n} prints the nth input.

    • For example, the pattern '{0}.{0}.{1}' on the inputs 'a' and 'b' will result in the string 'a.a.b'

MD5

Hashes the input using MD5.

input

result

"hello world"

"5eb63bbbe01eeed093cb22bb8f5acdc3"

PRESTO_SPLIT

This function returns the given string split by the provided delimiter.

Syntax

PRESTO_SPLIT(STRING,DELIMITER)

Arguments

STRING A sequence of characters.

DELIMITER A sequence of one or more characters for specifying the boundary between separate, independent regions in plain text.

Returns

The given string split by the provided delimiter.

Examples

String

Delimiter

Result

'a""b'

'"'

"a", , "b"

'-a-bc-d-'

'-'

, "a", "bc", "d",

"~~a~~b~~"

"~~"

, "a", "b",

'Abra&Cadabra'

'&'

"Abra", "Cadabra"

REGEX

Matches the regular expression on the input string. Returns the escape groups if any exists or the original string if none exists.

Properties

  • Pattern - Regular Expression Pattern

input

Pattern

result

"abcijefjabc"

"abc"

"abc", "abc"

REGEX_MATCH_POSITION

Matches the regular expression on the input string and returns the index of the first match.

Inputs

  • value

  • startPosition

Properties

  • Pattern - Pattern to search for

REGEX_NAMED_GROUPS

Matches the regular expression on the input string. Returns record with field names and group names.

Properties

  • Pattern - Regular Expression Pattern

  • All Matches - Return all the matches of the pattern, and not only the first one

  • Filter Empty - Filter out empty matches

input

Pattern

All Matches

Filter Empty

result

"https://www.domain.com/

page.html"

"^(?:(?<scheme>.*?):\/)?\/?

(?<domain>[^:\/\s]+)

(?::(?<port>\d*))?(?:(\/\w+)*\/)

(?<page>[\w\-\.]+[^#?\s]+)

(?:.*)?$"

false

false

{"scheme":

"https",

"domain":

"www.domain.com",

"page":

"page.html"}

"http://www.domain.com:

8080/page.html"

"^(?:(?<scheme>.*?):\/)?\/?

(?<domain>[^:\/\s]+)

(?::(?<port>\d*))?(?:(\/\w+)*\/)

(?<page>[\w\-\.]+[^#?\s]+)

(?:.*)?$"

false

false

{"scheme":

"http",

"domain":

"www.domain.com",

"port":

"8080",

"page":

"page.html"}

"123"

"^(?<digits>\d*)$"

false

false

{"digits":

"123"}

"foo"

"^(?<digits>\d*)$"

false

false

null

""

"^(?<digits>\d*)$"

false

false

{"digits": ""}

""

"^(?<digits>\d*)$"

false

true

null

"www.upsolver.com"

"\bwww.(?<domain>[^\.]*).com\b"

true

false

{"domain":

"upsolver"}

"www.a.com www.b.com"

"\bwww.(?<domain>[^\.]*).com\b"

true

false

{"domain": "a"}, {"domain": "b"}

"www.a.com www.b.com"

"\bwww.(?<domain>[^\.]*).com\b"

false

false

{"domain": "a"}

REPLACE

Replace substrings within a string.

Properties

  • Pattern - Pattern to replace (regex)

  • Replacement - Replacement string

value

Pattern

Replacement

result

"Hello World"

"Hello"

null

" World"

"Hello World"

"Hello"

"foo"

"foo World"

"World"

"Hello"

"foo"

"World"

SHA1

Hashes the input using SHA-1.

input

result

"hello world"

"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

SHA256

Hashes the input using SHA-256.

input

result

"Hello SHA"

"4ea3b17f15346417f4c9b2ff94a1bfe82de99fdb0bbd30dc4dca031ab920d5e4"

SPLIT

Returns an error message indicating that SPLIT has been deprecated.

SPLIT_DELIMITER_FIRST

Returns the given string split by the provided delimiter.

Syntax

SPLIT_DELIMITER_FIRST(DELIMITER, STRING)

Arguments

DELIMITER A sequence of one or more characters for specifying the boundary between separate, independent regions in plain text.

STRING A sequence of characters.

Returns

The given string split by the provided delimiter.

Examples

Delimiter

Input String

Result

","

"a,b,c,d"

"a", "b", "c", "d"

","

"a", "b"

"a", "b"

","

",a,b,"

"a", "b"

"~~"

"~~a~~b~~"

"a", "b"

SPLIT_TO_RECORD

Returns the given string split by the provided delimiter.

Properties

  • Field Names

  • Delimiter

  • Filter Empty Values

value

Field Names

Delimiter

Filter Empty Values

result

"1,2,3,4"

"a,b,c"

","

false

{"a": "1", "b": "2", "c": "3"}

"1,2"

"a,b,c"

","

false

{"a": "1", "b": "2", "c": ""}

"1,,3"

"a,b,c"

","

true

{"a": "1", "c": "3"}

STRING_FORMAT

Format any number of inputs into a string using the given format.

Properties

  • Format String - The format string where {n} prints the nth input.

    • For example, the pattern '{0}.{0}.{1}' on the inputs 'a' and 'b' will result in the string 'a.a.b'

inputs

Format String

result

"a", "b", "c"

"{0} {1} {2}"

"a b c"

1.23

"{0}"

"1.23"

0.5

"{0,number,percent}"

"50%"

1.23

"{0,number,#.###}"

"1.235"

1.2

"{0,number,#.###}"

"1.2"

1.23

"{0,number,0.000}"

"1.235"

1.2

"{0,number,0.000}"

"1.200"

1.23E8

"{0,number,###,###.###}"

"123,456,789.012"

1.23E8

"{0,number,000,000.000}"

"123,456,789.012"

STRING_LENGTH

Gets the length of the string.

input

result

""

0

"Hello"

5

STRIP_MARGIN

For each line remove prefix of control or whitespace characters followed by the given margin char.

Properties

  • Margin Char

input

Margin Char

result

"Hello ∣ World"

"∣"

"Hello World"

STRIP_PREFIX

Remove the given prefix string from the beginning of the string.

Properties

  • Prefix

input

Prefix

result

"((foo))"

"("

"(foo))"

"foo"

"("

"foo"

STRIP_SUFFIX

Remove the given suffix string from the end of the string.

Properties

  • Suffix

input

Suffix

result

"((foo))"

")"

"((foo)"

"foo"

")"

"foo"

STRPOS

Returns the starting position of the first instance of a given substring within a string.

Syntax

STRPOS(STRING, SUBSTRING)

Arguments

STRING The sequence of characters to search.

SUBSTRING The substring to search for.

Returns

Returns the starting position of the first instance of SUBSTRING in STRING. Positions start from 1. If no instance is found, 0 is returned.

Examples

STRING
SUBSTRING
Output

All happy families are alike

all

0

All happy families are alike

All

1

All happy families are alike

are

20

All happy families are alike

''

1

''

''

1

''

word

0

null

word

null

SUBSTRING

Returns a string that is a substring of the given string.

Inputs

  • value

  • startPosition

  • endPosition

value

startPosition

endPosition

result

"Hello World"

0

5

"Hello"

"Hello"

0

-1

"Hello"

"Hello"

1

3

"el"

"Hello"

6

-1

""

"Hello"

-3

-2

"ll"

TOP_PRIVATE_DOMAIN

Get the top private domain from a domain name.

value

result

"www.example.com"

"example.com"

"www.example.co.uk"

"example.co.uk"

"www.example.uk.com"

"example.uk.com"

TO_LOWER

Converts the string to lowercase letters.

input

result

"HELLO world"

"hello world"

TO_UPPER

Converts the string to uppercase letters.

input

result

"HELLO world"

"HELLO WORLD"

TRANSLATE

Translates the given value using a given dictionary.

Properties

  • Dictionary

  • Keep Values Without Translation - Whether to keep values that have that are not mapped to a value in the feature

  • Empty As Null - If set, empty values will be treated as null

input

Dictionary

Keep Values Without Translation

Empty As Null

result

"a"

"a,Antman b,Batman d,"

false

false

"Antman"

"b"

"a,Antman b,Batman d,"

false

false

"Batman"

"c"

"a,Antman b,Batman d,"

false

false

null

"c"

"a,Antman b,Batman d,"

true

false

"c"

"d"

"a,Antman b,Batman d,"

true

true

null

"d"

"a,Antman b,Batman d,"

true

false

""

1234

"1234.0,good"

false

false

"good"

1234

"1234.0,good"

false

false

"good"

0

"0.0,good"

false

false

"good"

0

"-0.0,good"

false

false

"good"

0

"-0.0,good"

false

false

"good"

123456000000000000

"1.23456e17,good"

false

false

"good"

6

"6.000000000000001,good"

false

false

null

TRIM

Returns the given string without leading or trailing whitespaces.

input

result

"foo"

"foo"

" foo"

"foo"

"foo "

"foo"

" foo "

"foo"

TRIM_CHARS

Returns the given string without leading or trailing characters.

Properties

  • Characters

input

Characters

result

"-==--Hello World---=---"

"-="

"Hello World"

""

"-"

""

"-----------"

"-"

""

"x-----------"

"-"

"x"

"-----------x"

"-"

"x"

"------x-----"

"-"

"x"

"x-----------x"

"-"

"x-----------x"

URL_DECODE

Decode url encoded text.

input

result

"The+quick+brown+fox"

"The quick brown fox"

"Comment+%235"

"Comment #5"

URL_ENCODE

Encode text to url encoded format.

input

result

"The quick brown fox"

"The+quick+brown+fox"

"Comment #5"

"Comment+%235"

URL_PARSER

Parses the URI/URL into its component parts.

value

result

"https://www.domain.com/page.html"

{"scheme": "https", "authority": "www.domain.com", "host": "www.domain.com", "path": "/page.html"}

"https://user:pass@www.domain.com:80/page.html?query#fragment"

{"scheme": "https", "user_info": "user:pass", "authority": "user:pass@www.domain.com:80", "host": "www.domain.com", "port": 80, "path": "/page.html", "query": "query", "fragment": "fragment"}

"user:pass@www.domain.com/page.html?query"

{"user_info": "user:pass", "authority": "user:pass@www.domain.com", "host": "www.domain.com", "path": "/page.html", "query": "query"}

"www.domain.com/page.html#fragment"

{"authority": "www.domain.com", "host": "www.domain.com", "path": "/page.html", "fragment": "fragment"}

"/www.domain.com"

{"path": "/www.domain.com"}

UUID_GENERATOR

Returns UUID.

Inputs

  • hash - Value for extra randomness

PreviousSpatial functionsNextStructural functions

Last updated 1 year ago

Was this helpful?