Class JsonFunctions
- java.lang.Object
-
- org.apache.pinot.common.function.scalar.JsonFunctions
-
public class JsonFunctions extends Object
Inbuilt json related transform functions An example DimFieldSpec that needs the toJsonMapStr function:"dimFieldSpecs": [{ "name": "jsonMapStr", "dataType": "STRING", "transformFunction": "toJsonMapStr(jsonMap)" }]
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringjsonFormat(Object object)Convert object to Json Stringstatic ObjectjsonPath(Object object, String jsonPath)Extract object based on Json pathstatic Object[]jsonPathArray(Object object, String jsonPath)Extract object array based on Json pathstatic Object[]jsonPathArrayDefaultEmpty(Object object, String jsonPath)static doublejsonPathDouble(Object object, String jsonPath)Extract from Json with path to Doublestatic doublejsonPathDouble(Object object, String jsonPath, double defaultValue)Extract from Json with path to Doublestatic longjsonPathLong(Object object, String jsonPath)Extract from Json with path to Longstatic longjsonPathLong(Object object, String jsonPath, long defaultValue)Extract from Json with path to Longstatic StringjsonPathString(Object object, String jsonPath)Extract from Json with path to Stringstatic StringjsonPathString(Object object, String jsonPath, String defaultValue)Extract from Json with path to Stringstatic StringtoJsonMapStr(Map map)Convert Map to Json String
-
-
-
Method Detail
-
toJsonMapStr
public static String toJsonMapStr(@Nullable Map map) throws com.fasterxml.jackson.core.JsonProcessingException
Convert Map to Json String- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
jsonFormat
public static String jsonFormat(Object object) throws com.fasterxml.jackson.core.JsonProcessingException
Convert object to Json String- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
jsonPath
public static Object jsonPath(Object object, String jsonPath)
Extract object based on Json path
-
jsonPathArray
public static Object[] jsonPathArray(Object object, String jsonPath)
Extract object array based on Json path
-
jsonPathArrayDefaultEmpty
public static Object[] jsonPathArrayDefaultEmpty(@Nullable Object object, String jsonPath)
-
jsonPathString
public static String jsonPathString(Object object, String jsonPath) throws com.fasterxml.jackson.core.JsonProcessingException
Extract from Json with path to String- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
jsonPathString
public static String jsonPathString(@Nullable Object object, String jsonPath, String defaultValue)
Extract from Json with path to String
-
jsonPathLong
public static long jsonPathLong(Object object, String jsonPath)
Extract from Json with path to Long
-
jsonPathLong
public static long jsonPathLong(@Nullable Object object, String jsonPath, long defaultValue)
Extract from Json with path to Long
-
jsonPathDouble
public static double jsonPathDouble(Object object, String jsonPath)
Extract from Json with path to Double
-
-