Java Code Examples for org.apache.kylin.cube.CubeManager#updateCubeStatus()

The following examples show how to use org.apache.kylin.cube.CubeManager#updateCubeStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryInfoCollectorTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private void enableCube(String... cubes) throws IOException {
    CubeManager cubeManager = CubeManager.getInstance(KylinConfig.getInstanceFromEnv());

    for (String cube : cubes) {
        CubeInstance cubeInstance = cubeManager.getCube(cube);
        cubeManager.updateCubeStatus(cubeInstance, RealizationStatusEnum.READY);
    }
}
 
Example 2
Source File: QueryInfoCollectorTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
private void enableCube(String... cubes) throws IOException {
    CubeManager cubeManager = CubeManager.getInstance(KylinConfig.getInstanceFromEnv());

    for (String cube : cubes) {
        CubeInstance cubeInstance = cubeManager.getCube(cube);
        cubeManager.updateCubeStatus(cubeInstance, RealizationStatusEnum.READY);
    }
}
 
Example 3
Source File: SignatureCalculatorTest.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Test
public void testRealizationSetCalculator() throws IOException {
    KylinConfig config = KylinConfig.createKylinConfig(getTestConfig());
    Map<String, String> overrides = Maps.newHashMap();
    overrides.put("kylin.query.signature-class", "org.apache.kylin.rest.signature.RealizationSetCalculator");

    ProjectInstance projectInstance = ProjectManager.getInstance(config).getProject(projectName);
    projectInstance.setConfig(KylinConfigExt.createInstance(config, overrides));

    HybridManager hybridManager = HybridManager.getInstance(config);
    HybridInstance hybrid1 = hybridManager.getHybridInstance("test_kylin_hybrid_ready");

    CubeManager cubeManager = CubeManager.getInstance(config);
    CubeInstance cube1 = cubeManager.getCube("test_kylin_cube_with_slr_ready_2_segments");
    CubeInstance cube2 = cubeManager.getCube("test_kylin_cube_without_slr_ready");
    CubeInstance cube2Clone = cloneCubeInstance(cubeManager, cube2, cube2.getName() + "_clone");

    //Related cubes:
    // - test_kylin_cube_with_slr_ready
    // - test_kylin_cube_with_slr_ready_2_segments
    // - test_kylin_cube_without_slr_ready
    String cubes = hybrid1.getCanonicalName() + "," + cube2Clone.getCanonicalName();

    SQLResponse sqlResponse = new SQLResponse();
    sqlResponse.setCube(cubes);

    String signature = SQLResponseSignatureUtil.createSignature(config, sqlResponse, projectName);
    sqlResponse.setSignature(signature);

    Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

    {//Test the influence of related cubes status change
        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of segment changes
        cube2Clone = cubeManager.updateCubeDropSegments(cube2Clone, cube2Clone.getSegments().get(0));
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }
}
 
