byzer-lang icon indicating copy to clipboard operation
byzer-lang copied to clipboard

support define plugin compatibility version by range

Open lwz9103 opened this issue 3 years ago • 2 comments

Currently, the mlsql plugin defines the scope of compatibility by enumerating the supported versions. But, once a new version is generated, the plugin will not adapt and occur errors like the following.

image

lwz9103 avatar Sep 14 '21 09:09 lwz9103

Dev Design

To define the scope of compatibility version, which is actually to define the minimum supported version and the last supported version.

  • The minimum supported version is easy to determine. Generally, it is the smallest one in the defined version number.

  • The maximum version needs to be clearly specified and generally means deprecated later. If the maximum version is not specified, It is considered forward compatible by default.

In order to be compatible with the current version detection rules, there are currently two ways to specify.

  1. Use the current enumeration type to specify

    e.g. val versions = Seq("2.1.0", "2.1.0-SNAPSHOT", "2.0.0", "2.0.1")

    minimal version is 2.0.0, maximum is undefined (due to no clear definition)

  2. Use version range symbols to specify

    e.g. val versions = Seq("[2.0.0,)")

    minimal version is 2.0.0, maximum is undefined (due to no clear definition)

    More version symbols are specified as follows:

    Def Range Meaning
    EqDef ==1.0 version equals 1.0
    EqDef =1.0 version equals 1.0
    GeDef 1.0 version grater than or equals 1.0
    GeDef [1.0, ) version grater than or equals 1.0
    GeDef >=1.0 version grater than or equals 1.0
    LeDef (,1.0] version less than or equals 1.0
    LeDef <=1.0 version less than or equals 1.0
    LtDef (,1.0) version less than 1.0
    LtDef <1.0 version less than 1.0
    GtDef (1.0,) version grater than 1.0
    GtDef >1.0 version grater than 1.0
    GtLtDef (1.0, 2.0) 1.0 < version < 2.0
    GtLtDef >1.0, <2.0 1.0 < version < 2.0
    GeLeDef [1.0, 2.0] 1.0 <= version <= 2.0
    GeLeDef >=1.0, <=2.0 1.0 <= version <= 2.0
    GtLeDef (1.0, 2.0] 1.0 < version <= 2.0
    GtLeDef >1.0, <=2.0 1.0 < version <= 2.0
    GeLtDef [1.0, 2.0) 1.0 <= version < 2.0
    GeLtDef >=1.0, <2.0 1.0 <= version < 2.0

In addition, if you want to check the matching spark version, you can write like this:

val versions = Seq("[2.1.0,)/[2.4.3,3.0)")

this means that the version range of mlsql is >= 2.1.0, and the version of spark is >=2.4.3 and < 3.0

Corner Case

  1. If the range of the supported version is discontinuous, which may be caused by bugs. We can use multiple rules to specify this range, like the following example:

    val versions = Seq("==2.0.9", "[2.1.3, )") this means the supported version is 2.0.9 or >=2.1.3

  2. If the supported version contains a tag, like SNAPSHOT, dev, Beta, etc. We think their comparison rules are as follows:

    • If the digital versions are different, compare the digital versions directly e.g. 2.12.0 > 2.4.5, 2.4.3 > 2.4.1-SNAPSHOT

    • If the digital version is the same, the version with the tag will be lower than the version without the tag. If both have tags, they are considered the same version e.g. 2.4.1 > 2.4.1-SNAPSHOT, 2.4.1-SNAPSHOT == 2.4.1-Beta

lwz9103 avatar Sep 14 '21 10:09 lwz9103

Test Evidecen

  1. Unit Test

    please see tech.mlsql.runtime.VersionRangeCheckerTestSuite

    image

  2. Integration Test

    image

lwz9103 avatar Sep 14 '21 13:09 lwz9103