public static Granularity mergeGranularities ( List < Granularity > toMerge ) { if ( toMerge == null || toMerge . size ( ) == 0 ) { return null ; } Granularity result = toMerge . get ( 0 ) ; for ( int i = 1 ; i < toMerge . size ( ) ; i ++ ) { if ( ! Objects . equals ( result , toMerge . get ( i ) ) ) { return null ; } } return result ; }
simple merge strategy on query granularity that checks if all are equal or else returns null . this can be improved in future but is good enough for most use - cases .