Class CatalogUtils

java.lang.Object
org.apache.druid.catalog.model.CatalogUtils

public class CatalogUtils extends Object
  • Constructor Details

    • CatalogUtils

      public CatalogUtils()
  • Method Details

    • columnNames

      public static List<String> columnNames(List<ColumnSpec> columns)
    • asDruidGranularity

      public static Granularity asDruidGranularity(@Nonnull 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.
    • safeCast

      public static <T> T safeCast(Object value, Class<T> type, String key)
    • safeGet

      public static <T> T safeGet(Map<String,Object> map, String key, Class<T> type)
    • getLong

      public static long getLong(Map<String,Object> map, String key)
    • getString

      public static String getString(Map<String,Object> map, String key)
    • getStringList

      public static List<String> getStringList(Map<String,Object> map, String key)
    • getStringArray

      public static List<String> getStringArray(Map<String,Object> map, String key)
      Get the value of a VARCHAR ARRAY parameter. Though the type is called ARRAY, Calcite provides the actual value as a List of Strings.
    • stringListToLines

      public static String stringListToLines(List<String> lines)
    • toString

      public static String toString(Object obj)
      Catalog-specific quick & easy implementation of 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.
    • 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.
    • getUriListArg

      public static List<String> getUriListArg(Map<String,Object> args, String parameter)
    • stringToUriList

      public static List<URI> stringToUriList(String uris)
    • stringListToUriList

      public static List<URI> stringListToUriList(List<String> list)
      Convert a list of strings to a list of URI objects.
    • 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 is 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.

    • validateGranularity

      public static void validateGranularity(String value)
    • findColumn

      public static int findColumn(List<ColumnSpec> columns, String colName)