Package org.apache.druid.catalog.model
Class CatalogUtils
- java.lang.Object
-
- org.apache.druid.catalog.model.CatalogUtils
-
public class CatalogUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description CatalogUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.druid.java.util.common.granularity.GranularityasDruidGranularity(String value)Convert a catalog granularity string to the Druid form.static List<String>columnNames(List<ColumnSpec> columns)static <T> List<T>concatLists(List<T> base, List<T> additions)static intfindColumn(List<ColumnSpec> columns, String colName)static longgetLong(Map<String,Object> map, String key)static StringgetNonBlankString(Map<String,Object> args, String parameter)Get a string parameter that can either be null or non-blank.static StringgetString(Map<String,Object> map, String key)static List<String>getStringArray(Map<String,Object> map, String key)Get the value of aVARCHAR ARRAYparameter.static List<String>getStringList(Map<String,Object> map, String key)static List<String>getUriListArg(Map<String,Object> args, String parameter)static Map<String,Object>mergeProperties(Map<String,ModelProperties.PropertyDefn<?>> properties, Map<String,Object> source, Map<String,Object> update)Merge the properties for an object using a set of updates in a map.static <T> TsafeCast(Object value, Class<T> type, String key)static <T> TsafeGet(Map<String,Object> map, String key, Class<T> type)static StringstringListToLines(List<String> lines)static List<URI>stringListToUriList(List<String> list)Convert a list of strings to a list ofURIobjects.static List<String>stringToList(String value)String-to-List<String>conversion.static List<URI>stringToUriList(String uris)static StringtoString(Object obj)Catalog-specific quick & easy implementation oftoString()for objects which are primarily representations of JSON objects.static voidvalidateGranularity(String value)
-
-
-
Method Detail
-
columnNames
public static List<String> columnNames(List<ColumnSpec> columns)
-
asDruidGranularity
public static org.apache.druid.java.util.common.granularity.Granularity asDruidGranularity(String value)
Convert a catalog granularity string to the Druid form. Catalog granularities are either the usual descriptive strings (in any case), or an ISO period. For the odd interval, the interval name is also accepted (for the other intervals, the interval name is the descriptive string).
-
stringToList
public static List<String> stringToList(String value)
String-to-List<String>conversion. The string can contain zero items, one items, or a list. The list items are separated by a comma and optional whitespace.
-
getStringArray
public static List<String> getStringArray(Map<String,Object> map, String key)
Get the value of aVARCHAR ARRAYparameter. Though the type is calledARRAY, Calcite provides the actual value as aListofStrings.
-
toString
public static String toString(Object obj)
Catalog-specific quick & easy implementation oftoString()for objects which are primarily representations of JSON objects. Use only for cases where thetoString()is for debugging. Also, assumes that the type can serialized using the default mapper: this trick doesn't work for types that require custom Jackson extensions. The catalog, however, has a simple type hierarchy, which is not extended via extensions, and so the default object mapper is fine.
-
concatLists
public static <T> List<T> concatLists(@Nullable List<T> base, @Nullable List<T> additions)
-
getNonBlankString
public static String getNonBlankString(Map<String,Object> args, String parameter)
Get a string parameter that can either be null or non-blank.
-
stringListToUriList
public static List<URI> stringListToUriList(List<String> list)
Convert a list of strings to a list ofURIobjects.
-
mergeProperties
public static Map<String,Object> mergeProperties(Map<String,ModelProperties.PropertyDefn<?>> properties, Map<String,Object> source, Map<String,Object> update)
Merge the properties for an object using a set of updates in a map. If the update value isnull, then remove the property in the revised set. If the property is known, use the column definition to merge the values. Else, the update replaces any existing value.This method does not validate the properties, except as needed to do a merge. A separate validation step is done on the final, merged object.
-
validateGranularity
public static void validateGranularity(String value)
-
findColumn
public static int findColumn(List<ColumnSpec> columns, String colName)
-
-