This is an automated email from the ASF dual-hosted git repository.
liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 80a2513 SUBMARINE-424. Enable scala style check in github actions
80a2513 is described below
commit 80a25132da88a88b0e322ebcbac93d0830bdc7be
Author: Kent Yao <[email protected]>
AuthorDate: Wed Mar 11 22:39:51 2020 +0800
SUBMARINE-424. Enable scala style check in github actions
### What is this PR for?
add some scala style check rule from
http://www.scalastyle.org/rules-1.0.0.html
enable it in the GitHub workflow
### What type of PR is it?
feature
### Todos
### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/SUBMARINE-424
### How should this be tested?
pass github actions
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Kent Yao <[email protected]>
Closes #222 from yaooqinn/SUBMARINE-424 and squashes the following commits:
1693ae6 [Kent Yao] SUBMARINE-424. Enable scala style check in github actions
---
.github/workflows/master.yml | 2 +
dev-support/lint-scala.sh | 28 ++
dev-support/maven-config/scalastyle-config.xml | 287 +++++++++++++++++++++
pom.xml | 30 ++-
.../optimizer/SubmarineDataMaskingExtension.scala | 24 +-
.../optimizer/SubmarineRowFilterExtension.scala | 27 +-
.../optimizer/SubmarineSparkOptimizer.scala | 24 +-
...ubmarineSparkRangerAuthorizationExtension.scala | 4 +-
.../plans/logical/SubmarineDataMasking.scala | 24 +-
.../plans/logical/SubmarineRowFilter.scala | 24 +-
.../execution/SubmarineShowDatabasesCommand.scala | 24 +-
.../sql/execution/SubmarineShowTablesCommand.scala | 24 +-
.../execution/SubmarineSparkPlanOmitStrategy.scala | 24 +-
.../spark/security/RangerSparkAccessRequest.scala | 5 +-
.../spark/security/RangerSparkAuthorizer.scala | 8 +-
.../spark/security/RangerSparkSQLExtension.scala | 26 +-
.../org/apache/spark/sql/SubmarineSparkUtils.scala | 24 +-
.../SubmarineDataMaskingExtensionTest.scala | 24 +-
.../SubmarineRowFilterExtensionTest.scala | 24 +-
.../optimizer/SubmarineSparkOptimizerTest.scala | 24 +-
...rineSparkRangerAuthorizationExtensionTest.scala | 24 +-
.../spark/security/AuthorizationTest.scala | 58 +++--
.../spark/security/DataMaskingSQLTest.scala | 24 +-
.../spark/security/RangerAdminClientImpl.scala | 26 +-
.../spark/security/RowFilterSQLTest.scala | 24 +-
.../submarine/spark/security/TPCDSTest.scala | 24 +-
26 files changed, 627 insertions(+), 234 deletions(-)
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 677445e..36cc0fb 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -93,3 +93,5 @@ jobs:
run: |
export MAVEN_OPTS="-Xmx2g -XX:ReservedCodeCacheSize=512m
-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN"
mvn --no-transfer-progress -DskipTests install checkstyle:check
+ - name: Scala Style
+ run: ./dev-support/lint-scala.sh
diff --git a/dev-support/lint-scala.sh b/dev-support/lint-scala.sh
new file mode 100755
index 0000000..d50136b
--- /dev/null
+++ b/dev-support/lint-scala.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+ERRORS=$(mvn scalastyle:check | grep ERROR)
+
+if test ! -z "$ERRORS"; then
+ echo -e "Checkstyle checks failed at following occurrences:\n$ERRORS"
+ find . -name scalastyle-output.xml | xargs cat | grep -v checkstyle | grep
-v "<?xml"
+ exit 1
+else
+ echo -e "Checkstyle checks passed."
+fi
diff --git a/dev-support/maven-config/scalastyle-config.xml
b/dev-support/maven-config/scalastyle-config.xml
new file mode 100644
index 0000000..3eda046
--- /dev/null
+++ b/dev-support/maven-config/scalastyle-config.xml
@@ -0,0 +1,287 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ 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.
+-->
+
+<scalastyle>
+ <name>Scalastyle standard configuration</name>
+
+ <!--
================================================================================
-->
+ <!-- rules we enforce
-->
+ <!--
================================================================================
-->
+
+ <check level="error" class="org.scalastyle.file.FileTabChecker"
enabled="true"/>
+
+ <check level="error" class="org.scalastyle.file.HeaderMatchesChecker"
enabled="true">
+ <parameters>
+ <parameter name="header"><![CDATA[/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */]]></parameter>
+ </parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"/>
+
+ <check level="error" class="org.scalastyle.file.FileLineLengthChecker"
enabled="true">
+ <parameters>
+ <parameter name="maxLineLength"><![CDATA[100]]></parameter>
+ <parameter name="tabSize"><![CDATA[2]]></parameter>
+ <parameter name="ignoreImports">true</parameter>
+ </parameters>
+ </check>
+
+ <check level="error" class="org.scalastyle.scalariform.ClassNamesChecker"
enabled="true">
+ <parameters><parameter
name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter></parameters>
+ </check>
+
+ <check level="error" class="org.scalastyle.scalariform.ObjectNamesChecker"
enabled="true">
+ <parameters><parameter
name="regex"><![CDATA[(config|[A-Z][A-Za-z]*)]]></parameter></parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
+ <parameters><parameter
name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter></parameters>
+ </check>
+
+ <check customId="argcount" level="error"
class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true">
+ <parameters><parameter
name="maxParameters"><![CDATA[10]]></parameter></parameters>
+ </check>
+
+ <check level="error" class="org.scalastyle.scalariform.NoFinalizeChecker"
enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"/>
+
+ <check level="error" class="org.scalastyle.scalariform.UppercaseLChecker"
enabled="true"/>
+
+ <check level="error" class="org.scalastyle.scalariform.IfBraceChecker"
enabled="true">
+ <parameters>
+ <parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
+ <parameter name="doubleLineAllowed"><![CDATA[true]]></parameter>
+ </parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true"/>
+
+ <check level="error" class="org.scalastyle.file.NewLineAtEofChecker"
enabled="true"/>
+
+ <check customId="nonascii" level="error"
class="org.scalastyle.scalariform.NonASCIICharacterChecker"
+ enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker"
enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker"
enabled="true">
+ <parameters>
+ <parameter name="tokens">ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY,
LARROW, RARROW</parameter>
+ </parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker"
enabled="true">
+ <parameters>
+ <parameter name="tokens">ARROW, EQUALS, COMMA, COLON, IF, ELSE,
DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW</parameter>
+ </parameters>
+ </check>
+
+ <!-- ??? usually shouldn't be checked into the code base. -->
+ <check level="error"
class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"/>
+
+ <check customId="runtimeaddshutdownhook" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter
name="regex">Runtime\.getRuntime\.addShutdownHook</parameter></parameters>
+ <customMessage><![CDATA[
+ Are you sure that you want to use Runtime.getRuntime.addShutdownHook? In
most cases, you should use
+ ShutdownHookManager.addShutdownHook instead.
+ If you must use Runtime.getRuntime.addShutdownHook, wrap the code block
with
+ // scalastyle:off runtimeaddshutdownhook
+ Runtime.getRuntime.addShutdownHook(...)
+ // scalastyle:on runtimeaddshutdownhook
+ ]]></customMessage>
+ </check>
+
+ <check customId="mutablesynchronizedbuffer" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter
name="regex">mutable\.SynchronizedBuffer</parameter></parameters>
+ <customMessage><![CDATA[
+ Are you sure that you want to use mutable.SynchronizedBuffer? In most
cases, you should use
+ java.util.concurrent.ConcurrentLinkedQueue instead.
+ If you must use mutable.SynchronizedBuffer, wrap the code block with
+ // scalastyle:off mutablesynchronizedbuffer
+ mutable.SynchronizedBuffer[...]
+ // scalastyle:on mutablesynchronizedbuffer
+ ]]></customMessage>
+ </check>
+
+ <check customId="caselocale" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter
name="regex">(\.toUpperCase|\.toLowerCase)(?!(\(|\(Locale.ROOT\)))</parameter></parameters>
+ <customMessage><![CDATA[
+ Are you sure that you want to use toUpperCase or toLowerCase without the
root locale? In most cases, you
+ should use toUpperCase(Locale.ROOT) or toLowerCase(Locale.ROOT) instead.
+ If you must use toUpperCase or toLowerCase without the root locale, wrap
the code block with
+ // scalastyle:off caselocale
+ .toUpperCase
+ .toLowerCase
+ // scalastyle:on caselocale
+ ]]></customMessage>
+ </check>
+
+ <check customId="throwerror" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter name="regex">throw new
\w+Error\(</parameter></parameters>
+ <customMessage><![CDATA[
+ Are you sure that you want to throw Error? In most cases, you should use
appropriate Exception instead.
+ If you must throw Error, wrap the code block with
+ // scalastyle:off throwerror
+ throw new XXXError(...)
+ // scalastyle:on throwerror
+ ]]></customMessage>
+ </check>
+
+ <check customId="javaconversions" level="error"
class="org.scalastyle.scalariform.TokenChecker" enabled="true">
+ <parameters><parameter
name="regex">JavaConversions</parameter></parameters>
+ <customMessage>Instead of importing implicits in
scala.collection.JavaConversions._, import
+ scala.collection.JavaConverters._ and use .asScala / .asJava
methods</customMessage>
+ </check>
+
+ <check customId="commonslang2" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter
name="regex">org\.apache\.commons\.lang\.</parameter></parameters>
+ <customMessage>Use Commons Lang 3 classes (package
org.apache.commons.lang3.*) instead
+ of Commons Lang 2 (package
org.apache.commons.lang.*)</customMessage>
+ </check>
+
+ <check customId="extractopt" level="error"
class="org.scalastyle.scalariform.TokenChecker" enabled="true">
+ <parameters><parameter name="regex">extractOpt</parameter></parameters>
+ <customMessage>Use jsonOption(x).map(.extract[T]) instead of
.extractOpt[T], as the latter
+ is slower. </customMessage>
+ </check>
+
+ <check level="error" class="org.scalastyle.scalariform.ImportOrderChecker"
enabled="true">
+ <parameters>
+ <parameter name="groups">java,scala,3rdParty,submarine</parameter>
+ <parameter name="group.java">javax?\..*</parameter>
+ <parameter name="group.scala">scala\..*</parameter>
+ <parameter
name="group.3rdParty">(?!org\.apache\.submarine\.).*</parameter>
+ <parameter
name="group.spark">org\.apache\.submarine\..*</parameter>
+ </parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker"
enabled="true">
+ <parameters>
+ <parameter name="tokens">COMMA</parameter>
+ </parameters>
+ </check>
+
+ <check customId="SingleSpaceBetweenRParenAndLCurlyBrace" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter name="regex">\)\{</parameter></parameters>
+ <customMessage><![CDATA[
+ Single Space between ')' and `{`.
+ ]]></customMessage>
+ </check>
+
+ <check customId="NoScalaDoc" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter name="regex">(?m)^(\s*)/[*][*].*$(\r|)\n^\1
[*]</parameter></parameters>
+ <customMessage>Use Javadoc style indentation for multiline
comments</customMessage>
+ </check>
+
+ <check customId="OmitBracesInCase" level="error"
class="org.scalastyle.file.RegexChecker" enabled="true">
+ <parameters><parameter
name="regex">case[^\n>]*=>\s*\{</parameter></parameters>
+ <customMessage>Omit braces in case clauses.</customMessage>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.OverrideJavaChecker" enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.DeprecatedJavaChecker" enabled="true"/>
+
+ <check level="error"
class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker"
enabled="true"/>
+ <check level="error"
class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker"
enabled="true"/>
+
+ <check level="error" class="org.scalastyle.scalariform.MethodNamesChecker"
enabled="true">
+ <parameters>
+ <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>
+ </parameters>
+ </check>
+
+ <check level="error"
class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true"/>
+
+ <!--
================================================================================
-->
+ <!-- rules we don't want
-->
+ <!--
================================================================================
-->
+
+ <check level="error"
class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="false">
+ <parameters><parameter
name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter></parameters>
+ </check>
+
+ <!-- We want the opposite of this: NewLineAtEofChecker -->
+ <check level="error" class="org.scalastyle.file.NoNewLineAtEofChecker"
enabled="false"/>
+
+ <!-- This one complains about all kinds of random things. Disable. -->
+ <check level="error"
class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker"
enabled="false"/>
+
+ <!-- We use return quite a bit for control flows and guards -->
+ <check level="error" class="org.scalastyle.scalariform.ReturnChecker"
enabled="false"/>
+
+ <!-- We use null a lot in low level code and to interface with 3rd party
code -->
+ <check level="error" class="org.scalastyle.scalariform.NullChecker"
enabled="false"/>
+
+ <!-- Doesn't seem super big deal here ... -->
+ <check level="error" class="org.scalastyle.scalariform.NoCloneChecker"
enabled="false"/>
+
+ <!-- Doesn't seem super big deal here ... -->
+ <check level="error" class="org.scalastyle.file.FileLengthChecker"
enabled="false">
+ <parameters><parameter
name="maxFileLength">800></parameter></parameters>
+ </check>
+
+ <!-- Doesn't seem super big deal here ... -->
+ <check level="error"
class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="false">
+ <parameters><parameter name="maxTypes">30</parameter></parameters>
+ </check>
+
+ <!-- Doesn't seem super big deal here ... -->
+ <check level="error"
class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="false">
+ <parameters><parameter name="maximum">10</parameter></parameters>
+ </check>
+
+ <!-- Doesn't seem super big deal here ... -->
+ <check level="error"
class="org.scalastyle.scalariform.MethodLengthChecker" enabled="false">
+ <parameters><parameter name="maxLength">50</parameter></parameters>
+ </check>
+
+ <!-- Not exactly feasible to enforce this right now. -->
+ <!-- It is also infrequent that somebody introduces a new class with a lot
of methods. -->
+ <check level="error"
class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="false">
+ <parameters><parameter
name="maxMethods"><![CDATA[30]]></parameter></parameters>
+ </check>
+
+ <!-- Doesn't seem super big deal here, and we have a lot of magic numbers
... -->
+ <check level="error" class="org.scalastyle.scalariform.MagicNumberChecker"
enabled="false">
+ <parameters><parameter
name="ignore">-1,0,1,2,3</parameter></parameters>
+ </check>
+
+</scalastyle>
diff --git a/pom.xml b/pom.xml
index 74fcf59..de427a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -469,10 +469,10 @@
<skip>true</skip>
<failOnViolation>false</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
-
<sourceDirectories>${basedir}/src/main/java,${basedir}/src/main/scala</sourceDirectories>
- <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
+
<sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
+
<testSourceDirectory>${project.build.testSourceDirectory}</testSourceDirectory>
<configLocation>dev-support/maven-config/checkstyle.xml</configLocation>
- <outputFile>${basedir}/target/checkstyle-output.xml</outputFile>
+
<outputFile>${project.build.directory}/checkstyle-output.xml</outputFile>
<inputEncoding>${project.build.sourceEncoding}</inputEncoding>
<outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
</configuration>
@@ -498,6 +498,30 @@
</plugin>
<plugin>
+ <groupId>org.scalastyle</groupId>
+ <artifactId>scalastyle-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <verbose>false</verbose>
+ <failOnViolation>true</failOnViolation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <failOnWarning>false</failOnWarning>
+ <sourceDirectory>${project.basedir}/src/test/scala</sourceDirectory>
+
<testSourceDirectory>${project.basedir}/src/main/scala</testSourceDirectory>
+
<configLocation>dev-support/maven-config/scalastyle-config.xml</configLocation>
+
<outputFile>${project.build.directory}/scalastyle-output.xml</outputFile>
+ <outputEncoding>UTF-8</outputEncoding>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<inherited>true</inherited>
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtension.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtension.scala
index 7e2b99c..094abc7 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtension.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtension.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtension.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtension.scala
index 14f634c..e5d3167 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtension.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtension.scala
@@ -1,23 +1,25 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.hadoop.security.UserGroupInformation
import org.apache.ranger.plugin.policyengine.RangerAccessResult
import org.apache.spark.sql.catalyst.expressions.SubqueryExpression
@@ -29,6 +31,7 @@ import org.apache.spark.sql.AuthzUtils.getFieldVal
import
org.apache.spark.sql.execution.command.{CreateDataSourceTableAsSelectCommand,
CreateViewCommand, InsertIntoDataSourceDirCommand}
import
org.apache.spark.sql.execution.datasources.{InsertIntoDataSourceCommand,
InsertIntoHadoopFsRelationCommand, LogicalRelation, SaveIntoDataSourceCommand}
import org.apache.spark.sql.hive.execution.{CreateHiveTableAsSelectCommand,
InsertIntoHiveDirCommand, InsertIntoHiveTable}
+
import org.apache.submarine.spark.security._
/**
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizer.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizer.scala
index d232db6..1f675fc 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizer.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizer.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtension.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtension.scala
index 74cdc40..b28b7f1 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtension.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtension.scala
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.spark.sql.catalyst.optimizer
import org.apache.commons.logging.LogFactory
@@ -34,7 +35,8 @@ import
org.apache.submarine.spark.security.{RangerSparkAuthorizer, SparkAccessCo
*
* For Apache Spark 2.3.x and later
*/
-case class SubmarineSparkRangerAuthorizationExtension(spark: SparkSession)
extends Rule[LogicalPlan] {
+case class SubmarineSparkRangerAuthorizationExtension(spark: SparkSession)
+ extends Rule[LogicalPlan] {
import org.apache.submarine.spark.security.SparkOperationType._
private val LOG =
LogFactory.getLog(classOf[SubmarineSparkRangerAuthorizationExtension])
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineDataMasking.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineDataMasking.scala
index 4eba657..10d1c17 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineDataMasking.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineDataMasking.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.plans.logical
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineRowFilter.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineRowFilter.scala
index f61b323..dec2752 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineRowFilter.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SubmarineRowFilter.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.plans.logical
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowDatabasesCommand.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowDatabasesCommand.scala
index fd3f7c3..aaad6b4 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowDatabasesCommand.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowDatabasesCommand.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.execution
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowTablesCommand.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowTablesCommand.scala
index d9376e7..c2da431 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowTablesCommand.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineShowTablesCommand.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.execution
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineSparkPlanOmitStrategy.scala
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineSparkPlanOmitStrategy.scala
index b768eb6..6c59b7b 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineSparkPlanOmitStrategy.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/spark/sql/execution/SubmarineSparkPlanOmitStrategy.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.execution
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAccessRequest.scala
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAccessRequest.scala
index d5f34fb..3b6bc04 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAccessRequest.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAccessRequest.scala
@@ -19,13 +19,12 @@
package org.apache.submarine.spark.security
-import java.util.Date
+import java.util.{Date, Locale}
import scala.collection.JavaConverters._
import org.apache.ranger.plugin.policyengine.{RangerAccessRequestImpl,
RangerPolicyEngine}
import org.apache.ranger.plugin.util.RangerAccessRequestUtil
-
import org.apache.submarine.spark.security.SparkAccessType.SparkAccessType
class RangerSparkAccessRequest private extends RangerAccessRequestImpl {
@@ -65,7 +64,7 @@ class RangerSparkAccessRequest private extends
RangerAccessRequestImpl {
accessType match {
case SparkAccessType.USE =>
this.setAccessType(RangerPolicyEngine.ANY_ACCESS)
case SparkAccessType.ADMIN =>
this.setAccessType(RangerPolicyEngine.ADMIN_ACCESS)
- case _ => this.setAccessType(accessType.toString.toLowerCase)
+ case _ =>
this.setAccessType(accessType.toString.toLowerCase(Locale.ROOT))
}
}
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAuthorizer.scala
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAuthorizer.scala
index 6e57a73..eba8077 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAuthorizer.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkAuthorizer.scala
@@ -19,12 +19,12 @@
package org.apache.submarine.spark.security
-import java.util.{List => JList}
+import java.util.{Locale, List => JList}
import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer
-import org.apache.commons.lang.StringUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.commons.logging.LogFactory
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.permission.FsAction
@@ -36,7 +36,6 @@ import org.apache.ranger.authorization.utils.StringUtil
import org.apache.ranger.plugin.policyengine.RangerAccessRequest
import org.apache.ranger.plugin.util.RangerPerfTracer
import org.apache.spark.sql.SparkSession
-
import org.apache.submarine.spark.security.SparkAccessType.SparkAccessType
import org.apache.submarine.spark.security.SparkObjectType.SparkObjectType
import
org.apache.submarine.spark.security.SparkOperationType.SparkOperationType
@@ -231,7 +230,8 @@ object RangerSparkAuthorizer {
case SparkPrivilegeObjectType.DATABASE | null => SparkObjectType.DATABASE
case SparkPrivilegeObjectType.TABLE_OR_VIEW if
!StringUtil.isEmpty(obj.getColumns.asJava) =>
SparkObjectType.COLUMN
- case SparkPrivilegeObjectType.TABLE_OR_VIEW if
opType.toString.toLowerCase.contains("view") =>
+ case SparkPrivilegeObjectType.TABLE_OR_VIEW
+ if opType.toString.toLowerCase(Locale.ROOT).contains("view") =>
SparkObjectType.VIEW
case SparkPrivilegeObjectType.TABLE_OR_VIEW => SparkObjectType.TABLE
case SparkPrivilegeObjectType.FUNCTION => SparkObjectType.FUNCTION
diff --git
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkSQLExtension.scala
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkSQLExtension.scala
index e90e2f3..3f29908 100644
---
a/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkSQLExtension.scala
+++
b/submarine-security/spark-security/src/main/scala/org/apache/submarine/spark/security/RangerSparkSQLExtension.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/SubmarineSparkUtils.scala
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/SubmarineSparkUtils.scala
index 8b7dbfd..f46ac69 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/SubmarineSparkUtils.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/SubmarineSparkUtils.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtensionTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtensionTest.scala
index be12a93..1887934 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtensionTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineDataMaskingExtensionTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtensionTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtensionTest.scala
index 805ec3c..907d9ee 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtensionTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineRowFilterExtensionTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizerTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizerTest.scala
index e3e09b4..91b7c61 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizerTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkOptimizerTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtensionTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtensionTest.scala
index 6c10283..a3a0785 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtensionTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SubmarineSparkRangerAuthorizationExtensionTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.spark.sql.catalyst.optimizer
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/AuthorizationTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/AuthorizationTest.scala
index 77c7b3e..f38c6d0 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/AuthorizationTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/AuthorizationTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
@@ -94,7 +96,8 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("use database") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("use default"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[USE] privilege on [default]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[USE] privilege" +
+ " on [default]")
}
withUser("bob") {
sql("use default")
@@ -107,14 +110,16 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("create database") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("create database
db1"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[CREATE] privilege on [db1]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[CREATE] privilege" +
+ " on [db1]")
}
}
test("describe database") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("desc database
default"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[USE] privilege on [default]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[USE] privilege on" +
+ " [default]")
}
withUser("bob") {
@@ -125,7 +130,8 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("drop database") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("drop database
testdb"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[DROP] privilege on [testdb]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[DROP] privilege" +
+ " on [testdb]")
}
withUser("admin") {
@@ -136,7 +142,8 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("create table") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("create table
default.alice(key int)"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[CREATE] privilege on [default/alice]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[CREATE] privilege" +
+ " on [default/alice]")
}
withUser("bob") {
@@ -146,8 +153,11 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("alter table") {
withUser("alice") {
- val e = intercept[SparkAccessControlException](sql("alter table
default.src set tblproperties('abc'='xyz')"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[ALTER] privilege on [default/src]")
+ val e = intercept[SparkAccessControlException] {
+ sql("alter table default.src set tblproperties('abc'='xyz')")
+ }
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[ALTER] privilege" +
+ " on [default/src]")
}
withUser("bob") {
@@ -158,7 +168,8 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("drop table") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("drop table
default.rangertbl1"))
- assert(e.getMessage === "Permission denied: user [alice] does not have
[DROP] privilege on [default/rangertbl1]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[DROP] privilege" +
+ " on [default/rangertbl1]")
}
withUser("bob") {
@@ -169,7 +180,8 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
test("select") {
withUser("alice") {
val e = intercept[SparkAccessControlException](sql("select * from
default.rangertbl2").head())
- assert(e.getMessage === "Permission denied: user [alice] does not have
[SELECT] privilege on [default/rangertbl2/key,value]")
+ assert(e.getMessage === "Permission denied: user [alice] does not have
[SELECT] privilege" +
+ " on [default/rangertbl2/key,value]")
}
withUser("bob") {
@@ -181,11 +193,13 @@ class AuthorizationTest extends FunSuite with
BeforeAndAfterAll {
}
withUser("kent") {
val e = intercept[SparkAccessControlException](sql("select value from
default.src").head())
- assert(e.getMessage === "Permission denied: user [kent] does not have
[SELECT] privilege on [default/src/value]")
+ assert(e.getMessage === "Permission denied: user [kent] does not have
[SELECT] privilege" +
+ " on [default/src/value]")
}
withUser("kent") {
val e = intercept[SparkAccessControlException](sql("select * from
default.src").head())
- assert(e.getMessage === "Permission denied: user [kent] does not have
[SELECT] privilege on [default/src/key,value]")
+ assert(e.getMessage === "Permission denied: user [kent] does not have
[SELECT] privilege" +
+ " on [default/src/key,value]")
}
}
}
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/DataMaskingSQLTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/DataMaskingSQLTest.scala
index 9a4d23c..b2de098 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/DataMaskingSQLTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/DataMaskingSQLTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RangerAdminClientImpl.scala
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RangerAdminClientImpl.scala
index b626ded..14bca20 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RangerAdminClientImpl.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RangerAdminClientImpl.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RowFilterSQLTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RowFilterSQLTest.scala
index d0024bb..ace0f4e 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RowFilterSQLTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/RowFilterSQLTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
diff --git
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/TPCDSTest.scala
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/TPCDSTest.scala
index 682266a..28db217 100644
---
a/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/TPCDSTest.scala
+++
b/submarine-security/spark-security/src/test/scala/org/apache/submarine/spark/security/TPCDSTest.scala
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * 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.
+ * 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.
*/
package org.apache.submarine.spark.security
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]