For the complete documentation index, see llms.txt. This page is also available as Markdown.

JSONPATHDOUBLE

This section contains reference documentation for the JSONPATHDOUBLE function.

Extracts the Double value from jsonField based on 'jsonPath', use optional defaultValuefor null or parsing error. This function can only be used in an ingestion transformation function.

Signature

JSONPATHDOUBLE(jsonField, 'jsonPath', [defaultValue])

Arguments
Description

jsonField

An Identifier/Expression contains JSON documents.

'jsonPath'

Follows JsonPath Syntax to read values from JSON documents.

Usage Examples

The usage examples are based on extracting fields from the following JSON document:

{
  "data": {
    "name": "Pete",
    "age": 24,
    "subjects": [
      {
        "name": "maths",
        "homework_grades": [80, 85, 90, 95, 100],
        "grade": "A",
        "score": 90
      },
      {
        "name": "english",
        "homework_grades": [60, 65, 70, 85, 90],
        "grade": "B",
        "score": 70
      }
    ]
  }
}
Expression
Value

JSONPATHDOUBLE(data, '$.age')

24.0

This function can be used in the table config to extract the age property into the age column, as described below:

Value conversion

JSONPATHDOUBLE converts a matched value to a double as follows:

Matched value
Result

Number

The value's double representation

Boolean

true becomes 1.0; false becomes 0.0

TIMESTAMP in materialized input

Epoch milliseconds

DATE in materialized input

Days since the Unix epoch

TIME in materialized input

Milliseconds since midnight

The TIMESTAMP, DATE, and TIME conversions apply when an extractor has already materialized the input as a record object instead of JSON text. TIME values drop sub-millisecond precision. Missing or null values, non-numeric values, and conversion errors return defaultValue when it is supplied.

Fast and first-match variants

JSONPATHDOUBLEFORY (experimental)

JSONPATHDOUBLEFORY(jsonField, 'jsonPath', [defaultValue])

JSONPATHDOUBLEFORY evaluates eligible simple scalar paths with Apache Fory and falls back to JSONPATHDOUBLE for unsupported inputs or when Fory is unavailable. The standard Pinot distribution does not ship Fory; the accelerated path requires org.apache.fory:fory-json:1.6.0 and fory-core on the ingestion application's classpath. This experimental function may change or be removed.

Use the opt-in variants below when the path is a simple linear path: $ followed only by .name, ['literal.key'], or [0] segments. For more complex JsonPath features such as wildcards, deep scan (..), filters, unions, slices, negative indexes, or a bare $, Pinot falls back to the existing JSONPATHDOUBLE behavior.

Like JSONPATHDOUBLE, both variants are intended for ingestion transformation functions.

JSONPATHDOUBLEFAST

JSONPATHDOUBLEFAST(jsonField, 'jsonPath', [defaultValue])

JSONPATHDOUBLEFAST resolves supported paths in a single forward pass over the JSON text instead of building the full Jayway DOM first. It keeps the same result as JSONPATHDOUBLE, including the same defaultValue handling, and falls back to the existing implementation when the path is not a simple linear path or the input is not a JSON object or array.

Use JSONPATHDOUBLEFAST when you want lower ingestion CPU cost without changing semantics.

JSONPATHDOUBLEFIRSTMATCH

JSONPATHDOUBLEFIRSTMATCH(jsonField, 'jsonPath', [defaultValue])

JSONPATHDOUBLEFIRSTMATCH uses the same streaming fast path but stops as soon as the addressed field is found. This is usually the fastest option when the field appears early in the JSON document, but it changes behavior for undefined or corrupt input:

  • Duplicate keys resolve to the first occurrence instead of the last one.

  • A document malformed strictly after the addressed field can still return the extracted value.

Use JSONPATHDOUBLEFIRSTMATCH only when the upstream JSON is well-formed and duplicate-free.

Last updated

Was this helpful?