[jira] [Created] (DRILL-8387) Add Support for User Translation to ElasticSearch Plugin

2023-01-12 Thread Charles Givre (Jira)
Charles Givre created DRILL-8387:


 Summary: Add Support for User Translation to ElasticSearch Plugin
 Key: DRILL-8387
 URL: https://issues.apache.org/jira/browse/DRILL-8387
 Project: Apache Drill
  Issue Type: Improvement
  Components: Storage - ElasticSearch
Affects Versions: 1.20.3
Reporter: Charles Givre
Assignee: Charles Givre
 Fix For: 1.21.0


Add support for user translation to ElasticSearch. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DRILL-8386) Add Support for User Translation for Cassandra

2023-01-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DRILL-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17676230#comment-17676230
 ] 

ASF GitHub Bot commented on DRILL-8386:
---

cgivre commented on PR #2738:
URL: https://github.com/apache/drill/pull/2738#issuecomment-1380565243

   @jnturton  Thanks for the review!




> Add Support for User Translation for Cassandra
> --
>
> Key: DRILL-8386
> URL: https://issues.apache.org/jira/browse/DRILL-8386
> Project: Apache Drill
>  Issue Type: Improvement
>  Components: Storage - Cassandra
>Affects Versions: 1.20.3
>Reporter: Charles Givre
>Assignee: Charles Givre
>Priority: Major
> Fix For: 1.21.0
>
>
> Adds support for user translation to the Cassandra plugin. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DRILL-8386) Add Support for User Translation for Cassandra

2023-01-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DRILL-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17676228#comment-17676228
 ] 

ASF GitHub Bot commented on DRILL-8386:
---

cgivre commented on code in PR #2738:
URL: https://github.com/apache/drill/pull/2738#discussion_r1068265466


##
contrib/storage-splunk/README.md:
##
@@ -42,6 +42,10 @@ Sometimes Splunk has issue in connection to it:
 https://github.com/splunk/splunk-sdk-java/issues/62 
 To bypass it by Drill please specify "reconnectRetries": 3. It allows you to 
retry the connection several times.
 
+### User Translation
+The Splunk plugin supports user translation.  Simply set the `authMode` 
parameter to `USER_TRANSLATION` and use either the plain or vault credential 
provider for credentials.

Review Comment:
   That's probably a good idea.  I'd give it a +1.





> Add Support for User Translation for Cassandra
> --
>
> Key: DRILL-8386
> URL: https://issues.apache.org/jira/browse/DRILL-8386
> Project: Apache Drill
>  Issue Type: Improvement
>  Components: Storage - Cassandra
>Affects Versions: 1.20.3
>Reporter: Charles Givre
>Assignee: Charles Givre
>Priority: Major
> Fix For: 1.21.0
>
>
> Adds support for user translation to the Cassandra plugin. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DRILL-8386) Add Support for User Translation for Cassandra

2023-01-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DRILL-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17676231#comment-17676231
 ] 

ASF GitHub Bot commented on DRILL-8386:
---

cgivre merged PR #2738:
URL: https://github.com/apache/drill/pull/2738




> Add Support for User Translation for Cassandra
> --
>
> Key: DRILL-8386
> URL: https://issues.apache.org/jira/browse/DRILL-8386
> Project: Apache Drill
>  Issue Type: Improvement
>  Components: Storage - Cassandra
>Affects Versions: 1.20.3
>Reporter: Charles Givre
>Assignee: Charles Givre
>Priority: Major
> Fix For: 1.21.0
>
>
> Adds support for user translation to the Cassandra plugin. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DRILL-8386) Add Support for User Translation for Cassandra

2023-01-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DRILL-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17676227#comment-17676227
 ] 

ASF GitHub Bot commented on DRILL-8386:
---

jnturton commented on code in PR #2738:
URL: https://github.com/apache/drill/pull/2738#discussion_r1068257539


