@@ -1609,6 +1609,68 @@ async def test_updating_cube(
16091609 ]
16101610
16111611
1612+ @pytest .mark .asyncio
1613+ async def test_updating_cube_with_existing_cube_materialization (
1614+ client_with_repairs_cube : AsyncClient ,
1615+ module__query_service_client : QueryServiceClient ,
1616+ ):
1617+ """
1618+ Verify updating a cube with an existing new-style cube materialization
1619+ """
1620+ cube_name = "default.repairs_cube__default_incremental_11"
1621+ await make_a_test_cube (
1622+ client_with_repairs_cube ,
1623+ cube_name ,
1624+ )
1625+ response = await client_with_repairs_cube .post (
1626+ f"/nodes/{ cube_name } /columns/default.hard_hat.hire_date/partition" ,
1627+ json = {
1628+ "type_" : "temporal" ,
1629+ "granularity" : "day" ,
1630+ "format" : "yyyyMMdd" ,
1631+ },
1632+ )
1633+ assert response .status_code in (200 , 201 )
1634+ response = await client_with_repairs_cube .post (
1635+ f"/nodes/{ cube_name } /materialization/" ,
1636+ json = {
1637+ "job" : "druid_cube" ,
1638+ "strategy" : "incremental_time" ,
1639+ "schedule" : "@daily" ,
1640+ "lookback_window" : "1 DAY" ,
1641+ },
1642+ )
1643+ # Update the cube, but keep the temporal partition column. This should succeed
1644+ response = await client_with_repairs_cube .patch (
1645+ f"/nodes/{ cube_name } " ,
1646+ json = {
1647+ "metrics" : ["default.discounted_orders_rate" ],
1648+ "dimensions" : ["default.hard_hat.city" , "default.hard_hat.hire_date" ],
1649+ },
1650+ )
1651+ result = response .json ()
1652+ assert result ["version" ] == "v2.0"
1653+
1654+ # Check that the configured materialization was updated
1655+ response = await client_with_repairs_cube .get (f"/cubes/{ cube_name } /" )
1656+ data = response .json ()
1657+ assert [
1658+ col ["semantic_entity" ]
1659+ for col in data ["materializations" ][0 ]["config" ]["columns" ]
1660+ ] == [
1661+ "default.hard_hat.city" ,
1662+ "default.hard_hat.hire_date" ,
1663+ "default.discounted_orders_rate.default_DOT_discounted_orders_rate" ,
1664+ ]
1665+ assert data ["materializations" ][0 ]["job" ] == "DruidMetricsCubeMaterializationJob"
1666+ assert (
1667+ data ["materializations" ][0 ]["name" ]
1668+ == "druid_metrics_cube__incremental_time__default.hard_hat.hire_date"
1669+ )
1670+ assert data ["materializations" ][0 ]["strategy" ] == "incremental_time"
1671+ assert data ["materializations" ][0 ]["schedule" ] == "@daily"
1672+
1673+
16121674@pytest .mark .asyncio
16131675async def test_updating_cube_with_existing_materialization (
16141676 client_with_repairs_cube : AsyncClient ,
0 commit comments