InteractiveCommand extends AbstractCommand { static boolean isDropPartitionCmd(String cmd) { boolean r = false; if (cmd != null) { Matcher m = IS_DROP_PARTITION.matcher(cmd); r = m.matches(); } return r; } InteractiveCommand(String commandText, ExecutionContext context); @SuppressWarnings("restriction") void run(); static InteractiveCommand parse(List<String> paraList, ExecutionContext sessionContext); static boolean quit; static boolean isInteractiveMode; }
@Test public void testIsDropPartitionCmd() { Assert.assertTrue(InteractiveCommand .isDropPartitionCmd("alter table xxx drop partition(pt='1', ds='2')")); Assert .assertTrue(InteractiveCommand .isDropPartitionCmd("\t\nalter \t\rtable proj.xxx \ndrop if exists partition(pt='1', ds='2')")); Assert.assertFalse(InteractiveCommand .isDropPartitionCmd("alter table xxx add partition(pt='1', ds='2')")); Assert.assertTrue(InteractiveCommand .isDropPartitionCmd("alter table xxx drop partition(pt='1', ds='2')")); }