@Description("Return the children for a Bing tile")
    @ScalarFunction("bing_tile_children")
    @SqlType("array(" + BingTileType.NAME + ")")
    public static Block bingTileChildren(@SqlType(BingTileType.NAME) long input)
    {
        BingTile tile = BingTile.decode(input);
        try {
            List<BingTile> children = tile.findChildren();
            BlockBuilder blockBuilder = BIGINT.createBlockBuilder(null, children.size());
            children.stream().forEach(child -> BIGINT.writeLong(blockBuilder, child.encode()));
            return blockBuilder.build();
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getMessage(), e);
        }
    }
@Test
    public void testBingTileChildren()
    {
        assertBingTileChildren("0", OptionalInt.empty(), ImmutableList.of("00", "01", "02", "03"));
        assertBingTileChildren("0", OptionalInt.of(3), ImmutableList.of(
                "000", "001", "002", "003",
                "010", "011", "012", "013",
                "020", "021", "022", "023",
                "030", "031", "032", "033"));
        assertInvalidFunction("bing_tile_children(bing_tile('0'), 0)", "newZoom must be greater than or equal to current zoom 1: 0");
        assertInvalidFunction(format("bing_tile_children(bing_tile('0'), %s)", MAX_ZOOM_LEVEL + 1), format("newZoom must be less than or equal to %s: %s", MAX_ZOOM_LEVEL, MAX_ZOOM_LEVEL + 1));
    }