Package io.trino.util
Class JsonUtil
- java.lang.Object
-
- io.trino.util.JsonUtil
-
public final class JsonUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceJsonUtil.BlockBuilderAppenderstatic interfaceJsonUtil.JsonGeneratorWriterstatic interfaceJsonUtil.ObjectKeyProvider
-
Field Summary
Fields Modifier and Type Field Description static com.fasterxml.jackson.core.JsonFactoryJSON_FACTORY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanCastFromJson(Type type)static booleancanCastToJson(Type type)static com.fasterxml.jackson.core.JsonGeneratorcreateJsonGenerator(com.fasterxml.jackson.core.JsonFactory factory, io.airlift.slice.SliceOutput output)static com.fasterxml.jackson.core.JsonParsercreateJsonParser(com.fasterxml.jackson.core.JsonFactory factory, io.airlift.slice.Slice json)static LongcurrentTokenAsBigint(com.fasterxml.jackson.core.JsonParser parser)static BooleancurrentTokenAsBoolean(com.fasterxml.jackson.core.JsonParser parser)static DoublecurrentTokenAsDouble(com.fasterxml.jackson.core.JsonParser parser)static LongcurrentTokenAsInteger(com.fasterxml.jackson.core.JsonParser parser)static io.airlift.slice.SlicecurrentTokenAsLongDecimal(com.fasterxml.jackson.core.JsonParser parser, int precision, int scale)static LongcurrentTokenAsReal(com.fasterxml.jackson.core.JsonParser parser)static LongcurrentTokenAsShortDecimal(com.fasterxml.jackson.core.JsonParser parser, int precision, int scale)static LongcurrentTokenAsSmallint(com.fasterxml.jackson.core.JsonParser parser)static LongcurrentTokenAsTinyint(com.fasterxml.jackson.core.JsonParser parser)static io.airlift.slice.SlicecurrentTokenAsVarchar(com.fasterxml.jackson.core.JsonParser parser)static Optional<Map<String,Integer>>getFieldNameToIndex(List<RowType.Field> rowFields)static voidparseJsonToSingleRowBlock(com.fasterxml.jackson.core.JsonParser parser, SingleRowBlockWriter singleRowBlockWriter, JsonUtil.BlockBuilderAppender[] fieldAppenders, Optional<Map<String,Integer>> fieldNameToIndex)static StringtruncateIfNecessaryForErrorMessage(io.airlift.slice.Slice json)
-
-
-
Method Detail
-
createJsonParser
public static com.fasterxml.jackson.core.JsonParser createJsonParser(com.fasterxml.jackson.core.JsonFactory factory, io.airlift.slice.Slice json) throws IOException- Throws:
IOException
-
createJsonGenerator
public static com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(com.fasterxml.jackson.core.JsonFactory factory, io.airlift.slice.SliceOutput output) throws IOException- Throws:
IOException
-
truncateIfNecessaryForErrorMessage
public static String truncateIfNecessaryForErrorMessage(io.airlift.slice.Slice json)
-
canCastToJson
public static boolean canCastToJson(Type type)
-
canCastFromJson
public static boolean canCastFromJson(Type type)
-
currentTokenAsVarchar
public static io.airlift.slice.Slice currentTokenAsVarchar(com.fasterxml.jackson.core.JsonParser parser) throws IOException- Throws:
IOException
-
currentTokenAsBigint
public static Long currentTokenAsBigint(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsInteger
public static Long currentTokenAsInteger(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsSmallint
public static Long currentTokenAsSmallint(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsTinyint
public static Long currentTokenAsTinyint(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsDouble
public static Double currentTokenAsDouble(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsReal
public static Long currentTokenAsReal(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsBoolean
public static Boolean currentTokenAsBoolean(com.fasterxml.jackson.core.JsonParser parser) throws IOException
- Throws:
IOException
-
currentTokenAsShortDecimal
public static Long currentTokenAsShortDecimal(com.fasterxml.jackson.core.JsonParser parser, int precision, int scale) throws IOException
- Throws:
IOException
-
currentTokenAsLongDecimal
public static io.airlift.slice.Slice currentTokenAsLongDecimal(com.fasterxml.jackson.core.JsonParser parser, int precision, int scale) throws IOException- Throws:
IOException
-
getFieldNameToIndex
public static Optional<Map<String,Integer>> getFieldNameToIndex(List<RowType.Field> rowFields)
-
parseJsonToSingleRowBlock
public static void parseJsonToSingleRowBlock(com.fasterxml.jackson.core.JsonParser parser, SingleRowBlockWriter singleRowBlockWriter, JsonUtil.BlockBuilderAppender[] fieldAppenders, Optional<Map<String,Integer>> fieldNameToIndex) throws IOException- Throws:
IOException
-
-