Example 4
Source File: SignatureCalculatorTest.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Test
public void testFactTableRealizationSetCalculator() throws IOException {
    KylinConfig config = KylinConfig.createKylinConfig(getTestConfig());
    Map<String, String> overrides = Maps.newHashMap();
    overrides.put("kylin.query.signature-class",
            "org.apache.kylin.rest.signature.FactTableRealizationSetCalculator");

    ProjectInstance projectInstance = ProjectManager.getInstance(config).getProject(projectName);
    projectInstance.setConfig(KylinConfigExt.createInstance(config, overrides));

    HybridManager hybridManager = HybridManager.getInstance(config);
    HybridInstance hybrid1 = hybridManager.getHybridInstance("test_kylin_hybrid_ready");

    CubeManager cubeManager = CubeManager.getInstance(config);
    CubeInstance cube1 = cubeManager.getCube("test_kylin_cube_with_slr_ready_2_segments");
    CubeInstance cube2 = cubeManager.getCube("test_kylin_cube_without_slr_ready");
    CubeInstance cube2Clone = cloneCubeInstance(cubeManager, cube2, cube2.getName() + "_clone");
    CubeInstance cube3 = cloneCubeInstance(cubeManager, cube2, cube2.getDescName());

    //Related cubes:
    // - test_kylin_cube_with_slr_ready
    // - test_kylin_cube_with_slr_ready_2_segments
    // - test_kylin_cube_without_slr_ready
    String cubes = hybrid1.getCanonicalName() + "," + cube2Clone.getCanonicalName();

    SQLResponse sqlResponse = new SQLResponse();
    sqlResponse.setCube(cubes);

    String signature = SQLResponseSignatureUtil.createSignature(config, sqlResponse, projectName);
    sqlResponse.setSignature(signature);

    Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

    {//Test the influence of related cubes status change
        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of cubes not in ${cubes} while share the same fact tables
        cube3 = cubeManager.updateCubeStatus(cube3, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube3 = cubeManager.updateCubeStatus(cube3, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of segment changes
        cube2Clone = cubeManager.updateCubeDropSegments(cube2Clone, cube2Clone.getSegments().get(0));
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }
}
 
Example 5
Source File: SignatureCalculatorTest.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Test
public void testRealizationSetCalculator() throws IOException {
    KylinConfig config = KylinConfig.createKylinConfig(getTestConfig());
    Map<String, String> overrides = Maps.newHashMap();
    overrides.put("kylin.query.signature-class", "org.apache.kylin.rest.signature.RealizationSetCalculator");

    ProjectInstance projectInstance = ProjectManager.getInstance(config).getProject(projectName);
    projectInstance.setConfig(KylinConfigExt.createInstance(config, overrides));

    HybridManager hybridManager = HybridManager.getInstance(config);
    HybridInstance hybrid1 = hybridManager.getHybridInstance("test_kylin_hybrid_ready");

    CubeManager cubeManager = CubeManager.getInstance(config);
    CubeInstance cube1 = cubeManager.getCube("test_kylin_cube_with_slr_ready_2_segments");
    CubeInstance cube2 = cubeManager.getCube("test_kylin_cube_without_slr_ready");
    CubeInstance cube2Clone = cloneCubeInstance(cubeManager, cube2, cube2.getName() + "_clone");

    //Related cubes:
    // - test_kylin_cube_with_slr_ready
    // - test_kylin_cube_with_slr_ready_2_segments
    // - test_kylin_cube_without_slr_ready
    String cubes = hybrid1.getCanonicalName() + "," + cube2Clone.getCanonicalName();

    SQLResponse sqlResponse = new SQLResponse();
    sqlResponse.setCube(cubes);

    String signature = SQLResponseSignatureUtil.createSignature(config, sqlResponse, projectName);
    sqlResponse.setSignature(signature);

    Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

    {//Test the influence of related cubes status change
        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of segment changes
        cube2Clone = cubeManager.updateCubeDropSegments(cube2Clone, cube2Clone.getSegments().get(0));
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }
}
 
Example 6
Source File: SignatureCalculatorTest.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Test
public void testFactTableRealizationSetCalculator() throws IOException {
    KylinConfig config = KylinConfig.createKylinConfig(getTestConfig());
    Map<String, String> overrides = Maps.newHashMap();
    overrides.put("kylin.query.signature-class",
            "org.apache.kylin.rest.signature.FactTableRealizationSetCalculator");

    ProjectInstance projectInstance = ProjectManager.getInstance(config).getProject(projectName);
    projectInstance.setConfig(KylinConfigExt.createInstance(config, overrides));

    HybridManager hybridManager = HybridManager.getInstance(config);
    HybridInstance hybrid1 = hybridManager.getHybridInstance("test_kylin_hybrid_ready");

    CubeManager cubeManager = CubeManager.getInstance(config);
    CubeInstance cube1 = cubeManager.getCube("test_kylin_cube_with_slr_ready_2_segments");
    CubeInstance cube2 = cubeManager.getCube("test_kylin_cube_without_slr_ready");
    CubeInstance cube2Clone = cloneCubeInstance(cubeManager, cube2, cube2.getName() + "_clone");
    CubeInstance cube3 = cloneCubeInstance(cubeManager, cube2, cube2.getDescName());

    //Related cubes:
    // - test_kylin_cube_with_slr_ready
    // - test_kylin_cube_with_slr_ready_2_segments
    // - test_kylin_cube_without_slr_ready
    String cubes = hybrid1.getCanonicalName() + "," + cube2Clone.getCanonicalName();

    SQLResponse sqlResponse = new SQLResponse();
    sqlResponse.setCube(cubes);

    String signature = SQLResponseSignatureUtil.createSignature(config, sqlResponse, projectName);
    sqlResponse.setSignature(signature);

    Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

    {//Test the influence of related cubes status change
        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube1 = cubeManager.updateCubeStatus(cube1, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of cubes not in ${cubes} while share the same fact tables
        cube3 = cubeManager.updateCubeStatus(cube3, RealizationStatusEnum.DISABLED);
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));

        cube3 = cubeManager.updateCubeStatus(cube3, RealizationStatusEnum.READY);
        Assert.assertTrue(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }

    {//Test the influence of segment changes
        cube2Clone = cubeManager.updateCubeDropSegments(cube2Clone, cube2Clone.getSegments().get(0));
        Assert.assertFalse(SQLResponseSignatureUtil.checkSignature(config, sqlResponse, projectName));
    }
}