public class CatalogUtils extends Object
| Constructor and Description |
|---|
CatalogUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Granularity |
asDruidGranularity(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 int |
findColumn(List<ColumnSpec> columns,
String colName) |
static long |
getLong(Map<String,Object> map,
String key) |
static String |
getNonBlankString(Map<String,Object> args,
String parameter)
Get a string parameter that can either be null or non-blank.
|
static String |
getString(Map<String,Object> map,
String key) |
static List<String> |
getStringArray(Map<String,Object> map,
String key)
Get the value of a
VARCHAR ARRAY parameter. |
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> T |
safeCast(Object value,
Class<T> type,
String key) |
static <T> T |
safeGet(Map<String,Object> map,
String key,
Class<T> type) |
static String |
stringListToLines(List<String> lines) |
static List<URI> |
stringListToUriList(List<String> list)
Convert a list of strings to a list of
URI objects. |
static List<String> |
stringToList(String value)
String-to-List<String> conversion. |
static List<URI> |
stringToUriList(String uris) |
static String |
toString(Object obj)
Catalog-specific quick & easy implementation of
toString() for objects
which are primarily representations of JSON objects. |
static void |
validateGranularity(String value) |
public static List<String> columnNames(List<ColumnSpec> columns)
public static Granularity asDruidGranularity(String value)
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.public static List<String> getStringArray(Map<String,Object> map, String key)
VARCHAR ARRAY parameter. Though the type is
called ARRAY, Calcite provides the actual value as a List
of Strings.public static String toString(Object obj)
toString() for objects
which are primarily representations of JSON objects. Use only for cases where the
toString() 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.public static <T> List<T> concatLists(@Nullable List<T> base, @Nullable List<T> additions)
public static String getNonBlankString(Map<String,Object> args, String parameter)
public static List<URI> stringListToUriList(List<String> list)
URI objects.public static Map<String,Object> mergeProperties(Map<String,ModelProperties.PropertyDefn<?>> properties, Map<String,Object> source, Map<String,Object> update)
null, 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.
public static void validateGranularity(String value)
public static int findColumn(List<ColumnSpec> columns, String colName)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.