-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new edge kind -
ParentIterative
(#617)
- Loading branch information
1 parent
b688980
commit aa255dc
Showing
13 changed files
with
305 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test-resources/java/parent_iterative/negative/configurations/edges.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2023 Uber Technologies, Inc. | ||
# | ||
# <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
# except in compliance with the License. You may obtain a copy of the License at | ||
# <p>http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# <p>Unless required by applicable law or agreed to in writing, software distributed under the | ||
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
[[edges]] | ||
scope = "Parent" | ||
from = "spark_conf_change_java_scala" | ||
to = ["BuilderPattern"] | ||
|
||
[[edges]] | ||
scope = "Parent" | ||
from = "BuilderPattern" | ||
to = ["BuilderPattern"] |
48 changes: 48 additions & 0 deletions
48
test-resources/java/parent_iterative/negative/configurations/rules.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) 2023 Uber Technologies, Inc. | ||
# | ||
# <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
# except in compliance with the License. You may obtain a copy of the License at | ||
# <p>http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# <p>Unless required by applicable law or agreed to in writing, software distributed under the | ||
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
[[rules]] | ||
name = "spark_conf_change_java_scala" | ||
query = "cs new SparkConf()" | ||
replace_node = "*" | ||
replace = 'new SparkSession.builder()' | ||
|
||
[[rules]] | ||
name = "set_spark_home_change_java_scala" | ||
query = "cs :[r].setSparkHome(:[a1])" | ||
replace_node = "*" | ||
replace = "@r.sparkHome(@a1)" | ||
is_seed_rule = false | ||
groups = ["BuilderPattern"] | ||
|
||
[[rules]] | ||
name = "set_executor_env_change_2_java_scala" | ||
query = "cs :[r].setExecutorEnv(:[a1], :[a2])" | ||
replace_node = "*" | ||
replace = "@r.executorEnv(@a1, @a2)" | ||
is_seed_rule = false | ||
groups = ["BuilderPattern"] | ||
|
||
[[rules]] | ||
name = "app_name_change_java_scala" | ||
query = "cs :[r].setAppName(:[app_name])" | ||
replace_node = "*" | ||
replace = "@r.appName(@app_name)" | ||
is_seed_rule = false | ||
groups = ["BuilderPattern"] | ||
|
||
[[rules]] | ||
name = "master_name_change_java_scala" | ||
query = "cs :[r].setMaster(:[master])" | ||
replace_node = "*" | ||
replace = "@r.master(@master)" | ||
is_seed_rule = false | ||
groups = ["BuilderPattern"] |
28 changes: 28 additions & 0 deletions
28
test-resources/java/parent_iterative/negative/expected/sample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.piranha; | ||
|
||
import org.apache.spark.SparkConf; | ||
import org.apache.spark.sql.SparkSession; | ||
|
||
class Sample { | ||
void main() { | ||
// `setApp` and `setMaster` will not get updated | ||
val conf1 = new SparkSession.builder() | ||
.setMaster(master1) | ||
.setAppName(appName1) | ||
.executorEnv("spark.executor.extraClassPath1", "test1"); | ||
|
||
// `setApp` and `setMaster` will not get updated | ||
val conf2 = new SparkSession.builder() | ||
.setAppName(appName2) | ||
.setMaster(master2) | ||
.sparkHome(sparkHome2) | ||
.executorEnv("spark.executor.extraClassPath2", "test2"); | ||
|
||
// `setMaster` and `setExecutorEnv` will not get updated | ||
val conf3 = new SparkSession.builder() | ||
.setExecutorEnv("spark.executor.extraClassPath3", "test3") | ||
.setMaster(master3) | ||
.sparkHome(sparkHome3) | ||
.appName(appName3); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
test-resources/java/parent_iterative/negative/input/sample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.piranha; | ||
|
||
import org.apache.spark.SparkConf; | ||
import org.apache.spark.sql.SparkSession; | ||
|
||
class Sample { | ||
void main() { | ||
|
||
// `setApp` and `setMaster` will not get updated | ||
val conf1 = new SparkConf() | ||
.setMaster(master1) | ||
.setAppName(appName1) | ||
.setExecutorEnv("spark.executor.extraClassPath1", "test1"); | ||
|
||
// `setApp` and `setMaster` will not get updated | ||
val conf2 = new SparkConf() | ||
.setAppName(appName2) | ||
.setMaster(master2) | ||
.setSparkHome(sparkHome2) | ||
.setExecutorEnv("spark.executor.extraClassPath2", "test2"); | ||
|
||
// `setMaster` and `setExecutorEnv` will not get updated | ||
val conf3 = new SparkConf() | ||
.setExecutorEnv("spark.executor.extraClassPath3", "test3") | ||
.setMaster(master3) | ||
.setSparkHome(sparkHome3) | ||
.setAppName(appName3); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test-resources/java/parent_iterative/positive/configurations/edges.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2023 Uber Technologies, Inc. | ||
# | ||
# <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
# except in compliance with the License. You may obtain a copy of the License at | ||
# <p>http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# <p>Unless required by applicable law or agreed to in writing, software distributed under the | ||
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
[[edges]] | ||
scope = "ParentIterative" | ||
from = "spark_conf_change_java_scala" | ||
to = ["BuilderPattern"] | ||
|
||
[[edges]] | ||
scope = "ParentIterative" | ||
from = "BuilderPattern" | ||
to = ["BuilderPattern"] |
Oops, something went wrong.