##
contrib/storage-cassandra/src/test/java/org/apache/drill/exec/store/cassandra/CassandraUserTranslationTest.java:
##
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+package org.apache.drill.exec.store.cassandra;
+
+import org.apache.drill.categories.SlowTest;
+import org.apache.drill.common.config.DrillProperties;
+import org.apache.drill.common.exceptions.UserRemoteException;
+import org.apache.drill.exec.physical.rowSet.RowSet;
+import org.apache.drill.test.ClientFixture;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import static 
org.apache.drill.exec.rpc.user.security.testing.UserAuthenticatorTestImpl.ADMIN_USER;
+import static 
org.apache.drill.exec.rpc.user.security.testing.UserAuthenticatorTestImpl.ADMIN_USER_PASSWORD;
+import static 
org.apache.drill.exec.rpc.user.security.testing.UserAuthenticatorTestImpl.TEST_USER_1;
+import static 
org.apache.drill.exec.rpc.user.security.testing.UserAuthenticatorTestImpl.TEST_USER_1_PASSWORD;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+@Category({SlowTest.class})
+public class CassandraUserTranslationTest extends BaseCassandraTest {
+  @Test
+  public void testInfoSchemaQueryWithMissingCredentials() throws Exception {
+// This test validates that the correct credentials are sent down to 
Cassandra.
+// This user should not see the ut_cassandra because they do not have 
valid credentials.
+ClientFixture client = cluster
+.clientBuilder()
+.property(DrillProperties.USER, ADMIN_USER)
+.property(DrillProperties.PASSWORD, ADMIN_USER_PASSWORD)
+.build();
+
+String sql = "SHOW DATABASES WHERE schema_name LIKE '%cassandra%'";
+
+RowSet results = client.queryBuilder().sql(sql).rowSet();
+assertEquals(1, results.rowCount());
+results.clear();
+  }
+
+  @Test
+  public void testInfoSchemaQueryWithValidCredentials() throws Exception {
+// This test validates that the cassandra connection with user translation 
appears whne the user is

Review Comment:
   ```suggestion
   // This test validates that the cassandra connection with user 
translation appears when the user is
   ```



##
contrib/storage-splunk/README.md:
##
@@ -42,6 +42,10 @@ Sometimes Splunk has issue in connection to it:
 https://github.com/splunk/splunk-sdk-java/issues/62 
 To bypass it by Drill please specify "reconnectRetries": 3. It allows you to 
retry the connection several times.
 
+### User Translation
+The Splunk plugin supports user translation.  Simply set the `authMode` 
parameter to `USER_TRANSLATION` and use either the plain or vault credential 
provider for credentials.

Review Comment:
   Do you think I should make authMode values case insensitive before 1.21 is 
released? USER_TRANSLATION looks odd compared to other Drill config values and 
is only in caps due to the coincidence that the Java Enum names are in caps.





> Add Support for User Translation for Cassandra
> --
>
> Key: DRILL-8386
> URL: https://issues.apache.org/jira/browse/DRILL-8386
> Project: Apache Drill
>  Issue Type: Improvement
>  Components: Storage - Cassandra
>Affects Versions: 1.20.3
>Reporter: Charles Givre
>Assignee: Charles Givre
>Priority: Major
> Fix For: 1.21.0
>
>
> Adds support for user translation to the Cassandra plugin. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DRILL-8380) Remove customised SqlValidatorImpl.deriveAlias

2023-01-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DRILL-8380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17676107#comment-17676107
 ] 

ASF GitHub Bot commented on DRILL-8380:
---

jnturton commented on code in PR #2733:
URL: https://github.com/apache/drill/pull/2733#discussion_r1068252216


##
exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java:
##
@@ -607,6 +608,16 @@ public String getQueryUserName() {
   @Override public UserCredentials getQueryUserCredentials() {
 return session.getCredentials();
   }
+
+  @Override
+  public String getTemporaryTableName(String table) {

Review Comment:
   This looks like another case where we wouldn't need to keep expanding 
interfaces like SchemaConfigInfoProvider and adding partial implementations 
where some throw UnsupportedOperationExceptions if we just had a good way of 
accessing the UserSession from most layers of Drill. It's not something for 
this PR for sure, but I wanted to remark to get your opinion since I remember 
having to work the same way when I was trying to expose UserCredentials 
(visible above) for user translation in plugins.



##
exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java:
##
@@ -607,6 +608,16 @@ public String getQueryUserName() {
   @Override public UserCredentials getQueryUserCredentials() {
 return session.getCredentials();
   }
+
+  @Override
+  public String getTemporaryTableName(String table) {
+return session.resolveTemporaryTableName(table);
+  }
+
+  @Override
+  public String getTemporaryWorkspace() {
+return config.getString(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE);

Review Comment:
   Have I got it right that this config option value is the only value returned 
by implementations of getTemporaryWorkspace? If so, do we need this method or 
could its callers look up the config value themselves instead?



##
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/conversion/DrillCalciteCatalogReader.java:
##
@@ -135,14 +112,15 @@ public Prepare.PreparingTable getTable(List 
names) {
   }
 
   private void checkTemporaryTable(List names) {
-if (allowTemporaryTables) {
+if (allowTemporaryTables || !needsTemporaryTableCheck(names, 
session.getDefaultSchemaPath(), drillConfig)) {
   return;
 }
-String originalTableName = 
session.getOriginalTableNameFromTemporaryTable(names.get(names.size() - 1));
+String tableName = names.get(names.size() - 1);
+String originalTableName = session.resolveTemporaryTableName(tableName);
 if (originalTableName != null) {
   throw UserException
   .validationError()
-  .message("Temporary tables usage is disallowed. Used temporary table 
name: [%s].", originalTableName)
+  .message("Temporary tables usage is disallowed. Used temporary table 
name: [%s].", tableName)

Review Comment:
   ```suggestion
 .message("A reference to temporary table [%s] was made in a 
context where temporary table references are not allowed.", tableName)
   ```





> Remove customised SqlValidatorImpl.deriveAlias
> --
>
> Key: DRILL-8380
> URL: https://issues.apache.org/jira/browse/DRILL-8380
> Project: Apache Drill
>  Issue Type: Sub-task
>Reporter: Vova Vysotskyi
>Assignee: Vova Vysotskyi
>Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)