Class CatalogUtils


  • public class CatalogUtils
    extends Object
    • Constructor Detail

      • CatalogUtils

        public CatalogUtils()
    • Method Detail

      • 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.
      • safeCast

        public static <T> T safeCast​(Object value,
                                     Class<T> type,
                                     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.
      • getNonBlankString

        public static String getNonBlankString​(Map<String,​Object> args,
                                               String parameter)
        Get a string parameter that can either be null or non-blank.
      • 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)