KylinVersion cubeVersion = new KylinVersion(getVersion()); KylinVersion kylinVersion = KylinVersion.getCurrentVersion(); if (!kylinVersion.isCompatibleWith(cubeVersion)) { logger.info("checkSignature on {} is skipped as the its version {} is different from kylin version {}", getName(), cubeVersion, kylinVersion); if (kylinVersion.isCompatibleWith(cubeVersion) && !kylinVersion.isSignatureCompatibleWith(cubeVersion)) { logger.info( "checkSignature on {} is skipped as the its version is {} (not signature compatible but compatible) ",
@Test public void testCompare() { Assert.assertEquals(true, KylinVersion.isBefore200("1.9.9")); Assert.assertEquals(false, KylinVersion.isBefore200("2.0.0")); Assert.assertEquals(true, new KylinVersion("2.1.0").compareTo(new KylinVersion("2.1.0.123")) < 0); } }
public static String getClientDetailInformation() { StringBuilder buf = new StringBuilder(); buf.append("kylin.home: ").append(new File(KylinConfig.getKylinHome()).getAbsolutePath()).append("\n"); buf.append("kylin.version:").append(KylinVersion.getCurrentVersion()).append("\n"); buf.append("commit:").append(KylinVersion.getGitCommitInfo()).append("\n"); buf.append("os.name:").append(System.getProperty("os.name")).append("\n"); buf.append("os.arch:").append(System.getProperty("os.arch")).append("\n"); buf.append("os.version:").append(System.getProperty("os.version")).append("\n"); buf.append("java.version:").append(System.getProperty("java.version")).append("\n"); buf.append("java.vendor:").append(System.getProperty("java.vendor")); return buf.toString(); } }
public String eval() { return KylinVersion.getCurrentVersion().toString(); } }
public static boolean isBefore200(String ver) { return new KylinVersion(ver).compareTo(VERSION_200) < 0; }
private boolean isUsePutRowKeyToHllNewAlgorithm(CubeDesc cubeDesc) { boolean isUsePutRowKeyToHllNewAlgorithm; if (KylinVersion.isBefore200(cubeDesc.getVersion())) { isUsePutRowKeyToHllNewAlgorithm = false; logger.info("Found KylinVersion: {}. Use old algorithm for cuboid sampling.", cubeDesc.getVersion()); } else { isUsePutRowKeyToHllNewAlgorithm = true; logger.info( "Found KylinVersion: {}. Use new algorithm for cuboid sampling. About the details of the new algorithm, please refer to KYLIN-2518", cubeDesc.getVersion()); } return isUsePutRowKeyToHllNewAlgorithm; }
private static List<String> filterByGitCommit(Admin hbaseAdmin, List<String> tableNames) throws IOException { List<String> result = Lists.newLinkedList(); List<String> filteredList = Lists.newLinkedList(); String commitInfo = KylinVersion.getGitCommitInfo(); if (StringUtils.isEmpty(commitInfo)) { return tableNames; } logger.info("Commit Information: " + commitInfo); for (String tableName : tableNames) { HTableDescriptor tableDesc = hbaseAdmin.getTableDescriptor(TableName.valueOf(tableName)); String gitTag = tableDesc.getValue(IRealizationConstants.HTableGitTag); if (commitInfo.equals(gitTag)) { filteredList.add(tableName); } else { result.add(tableName); } } logger.info("Filtered tables don't need to deploy coprocessors: " + filteredList); return result; }
@Test public void testToString() { KylinVersion ver1 = new KylinVersion("2.1.7.321"); Assert.assertEquals(2, ver1.major); Assert.assertEquals(1, ver1.minor); Assert.assertEquals(7, ver1.revision); Assert.assertEquals(321, ver1.internal); Assert.assertEquals("2.1.7.321", ver1.toString()); }
@Test public void testNormal() { KylinVersion ver1 = new KylinVersion("2.1.0"); Assert.assertEquals(2, ver1.major); Assert.assertEquals(1, ver1.minor); Assert.assertEquals(0, ver1.revision); }
public static void main(String[] args) { System.out.println(getKylinClientInformation()); }
public boolean isSignatureCompatibleWith(final KylinVersion v) { if (!isCompatibleWith(v)) { return false; } if (v.isSnapshot || isSnapshot) { return false;//for snapshot versions things are undetermined } boolean signatureIncompatible = Iterables.any(Iterables.filter( SIGNATURE_INCOMPATIBLE_REVISIONS, new Predicate<KylinVersion>() { @Override public boolean apply(@Nullable KylinVersion input) { return v.major == input.major && v.minor == input.minor; } }), new Predicate<KylinVersion>() { @Override public boolean apply(@Nullable KylinVersion input) { return input.revision > v.revision; } }); return !signatureIncompatible; }
@Test public void testVersionUDF() { String currentVer = KylinVersion.getCurrentVersion().toString(); String udfVer = new VersionUDF().eval(); assertTrue(currentVer.equals(udfVer)); } }
if (KylinVersion.isBefore200(cubeDesc.getVersion())) { isUsePutRowKeyToHllNewAlgorithm = false; hf = Hashing.murmur3_32();
public static int compare(String v1, String v2) { return new KylinVersion(v1).compareTo(new KylinVersion(v2)); }
hTableDesc.setValue(IRealizationConstants.HTableTag, kylinConfig.getMetadataUrlPrefix()); hTableDesc.setValue(IRealizationConstants.HTableCreationTime, String.valueOf(System.currentTimeMillis())); String commitInfo = KylinVersion.getGitCommitInfo(); if (!StringUtils.isEmpty(commitInfo)) { hTableDesc.setValue(IRealizationConstants.HTableGitTag, commitInfo);
@Test public void testNoRevision() { KylinVersion ver1 = new KylinVersion("2.1"); Assert.assertEquals(2, ver1.major); Assert.assertEquals(1, ver1.minor); Assert.assertEquals(0, ver1.revision); }
private void dumpBasicDiagInfo() throws IOException { try { for (String commitSHA1File : COMMIT_SHA1_FILES) { File commitFile = new File(KylinConfig.getKylinHome(), commitSHA1File); if (commitFile.exists()) { FileUtils.copyFileToDirectory(commitFile, exportDir); } } } catch (IOException e) { logger.warn("Failed to copy commit_SHA1 file.", e); } String output = KylinVersion.getKylinClientInformation() + "\n"; FileUtils.writeStringToFile(new File(exportDir, "kylin_env"), output, Charset.defaultCharset()); StringBuilder basicSb = new StringBuilder(); basicSb.append("MetaStoreID: ").append(ToolUtil.getMetaStoreId()).append("\n"); basicSb.append("PackageType: ").append(packageType.toUpperCase(Locale.ROOT)).append("\n"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", Locale.ROOT); basicSb.append("PackageTimestamp: ").append(format.format(new Date())).append("\n"); basicSb.append("Host: ").append(ToolUtil.getHostName()).append("\n"); FileUtils.writeStringToFile(new File(exportDir, "info"), basicSb.toString(), Charset.defaultCharset()); }
public boolean isSignatureCompatibleWith(final KylinVersion v) { if (!isCompatibleWith(v)) { return false; } if (v.isSnapshot || isSnapshot) { return false;//for snapshot versions things are undetermined } boolean signatureIncompatible = Iterables.any(Iterables.filter( SIGNATURE_INCOMPATIBLE_REVISIONS, new Predicate<KylinVersion>() { @Override public boolean apply(@Nullable KylinVersion input) { return v.major == input.major && v.minor == input.minor; } }), new Predicate<KylinVersion>() { @Override public boolean apply(@Nullable KylinVersion input) { return input.revision > v.revision; } }); return !signatureIncompatible; }
KylinVersion cubeVersion = new KylinVersion(getVersion()); KylinVersion kylinVersion = KylinVersion.getCurrentVersion(); if (!kylinVersion.isCompatibleWith(cubeVersion)) { logger.info("checkSignature on {} is skipped as the its version {} is different from kylin version {}", getName(), cubeVersion, kylinVersion); if (kylinVersion.isCompatibleWith(cubeVersion) && !kylinVersion.isSignatureCompatibleWith(cubeVersion)) { logger.info( "checkSignature on {} is skipped as the its version is {} (not signature compatible but compatible) ",
public String eval() { return KylinVersion.getCurrentVersion().toString(); } }