private PlanMode planMode(ConnectContext connectContext) {
        if (connectContext == null) {
            return PlanMode.LOCAL;
        }

        if (connectContext.getSessionVariable() == null) {
            return PlanMode.LOCAL;
        }

        return PlanMode.fromName(connectContext.getSessionVariable().getPlanMode());
    }
@Test(expected = IllegalArgumentException.class)
    public void testPlanMode() {
        Assert.assertEquals(PlanMode.AUTO.modeName(), PlanMode.fromName("AUTO").modeName());
        Assert.assertEquals(PlanMode.AUTO.modeName(), PlanMode.fromName("auto").modeName());
        Assert.assertEquals(PlanMode.LOCAL.modeName(), PlanMode.fromName("local").modeName());
        Assert.assertEquals(PlanMode.LOCAL.modeName(), PlanMode.fromName("LOCAL").modeName());
        Assert.assertEquals(PlanMode.DISTRIBUTED.modeName(), PlanMode.fromName("distributed").modeName());
        Assert.assertEquals(PlanMode.DISTRIBUTED.modeName(), PlanMode.fromName("DISTRIBUTED").modeName());

        PlanMode.fromName("unknown");
    }