http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java b/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java index 8fa32a7..7a0b919 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java @@ -107,8 +107,7 @@ public class MemoryBudgetController { try { reserve(consumer, requestMB); if (debug && waitStart > 0) - logger.debug(consumer + " waited " + (System.currentTimeMillis() - waitStart) + " ms on the " - + requestMB + " MB request"); + logger.debug(consumer + " waited " + (System.currentTimeMillis() - waitStart) + " ms on the " + requestMB + " MB request"); return; } catch (NotEnoughBudgetException ex) { // retry @@ -177,8 +176,7 @@ public class MemoryBudgetController { if (debug) { if (getSystemAvailMB() < getRemainingBudgetMB()) { - logger.debug("Remaining budget is " + getRemainingBudgetMB() + " MB free, but system only has " - + getSystemAvailMB() + " MB free. If this persists, some memory calculation must be wrong."); + logger.debug("Remaining budget is " + getRemainingBudgetMB() + " MB free, but system only has " + getSystemAvailMB() + " MB free. If this persists, some memory calculation must be wrong."); } } } @@ -229,8 +227,7 @@ public class MemoryBudgetController { booking.remove(entry.consumer); } if (debug) { - logger.debug(entry.consumer + " reserved " + entry.reservedMB + " MB, total reserved " + totalReservedMB - + " MB, remaining budget " + getRemainingBudgetMB() + " MB"); + logger.debug(entry.consumer + " reserved " + entry.reservedMB + " MB, total reserved " + totalReservedMB + " MB, remaining budget " + getRemainingBudgetMB() + " MB"); } if (delta < 0) {
http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/OrderedProperties.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/OrderedProperties.java b/core-common/src/main/java/org/apache/kylin/common/util/OrderedProperties.java index 39ddc24..ffeced1 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/OrderedProperties.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/OrderedProperties.java @@ -345,8 +345,7 @@ public final class OrderedProperties implements Serializable { * @return the new instance */ public OrderedProperties build() { - Map<String, String> properties = (this.comparator != null) ? new TreeMap<String, String>(comparator) - : new LinkedHashMap<String, String>(); + Map<String, String> properties = (this.comparator != null) ? new TreeMap<String, String>(comparator) : new LinkedHashMap<String, String>(); return new OrderedProperties(properties); } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/Primes.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/Primes.java b/core-common/src/main/java/org/apache/kylin/common/util/Primes.java index cb60331..b83950e 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/Primes.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/Primes.java @@ -31,34 +31,9 @@ public class Primes { * As a result, <code>int</code> numbers which are not reduced by those primes are guaranteed * to be either prime or semi prime. */ - public static final int[] PRIMES = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, - 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, - 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, - 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, - 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, - 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, - 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, - 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, - 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, - 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, - 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, - 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, - 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, - 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, - 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, - 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, - 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, - 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, - 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, - 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, - 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, - 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, - 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, - 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, - 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, - 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, - 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, - 3671 }; + public static final int[] PRIMES = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, + 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, + 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671 }; /** * Hide utility class. http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/RangeUtil.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/RangeUtil.java b/core-common/src/main/java/org/apache/kylin/common/util/RangeUtil.java index ea08ec8..6ef8c089 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/RangeUtil.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/RangeUtil.java @@ -37,8 +37,7 @@ public class RangeUtil { /** * for NavigableMap sorted by C, given a range of C, return the sub map whose key falls in the range */ - public static <C extends Comparable<?>, V> NavigableMap<C, V> filter(NavigableMap<C, V> values, - Range<C> filterRange) { + public static <C extends Comparable<?>, V> NavigableMap<C, V> filter(NavigableMap<C, V> values, Range<C> filterRange) { if (filterRange == null || filterRange.isEmpty()) { return Maps.newTreeMap(); } else if (filterRange.equals(Range.all())) { http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/SortUtil.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/SortUtil.java b/core-common/src/main/java/org/apache/kylin/common/util/SortUtil.java index 834d2d4..1ea9d97 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/SortUtil.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/SortUtil.java @@ -26,8 +26,7 @@ import com.google.common.collect.TreeMultimap; /** */ public class SortUtil { - public static <T extends Comparable, E extends Comparable> Iterator<T> extractAndSort(Iterator<T> input, - Function<T, E> extractor) { + public static <T extends Comparable, E extends Comparable> Iterator<T> extractAndSort(Iterator<T> input, Function<T, E> extractor) { TreeMultimap<E, T> reorgnized = TreeMultimap.create(); while (input.hasNext()) { T t = input.next(); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/main/java/org/apache/kylin/common/util/ZipFileUtils.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/ZipFileUtils.java b/core-common/src/main/java/org/apache/kylin/common/util/ZipFileUtils.java index 14253a0..a2326ee 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/ZipFileUtils.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/ZipFileUtils.java @@ -54,8 +54,7 @@ public class ZipFileUtils { zipInputStream = new ZipInputStream(new FileInputStream(zipFileName)); ZipEntry zipEntry = null; while ((zipEntry = zipInputStream.getNextEntry()) != null) { - logger.info("decompressing " + zipEntry.getName() + " is directory:" + zipEntry.isDirectory() - + " available: " + zipInputStream.available()); + logger.info("decompressing " + zipEntry.getName() + " is directory:" + zipEntry.isDirectory() + " available: " + zipInputStream.available()); File temp = new File(outputFolder, zipEntry.getName()); if (zipEntry.isDirectory()) { @@ -77,8 +76,7 @@ public class ZipFileUtils { } } - private static void compressDirectoryToZipfile(String rootDir, String sourceDir, ZipOutputStream out) - throws IOException { + private static void compressDirectoryToZipfile(String rootDir, String sourceDir, ZipOutputStream out) throws IOException { File[] files = new File(sourceDir).listFiles(); if (files == null) return; @@ -86,9 +84,7 @@ public class ZipFileUtils { if (sourceFile.isDirectory()) { compressDirectoryToZipfile(rootDir, sourceDir + normDir(sourceFile.getName()), out); } else { - ZipEntry entry = new ZipEntry( - normDir(StringUtils.isEmpty(rootDir) ? sourceDir : sourceDir.replace(rootDir, "")) - + sourceFile.getName()); + ZipEntry entry = new ZipEntry(normDir(StringUtils.isEmpty(rootDir) ? sourceDir : sourceDir.replace(rootDir, "")) + sourceFile.getName()); entry.setTime(sourceFile.lastModified()); out.putNextEntry(entry); FileInputStream in = new FileInputStream(sourceDir + sourceFile.getName()); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/StorageURLTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/StorageURLTest.java b/core-common/src/test/java/org/apache/kylin/common/StorageURLTest.java index ab47958..eaa7548 100644 --- a/core-common/src/test/java/org/apache/kylin/common/StorageURLTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/StorageURLTest.java @@ -87,7 +87,7 @@ public class StorageURLTest { assertEquals("hello@hbase,a", id.toString()); } } - + @Test public void testValueOfCache() { StorageURL id1 = StorageURL.valueOf("hello@hbase"); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/persistence/LocalFileResourceStoreTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/persistence/LocalFileResourceStoreTest.java b/core-common/src/test/java/org/apache/kylin/common/persistence/LocalFileResourceStoreTest.java index 0252b9c..63eb04b 100644 --- a/core-common/src/test/java/org/apache/kylin/common/persistence/LocalFileResourceStoreTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/persistence/LocalFileResourceStoreTest.java @@ -68,16 +68,16 @@ public class LocalFileResourceStoreTest extends LocalFileMetadataTestCase { ByteArrayInputStream is = new ByteArrayInputStream(bytes); store.putResource("/res2", is, 2000); is.close(); - + store.putResource("/res1", str, 2000, StringEntity.serializer); store.deleteResource("/res1"); assertEquals(null, store.getResource("/res1")); assertEquals(2000, (raw = store.getResource("/res2")).timestamp); raw.inputStream.close(); - + cp.rollback(); - + assertEquals(null, store.getResource("/res2")); assertEquals(1000, (raw = store.getResource("/res1")).timestamp); raw.inputStream.close(); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/restclient/RestClientTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/restclient/RestClientTest.java b/core-common/src/test/java/org/apache/kylin/common/restclient/RestClientTest.java index c7a4dd6..af05e5e 100644 --- a/core-common/src/test/java/org/apache/kylin/common/restclient/RestClientTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/restclient/RestClientTest.java @@ -19,13 +19,15 @@ package org.apache.kylin.common.restclient; import java.io.IOException; - import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class RestClientTest { + + private static final Logger logger = LoggerFactory.getLogger(RestClientTest.class); @SuppressWarnings("unused") http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/BasicTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/BasicTest.java b/core-common/src/test/java/org/apache/kylin/common/util/BasicTest.java index d3787d1..5512147b 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/BasicTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/BasicTest.java @@ -190,10 +190,8 @@ public class BasicTest { System.out.println(time(c.getTimeInMillis())); a.setTimeInMillis(current); - b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), - a.get(Calendar.MINUTE)); - c.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), - 0); + b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), a.get(Calendar.MINUTE)); + c.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), 0); System.out.println(time(b.getTimeInMillis())); System.out.println(time(c.getTimeInMillis())); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/CacheBuilderTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/CacheBuilderTest.java b/core-common/src/test/java/org/apache/kylin/common/util/CacheBuilderTest.java index 742c3c0..e30f0b3 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/CacheBuilderTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/CacheBuilderTest.java @@ -28,13 +28,12 @@ import com.google.common.cache.RemovalNotification; public class CacheBuilderTest { @Test public void foo() { - Cache<Object, Object> build = CacheBuilder.newBuilder().maximumSize(1).weakValues() - .removalListener(new RemovalListener<Object, Object>() { - @Override - public void onRemoval(RemovalNotification<Object, Object> notification) { - System.out.println(notification.getCause()); - } - }).build(); + Cache<Object, Object> build = CacheBuilder.newBuilder().maximumSize(1).weakValues().removalListener(new RemovalListener<Object, Object>() { + @Override + public void onRemoval(RemovalNotification<Object, Object> notification) { + System.out.println(notification.getCause()); + } + }).build(); build.put(1, 1); build.put(1, 2); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/ClassUtilTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/ClassUtilTest.java b/core-common/src/test/java/org/apache/kylin/common/util/ClassUtilTest.java index 0b7607d..75fa574 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/ClassUtilTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/ClassUtilTest.java @@ -25,10 +25,8 @@ public class ClassUtilTest { @Test public void testFindContainingJar() throws ClassNotFoundException { - Assert.assertTrue(ClassUtil.findContainingJar(Class.forName("org.apache.commons.beanutils.BeanUtils")) - .contains("commons-beanutils")); - Assert.assertTrue(ClassUtil.findContainingJar(Class.forName("org.apache.commons.beanutils.BeanUtils"), "core") - .contains("commons-beanutils-core")); + Assert.assertTrue(ClassUtil.findContainingJar(Class.forName("org.apache.commons.beanutils.BeanUtils")).contains("commons-beanutils")); + Assert.assertTrue(ClassUtil.findContainingJar(Class.forName("org.apache.commons.beanutils.BeanUtils"), "core").contains("commons-beanutils-core")); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java b/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java index 0eccfe0..d69d4d2 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java @@ -60,15 +60,12 @@ public class HiveCmdBuilderTest { hiveCmdBuilder.addStatement("SHOW\n TABLES;"); hiveCmdBuilder.setHiveConfProps(hiveProps); hiveCmdBuilder.overwriteHiveProps(hivePropsOverwrite); - assertEquals( - "hive -e \"USE default;\nDROP TABLE test;\nSHOW\n TABLES;\n\" --hiveconf hive.execution.engine=tez", - hiveCmdBuilder.build()); + assertEquals("hive -e \"USE default;\nDROP TABLE test;\nSHOW\n TABLES;\n\" --hiveconf hive.execution.engine=tez", hiveCmdBuilder.build()); } @Test public void testBeeline() throws IOException { - String lineSeparator = java.security.AccessController - .doPrivileged(new sun.security.action.GetPropertyAction("line.separator")); + String lineSeparator = java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator")); System.setProperty("kylin.source.hive.client", "beeline"); System.setProperty("kylin.source.hive.beeline-params", "-u jdbc_url"); @@ -84,10 +81,8 @@ public class HiveCmdBuilderTest { hqlFile = hqlFile.substring(0, hqlFile.length() - ";exit $ret_code".length()); String hqlStatement = FileUtils.readFileToString(new File(hqlFile), Charset.defaultCharset()); - assertEquals( - "USE default;" + lineSeparator + "DROP TABLE test;" + lineSeparator + "SHOW\n TABLES;" + lineSeparator, - hqlStatement); + assertEquals("USE default;" + lineSeparator + "DROP TABLE test;" + lineSeparator + "SHOW\n TABLES;" + lineSeparator, hqlStatement); FileUtils.forceDelete(new File(hqlFile)); } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/HotLoadKylinPropertiesTestCase.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/HotLoadKylinPropertiesTestCase.java b/core-common/src/test/java/org/apache/kylin/common/util/HotLoadKylinPropertiesTestCase.java index aa180a9..9f5b278 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/HotLoadKylinPropertiesTestCase.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/HotLoadKylinPropertiesTestCase.java @@ -18,15 +18,15 @@ package org.apache.kylin.common.util; +import org.apache.kylin.common.KylinConfig; +import org.junit.After; +import org.junit.Before; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Properties; -import org.apache.kylin.common.KylinConfig; -import org.junit.After; -import org.junit.Before; - /** * @author kangkaisen */ http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/InstallJarIntoMavenTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/InstallJarIntoMavenTest.java b/core-common/src/test/java/org/apache/kylin/common/util/InstallJarIntoMavenTest.java index bc4dc63..6dcdaf5 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/InstallJarIntoMavenTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/InstallJarIntoMavenTest.java @@ -53,9 +53,7 @@ public class InstallJarIntoMavenTest { String artifactId = name.substring(0, match.start()); String version = name.substring(match.start() + 1, lastDot); - fw.write(String.format( - "mvn install:install-file -Dfile=%s -DgroupId=%s -DartifactId=%s -Dversion=%s -Dpackaging=jar", - name, "org.apache." + groupId, artifactId, version)); + fw.write(String.format("mvn install:install-file -Dfile=%s -DgroupId=%s -DartifactId=%s -Dversion=%s -Dpackaging=jar", name, "org.apache." + groupId, artifactId, version)); fw.write("\n"); } fw.close(); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java b/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java index f9062f1..286cdd3 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/JacksonTest.java @@ -31,6 +31,7 @@ public class JacksonTest { a.put("3", "3"); a.put("2", "2"); + JacksonBean bean = new JacksonBean(); bean.setA("valuea"); bean.setConfiguration(a); @@ -38,13 +39,11 @@ public class JacksonTest { String s = JsonUtil.writeValueAsString(bean); System.out.println(s); - JacksonBean desBean = (JacksonBean) JsonUtil.readValue( - "{\"a\":\"valuea\",\"b\":0,\"configuration\":{\"2\":\"2\",\"3\":\"3\",\"1\":\"1\"}}", - JacksonBean.class); - + JacksonBean desBean = (JacksonBean) JsonUtil.readValue("{\"a\":\"valuea\",\"b\":0,\"configuration\":{\"2\":\"2\",\"3\":\"3\",\"1\":\"1\"}}", JacksonBean.class); + String x2 = JsonUtil.writeValueAsString(desBean); System.out.println(x2); - + System.out.println(desBean); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java b/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java index fcde1a7..67f39b4 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java @@ -77,7 +77,7 @@ public class LocalFileMetadataTestCase extends AbstractKylinTestCase { public void cleanupTestMetadata() { cleanAfterClass(); } - + protected String getLocalWorkingDirectory() { String dir = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory(); if (dir.startsWith("file://")) http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/RangeTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/RangeTest.java b/core-common/src/test/java/org/apache/kylin/common/util/RangeTest.java index 22e1863..d4e4cbf 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/RangeTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/RangeTest.java @@ -101,8 +101,7 @@ public class RangeTest { Assert.assertTrue(RangeUtil.remove(r1, c3).equals(Lists.newArrayList(Range.closed(2, 4), Range.closed(5, 5)))); Assert.assertTrue(RangeUtil.remove(r1, d1).equals(Lists.newArrayList(Range.openClosed(3, 5)))); - Assert.assertTrue( - RangeUtil.remove(r1, d2).equals(Lists.newArrayList(Range.closedOpen(2, 3), Range.openClosed(4, 5)))); + Assert.assertTrue(RangeUtil.remove(r1, d2).equals(Lists.newArrayList(Range.closedOpen(2, 3), Range.openClosed(4, 5)))); Assert.assertTrue(RangeUtil.remove(r1, d3).equals(Lists.newArrayList(Range.closedOpen(2, 4)))); } @@ -165,8 +164,7 @@ public class RangeTest { Assert.assertTrue(RangeUtil.remove(r1, b9).equals(Lists.newArrayList())); Assert.assertTrue(RangeUtil.remove(r1, c1).equals(Lists.newArrayList(Range.closedOpen(3, 5)))); - Assert.assertTrue( - RangeUtil.remove(r1, c2).equals(Lists.newArrayList(Range.openClosed(2, 3), Range.closedOpen(4, 5)))); + Assert.assertTrue(RangeUtil.remove(r1, c2).equals(Lists.newArrayList(Range.openClosed(2, 3), Range.closedOpen(4, 5)))); Assert.assertTrue(RangeUtil.remove(r1, c3).equals(Lists.newArrayList(Range.openClosed(2, 4)))); Assert.assertTrue(RangeUtil.remove(r1, d1).equals(Lists.newArrayList(Range.open(3, 5)))); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-common/src/test/java/org/apache/kylin/common/util/TimeUtilTest.java ---------------------------------------------------------------------- diff --git a/core-common/src/test/java/org/apache/kylin/common/util/TimeUtilTest.java b/core-common/src/test/java/org/apache/kylin/common/util/TimeUtilTest.java index 1a67bb5..15f54f9 100644 --- a/core-common/src/test/java/org/apache/kylin/common/util/TimeUtilTest.java +++ b/core-common/src/test/java/org/apache/kylin/common/util/TimeUtilTest.java @@ -41,11 +41,9 @@ public class TimeUtilTest { a.setTimeInMillis(timeMillis); if (unit == NormalizedTimeUnit.MINUTE) { - b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), - a.get(Calendar.HOUR_OF_DAY), a.get(Calendar.MINUTE)); + b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), a.get(Calendar.MINUTE)); } else if (unit == NormalizedTimeUnit.HOUR) { - b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), - a.get(Calendar.HOUR_OF_DAY), 0); + b.set(a.get(Calendar.YEAR), a.get(Calendar.MONTH), a.get(Calendar.DAY_OF_MONTH), a.get(Calendar.HOUR_OF_DAY), 0); } return b.getTimeInMillis(); } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/GTForwardingScanner.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/GTForwardingScanner.java b/core-cube/src/main/java/org/apache/kylin/GTForwardingScanner.java index 8e82427..de8c88d 100644 --- a/core-cube/src/main/java/org/apache/kylin/GTForwardingScanner.java +++ b/core-cube/src/main/java/org/apache/kylin/GTForwardingScanner.java @@ -18,14 +18,14 @@ package org.apache.kylin; -import static com.google.common.base.Preconditions.checkNotNull; +import org.apache.kylin.gridtable.GTInfo; +import org.apache.kylin.gridtable.GTRecord; +import org.apache.kylin.gridtable.IGTScanner; import java.io.IOException; import java.util.Iterator; -import org.apache.kylin.gridtable.GTInfo; -import org.apache.kylin.gridtable.GTRecord; -import org.apache.kylin.gridtable.IGTScanner; +import static com.google.common.base.Preconditions.checkNotNull; /** * A {@link IGTScanner} which forwards all its method calls to another scanner. http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java index 45898b8..20cb0a9 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java @@ -70,8 +70,7 @@ public class CubeCapabilityChecker { //1. dimension as measure if (!unmatchedAggregations.isEmpty()) { - tryDimensionAsMeasures(unmatchedAggregations, result, - cube.getDescriptor().listDimensionColumnsIncludingDerived()); + tryDimensionAsMeasures(unmatchedAggregations, result, cube.getDescriptor().listDimensionColumnsIncludingDerived()); } } else { //for non query-on-facttable @@ -111,10 +110,8 @@ public class CubeCapabilityChecker { return result; } - if (cube.getStorageType() == IStorageAware.ID_HBASE - && MassInTupleFilter.containsMassInTupleFilter(digest.filter)) { - logger.info( - "Exclude cube " + cube.getName() + " because only v2 storage + v2 query engine supports massin"); + if (cube.getStorageType() == IStorageAware.ID_HBASE && MassInTupleFilter.containsMassInTupleFilter(digest.filter)) { + logger.info("Exclude cube " + cube.getName() + " because only v2 storage + v2 query engine supports massin"); return result; } @@ -161,8 +158,7 @@ public class CubeCapabilityChecker { return result; } - private static void tryDimensionAsMeasures(Collection<FunctionDesc> unmatchedAggregations, CapabilityResult result, - Set<TblColRef> dimCols) { + private static void tryDimensionAsMeasures(Collection<FunctionDesc> unmatchedAggregations, CapabilityResult result, Set<TblColRef> dimCols) { Iterator<FunctionDesc> it = unmatchedAggregations.iterator(); while (it.hasNext()) { @@ -180,8 +176,7 @@ public class CubeCapabilityChecker { continue; } List<TblColRef> neededCols = parameterDesc.getColRefs(); - if (neededCols.size() > 0 && dimCols.containsAll(neededCols) - && FunctionDesc.BUILT_IN_AGGREGATIONS.contains(functionDesc.getExpression())) { + if (neededCols.size() > 0 && dimCols.containsAll(neededCols) && FunctionDesc.BUILT_IN_AGGREGATIONS.contains(functionDesc.getExpression())) { result.influences.add(new CapabilityResult.DimensionAsMeasure(functionDesc)); it.remove(); continue; @@ -190,9 +185,7 @@ public class CubeCapabilityChecker { } // custom measure types can cover unmatched dimensions or measures - private static void tryCustomMeasureTypes(Collection<TblColRef> unmatchedDimensions, - Collection<FunctionDesc> unmatchedAggregations, SQLDigest digest, CubeInstance cube, - CapabilityResult result) { + private static void tryCustomMeasureTypes(Collection<TblColRef> unmatchedDimensions, Collection<FunctionDesc> unmatchedAggregations, SQLDigest digest, CubeInstance cube, CapabilityResult result) { CubeDesc cubeDesc = cube.getDescriptor(); List<String> influencingMeasures = Lists.newArrayList(); for (MeasureDesc measure : cubeDesc.getMeasures()) { @@ -203,16 +196,14 @@ public class CubeCapabilityChecker { if (measureType instanceof BasicMeasureType) continue; - CapabilityInfluence inf = measureType.influenceCapabilityCheck(unmatchedDimensions, unmatchedAggregations, - digest, measure); + CapabilityInfluence inf = measureType.influenceCapabilityCheck(unmatchedDimensions, unmatchedAggregations, digest, measure); if (inf != null) { result.influences.add(inf); influencingMeasures.add(measure.getName() + "@" + measureType.getClass()); } } if (influencingMeasures.size() != 0) - logger.info("Cube {} CapabilityInfluences: {}", cube.getCanonicalName(), - StringUtils.join(influencingMeasures, ",")); + logger.info("Cube {} CapabilityInfluences: {}", cube.getCanonicalName(), StringUtils.join(influencingMeasures, ",")); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java index e268efd..85ca929 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeDescManager.java @@ -129,8 +129,7 @@ public class CubeDescManager { } @Override - public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) - throws IOException { + public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { String cubeDescName = cacheKey; CubeDesc cubeDesc = getCubeDesc(cubeDescName); String modelName = cubeDesc == null ? null : cubeDesc.getModel().getName(); @@ -266,8 +265,7 @@ public class CubeDescManager { int keyLength = 0; while (parameter != null) { String encoding = configuration.get(TopNMeasureType.CONFIG_ENCODING_PREFIX + parameter.getValue()); - String encodingVersionStr = configuration - .get(TopNMeasureType.CONFIG_ENCODING_VERSION_PREFIX + parameter.getValue()); + String encodingVersionStr = configuration.get(TopNMeasureType.CONFIG_ENCODING_VERSION_PREFIX + parameter.getValue()); if (StringUtils.isEmpty(encoding) || DictionaryDimEnc.ENCODING_NAME.equals(encoding)) { keyLength += DictionaryDimEnc.MAX_ENCODING_LENGTH; // estimation for dict encoding } else { @@ -281,8 +279,7 @@ public class CubeDescManager { } } Object[] encodingConf = DimensionEncoding.parseEncodingConf(encoding); - DimensionEncoding dimensionEncoding = DimensionEncodingFactory.create((String) encodingConf[0], - (String[]) encodingConf[1], encodingVersion); + DimensionEncoding dimensionEncoding = DimensionEncodingFactory.create((String) encodingConf[0], (String[]) encodingConf[1], encodingVersion); keyLength += dimensionEncoding.getLengthOfEncoding(); } @@ -312,19 +309,16 @@ public class CubeDescManager { private void reloadAllCubeDesc() throws IOException { ResourceStore store = getStore(); - logger.info("Reloading Cube Metadata from folder " - + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); + logger.info("Reloading Cube Metadata from folder " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); cubeDescMap.clear(); - List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_DESC_RESOURCE_ROOT, - MetadataConstants.FILE_SURFIX); + List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { CubeDesc desc = loadCubeDesc(path, true); if (!path.equals(desc.getResourcePath())) { - logger.error( - "Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); + logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); continue; } if (cubeDescMap.containsKey(desc.getName())) { http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java index e9645b9..fb9a7a7 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeInstance.java @@ -127,8 +127,7 @@ public class CubeInstance extends RootPersistentEntity implements IRealization, // in a temporary broken state, so that user can edit and fix it. Broken state is often due to // schema changes at source. public boolean allowBrokenDescriptor() { - return (getStatus() == RealizationStatusEnum.DISABLED || getStatus() == RealizationStatusEnum.DESCBROKEN) - && segments.isEmpty(); + return (getStatus() == RealizationStatusEnum.DISABLED || getStatus() == RealizationStatusEnum.DESCBROKEN) && segments.isEmpty(); } public String getResourcePath() { @@ -362,8 +361,7 @@ public class CubeInstance extends RootPersistentEntity implements IRealization, if (!this.getDescriptor().getModel().getPartitionDesc().isPartitioned()) return false; - return this.getDescriptor().getAutoMergeTimeRanges() != null - && this.getDescriptor().getAutoMergeTimeRanges().length > 0; + return this.getDescriptor().getAutoMergeTimeRanges() != null && this.getDescriptor().getAutoMergeTimeRanges().length > 0; } public Pair<Long, Long> autoMergeCubeSegments() throws IOException { http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java index 32e2316..e6cd761 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java @@ -109,8 +109,7 @@ public class CubeManager implements IRealizationProvider { if (CACHE.size() > 1) { logger.warn("More than one singleton exist"); for (KylinConfig kylinConfig : CACHE.keySet()) { - logger.warn("type: " + kylinConfig.getClass() + " reference: " - + System.identityHashCode(kylinConfig.base())); + logger.warn("type: " + kylinConfig.getClass() + " reference: " + System.identityHashCode(kylinConfig.base())); } } return r; @@ -161,8 +160,7 @@ public class CubeManager implements IRealizationProvider { } @Override - public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) - throws IOException { + public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { String cubeName = cacheKey; if (event == Event.DROP) @@ -170,8 +168,7 @@ public class CubeManager implements IRealizationProvider { else reloadCubeLocal(cubeName); - for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, - cubeName)) { + for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, cubeName)) { broadcaster.notifyProjectDataUpdate(prj.getName()); } } @@ -217,22 +214,19 @@ public class CubeManager implements IRealizationProvider { return result; } - public DictionaryInfo buildDictionary(CubeSegment cubeSeg, TblColRef col, IReadableTable inpTable) - throws IOException { + public DictionaryInfo buildDictionary(CubeSegment cubeSeg, TblColRef col, IReadableTable inpTable) throws IOException { CubeDesc cubeDesc = cubeSeg.getCubeDesc(); if (!cubeDesc.getAllColumnsNeedDictionaryBuilt().contains(col)) return null; String builderClass = cubeDesc.getDictionaryBuilderClass(col); - DictionaryInfo dictInfo = getDictionaryManager().buildDictionary(cubeDesc.getModel(), col, inpTable, - builderClass); + DictionaryInfo dictInfo = getDictionaryManager().buildDictionary(cubeDesc.getModel(), col, inpTable, builderClass); saveDictionaryInfo(cubeSeg, col, dictInfo); return dictInfo; } - public DictionaryInfo saveDictionary(CubeSegment cubeSeg, TblColRef col, IReadableTable inpTable, - Dictionary<String> dict) throws IOException { + public DictionaryInfo saveDictionary(CubeSegment cubeSeg, TblColRef col, IReadableTable inpTable, Dictionary<String> dict) throws IOException { CubeDesc cubeDesc = cubeSeg.getCubeDesc(); if (!cubeDesc.getAllColumnsNeedDictionaryBuilt().contains(col)) return null; @@ -269,8 +263,7 @@ public class CubeManager implements IRealizationProvider { info = dictMgr.getDictionaryInfo(dictResPath); if (info == null) - throw new IllegalStateException("No dictionary found by " + dictResPath - + ", invalid cube state; cube segment" + cubeSeg + ", col " + col); + throw new IllegalStateException("No dictionary found by " + dictResPath + ", invalid cube state; cube segment" + cubeSeg + ", col " + col); } catch (IOException e) { throw new IllegalStateException("Failed to get dictionary for cube segment" + cubeSeg + ", col" + col, e); } @@ -325,8 +318,7 @@ public class CubeManager implements IRealizationProvider { } // sync on update - public CubeInstance createCube(String cubeName, String projectName, CubeDesc desc, String owner) - throws IOException { + public CubeInstance createCube(String cubeName, String projectName, CubeDesc desc, String owner) throws IOException { logger.info("Creating cube '" + projectName + "-->" + cubeName + "' from desc '" + desc.getName() + "'"); // save cube resource @@ -349,8 +341,7 @@ public class CubeManager implements IRealizationProvider { cube.setOwner(owner); updateCubeWithRetry(new CubeUpdate(cube), 0); - ProjectManager.getInstance(config).moveRealizationToProject(RealizationType.CUBE, cube.getName(), projectName, - owner); + ProjectManager.getInstance(config).moveRealizationToProject(RealizationType.CUBE, cube.getName(), projectName, owner); if (listener != null) listener.afterCubeCreate(cube); @@ -465,16 +456,12 @@ public class CubeManager implements IRealizationProvider { } public CubeSegment appendSegment(CubeInstance cube, SourcePartition sourcePartition) throws IOException { - return appendSegment(cube, sourcePartition.getStartDate(), sourcePartition.getEndDate(), - sourcePartition.getStartOffset(), sourcePartition.getEndOffset(), - sourcePartition.getSourcePartitionOffsetStart(), sourcePartition.getSourcePartitionOffsetEnd()); + return appendSegment(cube, sourcePartition.getStartDate(), sourcePartition.getEndDate(), sourcePartition.getStartOffset(), sourcePartition.getEndOffset(), sourcePartition.getSourcePartitionOffsetStart(), sourcePartition.getSourcePartitionOffsetEnd()); } - CubeSegment appendSegment(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset, - Map<Integer, Long> sourcePartitionOffsetStart, Map<Integer, Long> sourcePartitionOffsetEnd) - throws IOException { + CubeSegment appendSegment(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset, Map<Integer, Long> sourcePartitionOffsetStart, Map<Integer, Long> sourcePartitionOffsetEnd) throws IOException { checkBuildingSegment(cube); - + // fix start/end a bit if (cube.getModel().getPartitionDesc().isPartitioned()) { // if missing start, set it to where last time ends @@ -500,22 +487,19 @@ public class CubeManager implements IRealizationProvider { return newSegment; } - public CubeSegment refreshSegment(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset) - throws IOException { + public CubeSegment refreshSegment(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset) throws IOException { checkBuildingSegment(cube); CubeSegment newSegment = newSegment(cube, startDate, endDate, startOffset, endOffset); Pair<Boolean, Boolean> pair = CubeValidator.fitInSegments(cube.getSegments(), newSegment); if (pair.getFirst() == false || pair.getSecond() == false) - throw new IllegalArgumentException("The new refreshing segment " + newSegment - + " does not match any existing segment in cube " + cube); + throw new IllegalArgumentException("The new refreshing segment " + newSegment + " does not match any existing segment in cube " + cube); if (startOffset > 0 || endOffset > 0) { CubeSegment toRefreshSeg = null; for (CubeSegment cubeSegment : cube.getSegments()) { - if (cubeSegment.getSourceOffsetStart() == startOffset - && cubeSegment.getSourceOffsetEnd() == endOffset) { + if (cubeSegment.getSourceOffsetStart() == startOffset && cubeSegment.getSourceOffsetEnd() == endOffset) { toRefreshSeg = cubeSegment; break; } @@ -536,8 +520,7 @@ public class CubeManager implements IRealizationProvider { return newSegment; } - public CubeSegment mergeSegments(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset, - boolean force) throws IOException { + public CubeSegment mergeSegments(CubeInstance cube, long startDate, long endDate, long startOffset, long endOffset, boolean force) throws IOException { if (cube.getSegments().isEmpty()) throw new IllegalArgumentException("Cube " + cube + " has no segments"); if (startDate >= endDate && startOffset >= endOffset) @@ -551,11 +534,9 @@ public class CubeManager implements IRealizationProvider { if (isOffsetsOn) { // offset cube, merge by date range? if (startOffset == endOffset) { - Pair<CubeSegment, CubeSegment> pair = cube.getSegments(SegmentStatusEnum.READY) - .findMergeOffsetsByDateRange(startDate, endDate, Long.MAX_VALUE); + Pair<CubeSegment, CubeSegment> pair = cube.getSegments(SegmentStatusEnum.READY).findMergeOffsetsByDateRange(startDate, endDate, Long.MAX_VALUE); if (pair == null) - throw new IllegalArgumentException("Find no segments to merge by date range " + startDate + "-" - + endDate + " for cube " + cube); + throw new IllegalArgumentException("Find no segments to merge by date range " + startDate + "-" + endDate + " for cube " + cube); startOffset = pair.getFirst().getSourceOffsetStart(); endOffset = pair.getSecond().getSourceOffsetEnd(); } @@ -575,9 +556,7 @@ public class CubeManager implements IRealizationProvider { List<CubeSegment> mergingSegments = cube.getMergingSegments(newSegment); if (mergingSegments.size() <= 1) - throw new IllegalArgumentException( - "Range " + newSegment.getSourceOffsetStart() + "-" + newSegment.getSourceOffsetEnd() - + " must contain at least 2 segments, but there is " + mergingSegments.size()); + throw new IllegalArgumentException("Range " + newSegment.getSourceOffsetStart() + "-" + newSegment.getSourceOffsetEnd() + " must contain at least 2 segments, but there is " + mergingSegments.size()); CubeSegment first = mergingSegments.get(0); CubeSegment last = mergingSegments.get(mergingSegments.size() - 1); @@ -602,9 +581,7 @@ public class CubeManager implements IRealizationProvider { } if (emptySegment.size() > 0) { - throw new IllegalArgumentException( - "Empty cube segment found, couldn't merge unless 'forceMergeEmptySegment' set to true: " - + emptySegment); + throw new IllegalArgumentException("Empty cube segment found, couldn't merge unless 'forceMergeEmptySegment' set to true: " + emptySegment); } } @@ -643,15 +620,13 @@ public class CubeManager implements IRealizationProvider { private void checkBuildingSegment(CubeInstance cube) { int maxBuldingSeg = cube.getConfig().getMaxBuildingSegments(); if (cube.getBuildingSegments().size() >= maxBuldingSeg) { - throw new IllegalStateException( - "There is already " + cube.getBuildingSegments().size() + " building segment; "); + throw new IllegalStateException("There is already " + cube.getBuildingSegments().size() + " building segment; "); } } private void checkCubeIsPartitioned(CubeInstance cube) { if (cube.getDescriptor().getModel().getPartitionDesc().isPartitioned() == false) { - throw new IllegalStateException( - "there is no partition date column specified, only full build is supported"); + throw new IllegalStateException("there is no partition date column specified, only full build is supported"); } } @@ -675,16 +650,14 @@ public class CubeManager implements IRealizationProvider { String[] pkCols = join.getPrimaryKey(); String snapshotResPath = cubeSegment.getSnapshotResPath(tableName); if (snapshotResPath == null) - throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" - + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment); + throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment); try { SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName); return new LookupStringTable(tableDesc, pkCols, snapshot); } catch (IOException e) { - throw new IllegalStateException( - "Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); + throw new IllegalStateException("Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); } } @@ -728,8 +701,7 @@ public class CubeManager implements IRealizationProvider { public void promoteNewlyBuiltSegments(CubeInstance cube, CubeSegment newSegment) throws IOException { if (StringUtils.isBlank(newSegment.getStorageLocationIdentifier())) - throw new IllegalStateException( - "For cube " + cube + ", segment " + newSegment + " missing StorageLocationIdentifier"); + throw new IllegalStateException("For cube " + cube + ", segment " + newSegment + " missing StorageLocationIdentifier"); if (StringUtils.isBlank(newSegment.getLastBuildJobID())) throw new IllegalStateException("For cube " + cube + ", segment " + newSegment + " missing LastBuildJobID"); @@ -741,8 +713,7 @@ public class CubeManager implements IRealizationProvider { List<CubeSegment> tobe = cube.calculateToBeSegments(newSegment); if (tobe.contains(newSegment) == false) - throw new IllegalStateException( - "For cube " + cube + ", segment " + newSegment + " is expected but not in the tobe " + tobe); + throw new IllegalStateException("For cube " + cube + ", segment " + newSegment + " is expected but not in the tobe " + tobe); newSegment.setStatus(SegmentStatusEnum.READY); @@ -755,8 +726,7 @@ public class CubeManager implements IRealizationProvider { logger.info("Promoting cube " + cube + ", new segment " + newSegment + ", to remove segments " + toRemoveSegs); CubeUpdate cubeBuilder = new CubeUpdate(cube); - cubeBuilder.setToRemoveSegs(toRemoveSegs.toArray(new CubeSegment[toRemoveSegs.size()])) - .setToUpdateSegs(newSegment).setStatus(RealizationStatusEnum.READY); + cubeBuilder.setToRemoveSegs(toRemoveSegs.toArray(new CubeSegment[toRemoveSegs.size()])).setToUpdateSegs(newSegment).setStatus(RealizationStatusEnum.READY); updateCube(cubeBuilder); } @@ -764,8 +734,7 @@ public class CubeManager implements IRealizationProvider { List<CubeSegment> tobe = cube.calculateToBeSegments(newSegments); List<CubeSegment> newList = Arrays.asList(newSegments); if (tobe.containsAll(newList) == false) { - throw new IllegalStateException("For cube " + cube + ", the new segments " + newList - + " do not fit in its current " + cube.getSegments() + "; the resulted tobe is " + tobe); + throw new IllegalStateException("For cube " + cube + ", the new segments " + newList + " do not fit in its current " + cube.getSegments() + "; the resulted tobe is " + tobe); } } @@ -807,9 +776,7 @@ public class CubeManager implements IRealizationProvider { CubeDesc cubeDesc = CubeDescManager.getInstance(config).getCubeDesc(cube.getDescName()); checkNotNull(cubeDesc, "cube descriptor '%s' (for cube '%s') not found", cube.getDescName(), cubeName); if (!isSpecialTestCube(cubeName)) - checkState(cubeDesc.getName().equals(cubeName), - "cube name '%s' must be same as descriptor name '%s', but it is not", cubeName, - cubeDesc.getName()); + checkState(cubeDesc.getName().equals(cubeName), "cube name '%s' must be same as descriptor name '%s', but it is not", cubeName, cubeDesc.getName()); if (!cubeDesc.getError().isEmpty()) { cube.setStatus(RealizationStatusEnum.DESCBROKEN); @@ -840,8 +807,7 @@ public class CubeManager implements IRealizationProvider { private boolean isSpecialTestCube(String cubeName) { return cubeName.equals("kylin_sales_cube") // - || config.isDevEnv() - && (cubeName.startsWith("test_kylin_cube") || cubeName.startsWith("test_streaming")); + || config.isDevEnv() && (cubeName.startsWith("test_kylin_cube") || cubeName.startsWith("test_streaming")); } private MetadataManager getMetadataManager() { @@ -938,8 +904,7 @@ public class CubeManager implements IRealizationProvider { hole.setDateRangeStart(first.getDateRangeEnd()); hole.setDateRangeEnd(second.getDateRangeStart()); } - hole.setName(CubeSegment.makeSegmentName(hole.getDateRangeStart(), hole.getDateRangeEnd(), - hole.getSourceOffsetStart(), hole.getSourceOffsetEnd())); + hole.setName(CubeSegment.makeSegmentName(hole.getDateRangeStart(), hole.getDateRangeEnd(), hole.getSourceOffsetStart(), hole.getSourceOffsetEnd())); holes.add(hole); } } @@ -957,8 +922,7 @@ public class CubeManager implements IRealizationProvider { List<DictionaryDesc> dictionaryDescList = cubeDesc.getDictionaries(); if (dictionaryDescList != null) { for (DictionaryDesc dictionaryDesc : dictionaryDescList) { - if (dictionaryDesc.getBuilderClass() != null - && dictionaryDesc.getBuilderClass().equalsIgnoreCase(GLOBAL_DICTIONNARY_CLASS)) { + if (dictionaryDesc.getBuilderClass() != null && dictionaryDesc.getBuilderClass().equalsIgnoreCase(GLOBAL_DICTIONNARY_CLASS)) { for (int i = 0; i < factDictCols.size(); i++) { if (factDictCols.get(i).equals(dictionaryDesc.getColumnRef())) { uhcIndex[i] = 1; http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/CubeSegment.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeSegment.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeSegment.java index 24f3cdc..1b28bd8 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeSegment.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeSegment.java @@ -371,11 +371,9 @@ public class CubeSegment implements Comparable<CubeSegment>, IBuildable, ISegmen public void validate() throws IllegalStateException { if (cubeInstance.getDescriptor().getModel().getPartitionDesc().isPartitioned()) { if (!isSourceOffsetsOn() && dateRangeStart >= dateRangeEnd) - throw new IllegalStateException("Invalid segment, dateRangeStart(" + dateRangeStart - + ") must be smaller than dateRangeEnd(" + dateRangeEnd + ") in segment " + this); + throw new IllegalStateException("Invalid segment, dateRangeStart(" + dateRangeStart + ") must be smaller than dateRangeEnd(" + dateRangeEnd + ") in segment " + this); if (isSourceOffsetsOn() && sourceOffsetStart >= sourceOffsetEnd) - throw new IllegalStateException("Invalid segment, sourceOffsetStart(" + sourceOffsetStart - + ") must be smaller than sourceOffsetEnd(" + sourceOffsetEnd + ") in segment " + this); + throw new IllegalStateException("Invalid segment, sourceOffsetStart(" + sourceOffsetStart + ") must be smaller than sourceOffsetEnd(" + sourceOffsetEnd + ") in segment " + this); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/RawQueryLastHacker.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/RawQueryLastHacker.java b/core-cube/src/main/java/org/apache/kylin/cube/RawQueryLastHacker.java index e2bce26..d2e3a83 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/RawQueryLastHacker.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/RawQueryLastHacker.java @@ -39,8 +39,7 @@ public class RawQueryLastHacker { // If no group by and metric found, then it's simple query like select ... from ... where ..., // But we have no raw data stored, in order to return better results, we hack to output sum of metric column - logger.info( - "No group by and aggregation found in this query, will hack some result for better look of output..."); + logger.info("No group by and aggregation found in this query, will hack some result for better look of output..."); // If it's select * from ..., // We need to retrieve cube to manually add columns into sqlDigest, so that we have full-columns results as output. http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cli/CubeSignatureRefresher.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cli/CubeSignatureRefresher.java b/core-cube/src/main/java/org/apache/kylin/cube/cli/CubeSignatureRefresher.java index 0d04780..1db804f 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cli/CubeSignatureRefresher.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cli/CubeSignatureRefresher.java @@ -53,8 +53,7 @@ public class CubeSignatureRefresher { } public void update() { - logger.info("Reloading Cube Metadata from store: " - + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); + logger.info("Reloading Cube Metadata from store: " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); CubeDescManager cubeDescManager = CubeDescManager.getInstance(config); List<CubeDesc> cubeDescs; if (ArrayUtils.isEmpty(cubeNames)) { http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cli/DictionaryGeneratorCLI.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cli/DictionaryGeneratorCLI.java b/core-cube/src/main/java/org/apache/kylin/cube/cli/DictionaryGeneratorCLI.java index 6a4bef4..e7368e8 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cli/DictionaryGeneratorCLI.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cli/DictionaryGeneratorCLI.java @@ -47,16 +47,14 @@ public class DictionaryGeneratorCLI { private static final Logger logger = LoggerFactory.getLogger(DictionaryGeneratorCLI.class); - public static void processSegment(KylinConfig config, String cubeName, String segmentID, - DistinctColumnValuesProvider factTableValueProvider, DictionaryProvider dictProvider) throws IOException { + public static void processSegment(KylinConfig config, String cubeName, String segmentID, DistinctColumnValuesProvider factTableValueProvider, DictionaryProvider dictProvider) throws IOException { CubeInstance cube = CubeManager.getInstance(config).getCube(cubeName); CubeSegment segment = cube.getSegmentById(segmentID); processSegment(config, segment, factTableValueProvider, dictProvider); } - private static void processSegment(KylinConfig config, CubeSegment cubeSeg, - DistinctColumnValuesProvider factTableValueProvider, DictionaryProvider dictProvider) throws IOException { + private static void processSegment(KylinConfig config, CubeSegment cubeSeg, DistinctColumnValuesProvider factTableValueProvider, DictionaryProvider dictProvider) throws IOException { CubeManager cubeMgr = CubeManager.getInstance(config); // dictionary @@ -69,8 +67,7 @@ public class DictionaryGeneratorCLI { logger.debug("Dict for '" + col.getName() + "' has already been built, save it"); cubeMgr.saveDictionary(cubeSeg, col, inpTable, dict); } else { - logger.debug( - "Dict for '" + col.getName() + "' not pre-built, build it from " + inpTable.toString()); + logger.debug("Dict for '" + col.getName() + "' not pre-built, build it from " + inpTable.toString()); cubeMgr.buildDictionary(cubeSeg, col, inpTable); } } else { @@ -94,7 +91,7 @@ public class DictionaryGeneratorCLI { logger.info("Building snapshot of " + tableIdentity); cubeMgr.buildSnapshotTable(cubeSeg, tableIdentity); } - + for (TableRef lookup : toCheckLookup) { logger.info("Checking snapshot of " + lookup); JoinDesc join = cubeSeg.getModel().getJoinsTree().getJoinByPKSide(lookup); @@ -102,8 +99,7 @@ public class DictionaryGeneratorCLI { } } - private static IReadableTable decideInputTable(DataModelDesc model, TblColRef col, - DistinctColumnValuesProvider factTableValueProvider) { + private static IReadableTable decideInputTable(DataModelDesc model, TblColRef col, DistinctColumnValuesProvider factTableValueProvider) { KylinConfig config = model.getConfig(); DictionaryManager dictMgr = DictionaryManager.getInstance(config); TblColRef srcCol = dictMgr.decideSourceData(model, col); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cuboid/AggregationGroupScheduler.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/AggregationGroupScheduler.java b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/AggregationGroupScheduler.java index c69dc5e..cdcbcfc 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/AggregationGroupScheduler.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/AggregationGroupScheduler.java @@ -122,5 +122,5 @@ public class AggregationGroupScheduler { } return false; } - + } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cuboid/Cuboid.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/Cuboid.java b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/Cuboid.java index f80e8c4..76cb511 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/Cuboid.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/Cuboid.java @@ -58,14 +58,12 @@ public class Cuboid implements Comparable<Cuboid>, Serializable { }; // this is the only entry point for query to find the right cuboid - public static Cuboid identifyCuboid(CubeDesc cubeDesc, Set<TblColRef> dimensions, - Collection<FunctionDesc> metrics) { + public static Cuboid identifyCuboid(CubeDesc cubeDesc, Set<TblColRef> dimensions, Collection<FunctionDesc> metrics) { long cuboidID = identifyCuboidId(cubeDesc, dimensions, metrics); return Cuboid.findById(cubeDesc, cuboidID); } - public static long identifyCuboidId(CubeDesc cubeDesc, Set<TblColRef> dimensions, - Collection<FunctionDesc> metrics) { + public static long identifyCuboidId(CubeDesc cubeDesc, Set<TblColRef> dimensions, Collection<FunctionDesc> metrics) { for (FunctionDesc metric : metrics) { if (metric.getMeasureType().onlyAggrInBaseCuboid()) return Cuboid.getBaseCuboidId(cubeDesc); @@ -178,16 +176,14 @@ public class Cuboid implements Comparable<Cuboid>, Serializable { if (!agg.isOnTree(cuboidID)) { // no column, add one column - long nonJointDims = removeBits((agg.getPartialCubeFullMask() ^ agg.getMandatoryColumnMask()), - agg.getJoints()); + long nonJointDims = removeBits((agg.getPartialCubeFullMask() ^ agg.getMandatoryColumnMask()), agg.getJoints()); if (nonJointDims != 0) { - long nonJointNonHierarchy = removeBits(nonJointDims, - Collections2.transform(agg.getHierarchyMasks(), new Function<HierarchyMask, Long>() { - @Override - public Long apply(HierarchyMask input) { - return input.fullMask; - } - })); + long nonJointNonHierarchy = removeBits(nonJointDims, Collections2.transform(agg.getHierarchyMasks(), new Function<HierarchyMask, Long>() { + @Override + public Long apply(HierarchyMask input) { + return input.fullMask; + } + })); if (nonJointNonHierarchy != 0) { //there exists dim that does not belong to any joint or any hierarchy, that's perfect return cuboidID | Long.lowestOneBit(nonJointNonHierarchy); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidCLI.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidCLI.java b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidCLI.java index 530e149..e2ff97e 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidCLI.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidCLI.java @@ -75,16 +75,14 @@ public class CuboidCLI { if (validate) { if (enableDimCap) { if (cubeDesc.getAllCuboids().size() != cuboidSet.size()) { - throw new IllegalStateException( - "Expected cuboid set " + cubeDesc.getAllCuboids() + "; but actual cuboid set " + cuboidSet); + throw new IllegalStateException("Expected cuboid set " + cubeDesc.getAllCuboids() + "; but actual cuboid set " + cuboidSet); } } else { //only run this for test purpose, performance is bad when # of dims is large TreeSet<Long> enumCuboids = enumCalcCuboidCount(cubeDesc); System.out.println(Arrays.toString(enumCuboids.toArray(new Long[enumCuboids.size()]))); if (enumCuboids.equals(cuboidSet) == false) { - throw new IllegalStateException( - "Expected cuboid set " + enumCuboids + "; but actual cuboid set " + cuboidSet); + throw new IllegalStateException("Expected cuboid set " + enumCuboids + "; but actual cuboid set " + cuboidSet); } //check all valid and invalid http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidScheduler.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidScheduler.java b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidScheduler.java index f1f5067..def3f03 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidScheduler.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/CuboidScheduler.java @@ -19,6 +19,10 @@ package org.apache.kylin.cube.cuboid; import java.io.Serializable; + +/** + */ + import java.util.ArrayDeque; import java.util.Collection; import java.util.Collections; @@ -42,9 +46,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -/** - */ - @SuppressWarnings("serial") public class CuboidScheduler implements Serializable { private final CubeDesc cubeDesc; @@ -142,8 +143,7 @@ public class CuboidScheduler implements Serializable { maxCombination = maxCombination < 0 ? Long.MAX_VALUE : maxCombination; while (!children.isEmpty()) { if (cuboidHolder.size() > maxCombination) { - throw new IllegalStateException("Too many cuboids for the cube. Cuboid combination reached " - + cuboidHolder.size() + " and limit is " + maxCombination + ". Abort calculation."); + throw new IllegalStateException("Too many cuboids for the cube. Cuboid combination reached " + cuboidHolder.size() + " and limit is " + maxCombination + ". Abort calculation."); } cuboidHolder.addAll(children); children = getOnTreeParentsByLayer(children); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/gridtable/AsymmetricRecordComparator.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/AsymmetricRecordComparator.java b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/AsymmetricRecordComparator.java index 32a9c7e..74dc855 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/AsymmetricRecordComparator.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/AsymmetricRecordComparator.java @@ -18,11 +18,11 @@ package org.apache.kylin.cube.gridtable; -import java.util.Collection; - import org.apache.kylin.common.util.ByteArray; import org.apache.kylin.gridtable.GTRecord; +import java.util.Collection; + /** * asymmetric means compare(a,b) > 0 does not cause compare(b,a) < 0 * so min max functions will not be supported http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java index cd05fb6..aaa12a7 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java @@ -123,8 +123,7 @@ public class CubeCodeSystem implements IGTCodeSystem { try { serializer.serialize(value, buf); } catch (IllegalArgumentException ex) { - IllegalArgumentException rewordEx = new IllegalArgumentException("Column " + col + " value '" - + toStringBinary(value) + "' met dictionary error: " + ex.getMessage()); + IllegalArgumentException rewordEx = new IllegalArgumentException("Column " + col + " value '" + toStringBinary(value) + "' met dictionary error: " + ex.getMessage()); rewordEx.setStackTrace(ex.getStackTrace()); throw rewordEx; } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeGridTable.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeGridTable.java b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeGridTable.java index 6dae1ef..5cee9df 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeGridTable.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeGridTable.java @@ -28,8 +28,7 @@ public class CubeGridTable { GTInfo.Builder builder = GTInfo.builder(); builder.setTableName("Cuboid " + cuboid.getId()); - builder.setCodeSystem( - new CubeCodeSystem(mapping.getDimensionEncodings(dimEncMap), mapping.getDependentMetricsMap())); + builder.setCodeSystem(new CubeCodeSystem(mapping.getDimensionEncodings(dimEncMap), mapping.getDependentMetricsMap())); builder.setColumns(mapping.getDataTypes()); builder.setPrimaryKey(mapping.getPrimaryKey()); builder.enableColumnBlock(mapping.getColumnBlocks()); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/gridtable/ScanRangePlannerBase.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/ScanRangePlannerBase.java b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/ScanRangePlannerBase.java index 05fbef5..ed0a77a 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/ScanRangePlannerBase.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/ScanRangePlannerBase.java @@ -118,8 +118,7 @@ public abstract class ScanRangePlannerBase { } @SuppressWarnings("unchecked") - ColumnRange newRange = new ColumnRange(comp.getColumn(), (Set<ByteArray>) comp.getValues(), - comp.getOperator()); + ColumnRange newRange = new ColumnRange(comp.getColumn(), (Set<ByteArray>) comp.getValues(), comp.getOperator()); ColumnRange existing = rangeMap.get(newRange.column); if (existing == null) { rangeMap.put(newRange.column, newRange); @@ -171,8 +170,7 @@ public abstract class ScanRangePlannerBase { this.column = column; //TODO: the treatment is un-precise - if (op == TupleFilter.FilterOperatorEnum.EQ || op == TupleFilter.FilterOperatorEnum.IN - || op == TupleFilter.FilterOperatorEnum.LTE || op == TupleFilter.FilterOperatorEnum.GTE) { + if (op == TupleFilter.FilterOperatorEnum.EQ || op == TupleFilter.FilterOperatorEnum.IN || op == TupleFilter.FilterOperatorEnum.LTE || op == TupleFilter.FilterOperatorEnum.GTE) { isBoundryInclusive = true; } @@ -270,8 +268,7 @@ public abstract class ScanRangePlannerBase { private Set<ByteArray> filter(Set<ByteArray> equalValues, ByteArray beginValue, ByteArray endValue) { Set<ByteArray> result = Sets.newHashSetWithExpectedSize(equalValues.size()); for (ByteArray v : equalValues) { - if (rangeStartEndComparator.comparator.compare(beginValue, v) <= 0 - && rangeStartEndComparator.comparator.compare(v, endValue) <= 0) { + if (rangeStartEndComparator.comparator.compare(beginValue, v) <= 0 && rangeStartEndComparator.comparator.compare(v, endValue) <= 0) { result.add(v); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/AbstractInMemCubeBuilder.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/AbstractInMemCubeBuilder.java b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/AbstractInMemCubeBuilder.java index 97dcc70..c7a4a05 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/AbstractInMemCubeBuilder.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/AbstractInMemCubeBuilder.java @@ -49,8 +49,7 @@ abstract public class AbstractInMemCubeBuilder { protected int taskThreadCount = 1; protected int reserveMemoryMB = 100; - public AbstractInMemCubeBuilder(CubeDesc cubeDesc, IJoinedFlatTableDesc flatDesc, - Map<TblColRef, Dictionary<String>> dictionaryMap) { + public AbstractInMemCubeBuilder(CubeDesc cubeDesc, IJoinedFlatTableDesc flatDesc, Map<TblColRef, Dictionary<String>> dictionaryMap) { if (flatDesc == null) throw new NullPointerException(); if (cubeDesc == null) @@ -92,8 +91,7 @@ abstract public class AbstractInMemCubeBuilder { protected void outputCuboid(long cuboidId, GridTable gridTable, ICuboidWriter output) throws IOException { long startTime = System.currentTimeMillis(); - GTScanRequest req = new GTScanRequestBuilder().setInfo(gridTable.getInfo()).setRanges(null).setDimensions(null) - .setFilterPushDown(null).createGTScanRequest(); + GTScanRequest req = new GTScanRequestBuilder().setInfo(gridTable.getInfo()).setRanges(null).setDimensions(null).setFilterPushDown(null).createGTScanRequest(); IGTScanner scanner = gridTable.scan(req); for (GTRecord record : scanner) { output.write(cuboidId, record); http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/ConcurrentDiskStore.java ---------------------------------------------------------------------- diff --git a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/ConcurrentDiskStore.java b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/ConcurrentDiskStore.java index e6f5f08..41d2dfb 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/ConcurrentDiskStore.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/ConcurrentDiskStore.java @@ -323,8 +323,7 @@ public class ConcurrentDiskStore implements IGTStore, Closeable { private void openWriteChannel(long startOffset) throws IOException { if (startOffset > 0) { // TODO does not support append yet - writeChannel = FileChannel.open(diskFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND, - StandardOpenOption.WRITE); + writeChannel = FileChannel.open(diskFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND, StandardOpenOption.WRITE); } else { diskFile.delete(); writeChannel = FileChannel.open(diskFile.toPath(), StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE);