Class ParserUtils
- java.lang.Object
-
- org.apache.druid.java.util.common.parsers.ParserUtils
-
public class ParserUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description ParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ArrayList<String>generateFieldNames(int length)static org.joda.time.DateTimeZonegetDateTimeZone(String timeZone)static StringgetDefaultColumnName(int ordinal)Return a function to generate default column names.static com.google.common.base.Function<String,Object>getTransformationFunction(String listDelimiter, com.google.common.base.Splitter listSplitter, boolean tryParseNumbers)static StringstripQuotes(String input)static voidvalidateFields(Iterable<String> fieldNames)
-
-
-
Method Detail
-
getTransformationFunction
public static com.google.common.base.Function<String,Object> getTransformationFunction(String listDelimiter, com.google.common.base.Splitter listSplitter, boolean tryParseNumbers)
- Returns:
- a transformation function on an input value. The function performs the following transformations on the input string:
- Splits it into multiple values using the
listSplitterif thelist delimiteris present in the input.- If
tryParseNumbersis true, the function will also attempt to parse any numeric values present in the input: integers asLongand floating-point numbers asDouble. If the input is not a number or parsing fails, the input is returned as-is as a string. - Splits it into multiple values using the
-
getDateTimeZone
@Nullable public static org.joda.time.DateTimeZone getDateTimeZone(String timeZone)
-
getDefaultColumnName
public static String getDefaultColumnName(int ordinal)
Return a function to generate default column names. Note that the postfix for default column names starts from 1.- Returns:
- column name generating function
-
-