@Test public void testGetComment() { String colStr = "`session_date` string COMMENT 'this is session date'"; String comment = serviceJdbc.getComment(colStr); assert (comment.equals("this is session date")); colStr = "`session_date` string COMMENT ''"; comment = serviceJdbc.getComment(colStr); Assert.assertTrue(comment.isEmpty()); }
public String getComment(String colStr) { String pattern = "'([^\"|^\']|\"|\')*'"; Matcher m = Pattern.compile(pattern).matcher(colStr.toLowerCase()); if (m.find()) { String text = m.group(); String result = text.substring(1, text.length() - 1); if (!result.isEmpty()) { LOGGER.info("Found value: " + result); } return result; } else { LOGGER.info("NO MATCH"); return ""; } }
HiveMetaStoreServiceJdbcImpl implements HiveMetaStoreService { public String getComment(String colStr) { String pattern = "'([^\"|^\']|\"|\')*'"; Matcher m = Pattern.compile(pattern).matcher(colStr.toLowerCase()); if (m.find()) { String text = m.group(); String result = text.substring(1, text.length() - 1); if (!result.isEmpty()) { LOGGER.info("Found value: " + result); } return result; } else { LOGGER.info("NO MATCH"); return ""; } } }
HiveMetaStoreServiceJdbcImpl implements HiveMetaStoreService { public String getComment(String colStr) { String pattern = "'([^\"|^\']|\"|\')*'"; Matcher m = Pattern.compile(pattern).matcher(colStr.toLowerCase()); if (m.find()) { String text = m.group(); String result = text.substring(1, text.length() - 1); if (!result.isEmpty()) { LOGGER.info("Found value: " + result); } return result; } else { LOGGER.info("NO MATCH"); return ""; } }  }
HiveMetaStoreServiceJdbcImpl implements HiveMetaStoreService { public String getComment(String colStr) { String pattern = "'([^\"|^\']|\"|\')*'"; Matcher m = Pattern.compile(pattern).matcher(colStr.toLowerCase()); if (m.find()) { String text = m.group(); String result = text.substring(1, text.length() - 1); if (!result.isEmpty()) { LOGGER.info("Found value: " + result); } return result; } else { LOGGER.info("NO MATCH"); return ""; } }  void setConn(Connection conn); void setHiveClassName(String hiveClassName); void setNeedKerberos(String needKerberos); void setKeytabUser(String keytabUser); void setKeytabPath(String keytabPath); @PostConstruct void init(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllDatabases(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllTableNames(String dbName); @Override @Cacheable(unless = "#result==null") Map<String, List<String>> getAllTableNames(); @Override List<Table> getAllTable(String db); @Override Map<String, List<Table>> getAllTable(); @Override @Cacheable(unless = "#result==null") Table getTable(String dbName, String tableName); @Scheduled(fixedRateString = "${cache.evict.hive.fixedRate.in.milliseconds}") @CacheEvict( cacheNames = "jdbcHive", allEntries = true, beforeInvocation = true) void evictHiveCache(); String getLocation(String tableMetadata); List<FieldSchema> getColums(String tableMetadata); String getComment(String colStr); }
HiveMetaStoreServiceJdbcImpl implements HiveMetaStoreService { public String getComment(String colStr) { String pattern = "'([^\"|^\']|\"|\')*'"; Matcher m = Pattern.compile(pattern).matcher(colStr.toLowerCase()); if (m.find()) { String text = m.group(); String result = text.substring(1, text.length() - 1); if (!result.isEmpty()) { LOGGER.info("Found value: " + result); } return result; } else { LOGGER.info("NO MATCH"); return ""; } }  void setConn(Connection conn); void setHiveClassName(String hiveClassName); void setNeedKerberos(String needKerberos); void setKeytabUser(String keytabUser); void setKeytabPath(String keytabPath); @PostConstruct void init(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllDatabases(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllTableNames(String dbName); @Override @Cacheable(unless = "#result==null") Map<String, List<String>> getAllTableNames(); @Override List<Table> getAllTable(String db); @Override Map<String, List<Table>> getAllTable(); @Override @Cacheable(unless = "#result==null") Table getTable(String dbName, String tableName); @Scheduled(fixedRateString = "${cache.evict.hive.fixedRate.in.milliseconds}") @CacheEvict( cacheNames = "jdbcHive", allEntries = true, beforeInvocation = true) void evictHiveCache(); String getLocation(String tableMetadata); List<FieldSchema> getColums(String tableMetadata); String getComment(String colStr);  }