[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy closed the pull request at: https://github.com/apache/drill/pull/685 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 Closing pull request --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva commits squashed. Thanks. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r98425957 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java --- @@ -64,17 +65,45 @@ public void eval() { @Inject DrillBuf buffer; @Workspace int currentSchemaBytesLength; +@Override public void setup() { final byte[] currentSchemaBytes = contextInfo.getCurrentDefaultSchema().getBytes(); buffer = buffer.reallocIfNeeded(currentSchemaBytes.length); currentSchemaBytesLength= currentSchemaBytes.length; buffer.setBytes(0, currentSchemaBytes); } +@Override public void eval() { out.start = 0; out.end = currentSchemaBytesLength; out.buffer = buffer; } } + + /** + * Implement "session_id" function. Returns the unique id of the current session. + */ + @FunctionTemplate(name = "session_id", scope = FunctionTemplate.FunctionScope.SIMPLE, isNiladic = true) --- End diff -- :) I checked the niladic functions... Will make the commit shortly. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r98355138 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java --- @@ -64,17 +65,45 @@ public void eval() { @Inject DrillBuf buffer; @Workspace int currentSchemaBytesLength; +@Override public void setup() { final byte[] currentSchemaBytes = contextInfo.getCurrentDefaultSchema().getBytes(); buffer = buffer.reallocIfNeeded(currentSchemaBytes.length); currentSchemaBytesLength= currentSchemaBytes.length; buffer.setBytes(0, currentSchemaBytes); } +@Override public void eval() { out.start = 0; out.end = currentSchemaBytesLength; out.buffer = buffer; } } + + /** + * Implement "session_id" function. Returns the unique id of the current session. + */ + @FunctionTemplate(name = "session_id", scope = FunctionTemplate.FunctionScope.SIMPLE, isNiladic = true) --- End diff -- @jinfengni @arina-ielchiieva am in the process of adding `isNiladic=true` to the standard functions. I am referring to [SqlStdOperatorTable.java](https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java) in Calcite and tried to find the equivalent functions in Drill. I have marked following functions from [DateTypeFunctions.java](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java) and [ContextFunctions.java](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java) as isNiladic=true. 1. "current_date" 2. "timeofday" (**is this a niladic function? Not found in Calcite**) 3. {"localtimestamp", "current_timestamp", "now", "statement_timestamp", "transaction_timestamp"} 4. {"current_time", "localtime"} 5. "unix_timestamp" (**is this a niladic function? Not found in Calcite**) 6. {"user", "session_user", "system_user"} 7. "current_schema" 8. "session_id" Please check the above list... and let me know if I should add more. Also, I should not be marking something niladic if it is not as that will break the existing queries. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r97721703 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java --- @@ -64,17 +65,45 @@ public void eval() { @Inject DrillBuf buffer; @Workspace int currentSchemaBytesLength; +@Override public void setup() { final byte[] currentSchemaBytes = contextInfo.getCurrentDefaultSchema().getBytes(); buffer = buffer.reallocIfNeeded(currentSchemaBytes.length); currentSchemaBytesLength= currentSchemaBytes.length; buffer.setBytes(0, currentSchemaBytes); } +@Override public void eval() { out.start = 0; out.end = currentSchemaBytesLength; out.buffer = buffer; } } + + /** + * Implement "session_id" function. Returns the unique id of the current session. + */ + @FunctionTemplate(name = "session_id", scope = FunctionTemplate.FunctionScope.SIMPLE, isNiladic = true) --- End diff -- - Functions like current_time/current_date already function like niladic as Calcite recognizes them so. - IsNiladic flag can be set by any UDF. Not restricted only to session_I'd - If I understand right, currently there is no categorization of UDFs in Drill. If we want to restrict isNiladic flag only to a particular category of UDFs, then categorization of UDFs need to be designed n implemented. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva conflicts resolved and rebased on master. Please check. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva @sudheeshkatkam @julianhyde @paul-rogers Thank You All for your comments and guidance throughout. It was a nice learning experience for me :) I have squashed the commits. I understand this function needs to be added to the documentation. Please let me know what is the process to help with the documentation. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva @sudheeshkatkam I have made the following changes to support invocation of UDFs without parenthesis. 1. Introduced `isNiladic` option in FunctionTemplate and added a property in DrillFuncHolder, FunctionAttributes, DrillSqlOperator classes 2. Overridden DrillSqlOperator.getSyntax() to return SqlSyntax.FUNCTION_ID when isNiladic is true 3. Modified all the places to pass false for isNiladic parameter to DrillSqlOperator constructor -- so that existing behavior is not impacted 4. In DrillOperatorTable, adding an operator to operatorList when the syntax of an operator is either FUNCTION or FUNCTION_ID 5. Modified tests to invoke session_id without parenthesis. Please review the changes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 Success :) I could invoke SESSION_ID without parenthesis. Following did the trick: 1. In DrillSqlOperator, overriding getSyntax method to return SqlSyntax.FUNCTION_ID 2. In DrillOperatorTable, adding operator when SqlSyntax is (FUNCTION || FUNCTION_ID) Will submit a commit shortly. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 Sent a mail to Dev list with the findings... issue yet to be resolved: [Link to the mail](http://mail-archives.apache.org/mod_mbox/drill-dev/201701.mbox/%3ccacd9g6hwrtfckd_2jhmrext_tb0zwcrxtb7j5digkmy9atk...@mail.gmail.com%3E) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva , I have started examining the difference in implementations of functions like CURRENT_DATE, SYSTEM_USER etc. in Calcite and the implementation of DrillSqlOperator in Drill. Will get back once I find the solution. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93780471 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java --- @@ -141,7 +141,7 @@ public FragmentContext(final DrillbitContext dbContext, final PlanFragment fragm this.accountingUserConnection = new AccountingUserConnection(connection, sendingAccountor, statusHandler); this.fragment = fragment; this.funcRegistry = funcRegistry; -contextInformation = new ContextInformation(fragment.getCredentials(), fragment.getContext()); +contextInformation = new ContextInformation(fragment.getCredentials(), fragment.getContext(), connection.getSession().getSessionId()); --- End diff -- accessing `connection` results into NPE for non-root fragment contexts. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva @sudheeshkatkam I have reverted the changes back to original design and tested. However, invoking `session_id` without parenthesis is pending to be fixed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93743678 --- Diff: protocol/src/main/protobuf/User.proto --- @@ -361,7 +361,7 @@ message ResultColumnMetadata { optional ColumnSearchability searchability = 13; /* - * Defaults to READ_ONLY + * Defaults to READ_ONLU --- End diff -- Revert the change --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93741547 --- Diff: protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java --- @@ -25001,7 +25001,7 @@ public Builder setUpdatability(org.apache.drill.exec.proto.UserProtos.ColumnUpda * * * - * Defaults to READ_ONLU + * Defaults to READ_ONLY --- End diff -- Revert changes as this has got nothing to do with this PR --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93741438 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java --- @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.client; +import static org.junit.Assert.assertFalse; + --- End diff -- Remove unnecessary newline introduced --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93741386 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/util/Utilities.java --- @@ -47,7 +47,7 @@ public static String getFileNameForQueryFragment(FragmentContext context, String * QueryContextInformation is derived from the current state of the process. * * @param defaultSchemaName - * @return + * @return QueryContextInformation --- End diff -- Revert the change as this has got nothing to do with this PR. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93740038 --- Diff: protocol/src/main/protobuf/UserBitShared.proto --- @@ -319,4 +319,3 @@ message Jar { optional string name = 1; repeated string function_signature = 2; } - --- End diff -- Remove newline introduced --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93739906 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -343,7 +343,6 @@ public BitToUserHandshake getHandshakeResponse(UserToBitHandshake inbound) throw if (inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION) { final String errMsg = String.format("Invalid rpc version. Expected %d, actual %d.", UserRpcConfig.RPC_VERSION, inbound.getRpcVersion()); - --- End diff -- Remove newline introduced --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva @sudheeshkatkam as [DRILL-5132](https://issues.apache.org/jira/browse/DRILL-5132) is being explored to be addressed through UDFs... I am reverting back to original design as suggested by @arina-ielchiieva . Will submit a new commit with original design shortly. Sorry about the detour. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93394114 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -255,11 +257,12 @@ void disableReadTimeout() { getChannel().pipeline().remove(BasicServer.TIMEOUT_HANDLER); } -void setUser(final UserToBitHandshake inbound) throws IOException { +void setUser(final UserToBitHandshake inbound, Map sessionParams) throws IOException { --- End diff -- @sudheeshkatkam I had created this few days back. But updated details with more clarity now. The ticket is: [DRILL-5132](https://issues.apache.org/jira/browse/DRILL-5132). Pls let me know your views. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93267919 --- Diff: protocol/src/main/protobuf/UserBitShared.proto --- @@ -320,3 +320,17 @@ message Jar { repeated string function_signature = 2; } + +/* Session parameter +message SessionParam { + optional string key = 1; + optional string value = 2; +} +*/ + +/* User session context that has session id and session parameters +*/ +message UserSessionContextInformation { + optional string session_id = 1; + // repeated SessionParam session_params = 2 +} --- End diff -- My understanding is that the various context information need to be transportable (serializable and parcelable) for distributed query execution. Hence made it a protobuf message. Pls let me know if my understanding is incorrect. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93267316 --- Diff: protocol/src/main/protobuf/UserBitShared.proto --- @@ -320,3 +320,17 @@ message Jar { repeated string function_signature = 2; } + +/* Session parameter +message SessionParam { + optional string key = 1; + optional string value = 2; +} --- End diff -- Though they have same key-value pairs, did not want to overload it for different purposes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93267171 --- Diff: protocol/src/main/protobuf/UserBitShared.proto --- @@ -320,3 +320,17 @@ message Jar { repeated string function_signature = 2; } + +/* Session parameter +message SessionParam { + optional string key = 1; + optional string value = 2; +} --- End diff -- Though they have same key-value pairs, did not want to overload it for different purposes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93266381 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -255,11 +257,12 @@ void disableReadTimeout() { getChannel().pipeline().remove(BasicServer.TIMEOUT_HANDLER); } -void setUser(final UserToBitHandshake inbound) throws IOException { +void setUser(final UserToBitHandshake inbound, Map sessionParams) throws IOException { --- End diff -- Lets say there is an external custom authenticator It validates the credentials with that external system and loads contextual information from that external system. Examples: - Tenant_Id of the currently logged in user - Roles of the user logged in - Any user preference details that are loaded in the context of that external system - Etc.. User Properties, as I understood seem to be the configuration variables (E.g., drill-override.conf). These are known expected properties. Whereas Session Parameters may not be known properties. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva I have made the changes to: 1. Generate sessionId within the constructor of UserSession 2. Add a builder method in UserSession to construct UserSessionContextInformation 3. Session Parameters related changes are either commented or put in TODO (for future extension. Will address this in a separate PR) 4. @julianhyde 's comment of being able to invoke session_id() UDF without parenthesis is still pending. Have sent a mail to dev list. Need to know how to achieve that in drill. This time again I have squashed the commits as I already have done that. Will take care of your suggestion about squashing in future PRs. Please review the changes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93128753 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -359,12 +363,14 @@ public BitToUserHandshake getHandshakeResponse(UserToBitHandshake inbound) throw } } authenticator.authenticate(inbound.getCredentials().getUserName(), password); + // TODO: make authenticator return a map of session parameters and store it in sessionParams. } catch (UserAuthenticationException ex) { + logger.debug(ex.getMessage()); --- End diff -- remove debug message --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93128502 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java --- @@ -343,10 +346,11 @@ public BitToUserHandshake getHandshakeResponse(UserToBitHandshake inbound) throw if (inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION) { final String errMsg = String.format("Invalid rpc version. Expected %d, actual %d.", UserRpcConfig.RPC_VERSION, inbound.getRpcVersion()); - +logger.debug(errMsg); --- End diff -- Remove debug message --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r93128266 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java --- @@ -64,17 +65,45 @@ public void eval() { @Inject DrillBuf buffer; @Workspace int currentSchemaBytesLength; +@Override public void setup() { final byte[] currentSchemaBytes = contextInfo.getCurrentDefaultSchema().getBytes(); buffer = buffer.reallocIfNeeded(currentSchemaBytes.length); currentSchemaBytesLength= currentSchemaBytes.length; buffer.setBytes(0, currentSchemaBytes); } +@Override public void eval() { out.start = 0; out.end = currentSchemaBytesLength; out.buffer = buffer; } } + + /** + * Implement "session_id" function. Returns the unique id of the current session. + */ + @FunctionTemplate(name = "session_id", scope = FunctionTemplate.FunctionScope.SIMPLE) + public static class SessionId implements DrillSimpleFunc { +@Output VarCharHolder out; +@Inject ContextInformation contextInfo; +@Inject DrillBuf buffer; +@Workspace int sessionIdBytesLength; + +@Override +public void setup() { +final byte[] sessionIdBytes = contextInfo.getSessionId().getBytes(); +buffer = buffer.reallocIfNeeded(sessionIdBytes.length); +sessionIdBytesLength = sessionIdBytes.length; +buffer.setBytes(0, sessionIdBytes); +} + +@Override +public void eval() { +out.start = 0; +out.end = sessionIdBytesLength; +out.buffer = buffer; +} + } } --- End diff -- Invocation of `session_id()` without parenthesis is pending --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva Sorry for the refactoring before consulting some of the thoughts I had. Thanks for the suggestion to add such changes in separate commit. Learning the process :) 1. Idea of having UserSessionContext as a separate class was to have the ability to hold additional session related parameters as a possible future extension. Basically have the ability to: - populate system captured session parameters - have custom authenticator populated session parameters 2. I agree to the point that session-id cannot be optional. I will see how I can combine above points and submit another commit. Hope that's fine. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r92933806 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/partitionsender/TestPartitionSender.java --- @@ -27,6 +27,7 @@ import java.io.PrintWriter; import java.util.List; import java.util.Random; +import java.util.UUID; --- End diff -- Unused import needs to be removed --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r92933786 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java --- @@ -55,6 +55,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.List; +import java.util.UUID; --- End diff -- Unused import needs to be removed --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r92933707 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/ops/ContextInformation.java --- @@ -19,6 +19,8 @@ import org.apache.drill.exec.proto.BitControl.QueryContextInformation; import org.apache.drill.exec.proto.UserBitShared.UserCredentials; +import org.apache.drill.exec.proto.UserBitShared.UserSessionContextInformation; --- End diff -- Unused imports need to be removed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @julianhyde Thanks for your feedback. But I am not sure how to make a function not to have `()`. Need help. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva @sudheeshkatkam I have made further re-factoring. Please review the changes. Main changes are: 1. Introduced *`UserSessionContext`* class to encapsulate all session-context related information 2. Changed UserSession.Builder to accept UserSessionContext instance (withSessionContext()) 3. UserServer creates the UserSessionContext and passes it to UserSession.Builder Thanks. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy closed the pull request at: https://github.com/apache/drill/pull/685 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
GitHub user nagarajanchinnasamy reopened a pull request: https://github.com/apache/drill/pull/685 Drill 5043: Function that returns a unique id per session/connection similar to MySQL's CONNECTION_ID() Please check [DRILL-5043](https://issues.apache.org/jira/browse/DRILL-5043) for the details on changes made and other details. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nagarajanchinnasamy/drill DRILL-5043 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/685.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #685 commit 3062d6052525524bacaad35765ff62b96ff31a42 Author: Nagarajan Chinnasamy Date: 2016-12-15T14:18:39Z DRILL-5043: Function that returns a unique id per session/connection similar to MySQL's CONNECTION_ID() #685 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @sudheeshkatkam changes suggested are incorporated and committed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r92617289 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ContextFunctions.java --- @@ -77,4 +76,28 @@ public void eval() { out.buffer = buffer; } } + + /** + * Implement "session_id" function. Returns the unique id of the current session. + */ + @FunctionTemplate(name = "session_id", scope = FunctionTemplate.FunctionScope.SIMPLE) + public static class SessionId implements DrillSimpleFunc { +@Output VarCharHolder out; +@Inject ContextInformation contextInfo; +@Inject DrillBuf buffer; +@Workspace int sessionIdBytesLength; + +public void setup() { --- End diff -- Changes pushed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva - squashing done :) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @arina-ielchiieva - minor changes made - commit message amended - unit tests added But am not sure If I have done the squashing correctly!!! tried `rebase` etc.. Need help regarding this. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @paul-rogers @arina-ielchiieva I have incorporated only the session id related changes from #666. Checked in embedded mode and it does work. Yet to check in distributed mode. Is there a specific testcase that i can run to test this? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r91826699 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java --- @@ -115,6 +118,7 @@ public UserSession build() { private UserSession() { queryCount = new AtomicInteger(0); +sessionId = nextSessionId.getAndIncrement(); } --- End diff -- Thanks Arina. Just realized you are the author of #666 :) Could you please tell me how I can merge your changes into my branch. Am new to this process. Thanks. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill issue #685: Drill 5043: Function that returns a unique id per session/...
Github user nagarajanchinnasamy commented on the issue: https://github.com/apache/drill/pull/685 @paul-rogers as per my requirement the SessionId needs to be unique. Thats all. It does not have to be a monotonically increasing sequence. So, UUID should be fine. Will look into #666 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
Github user nagarajanchinnasamy commented on a diff in the pull request: https://github.com/apache/drill/pull/685#discussion_r91685705 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java --- @@ -115,6 +118,7 @@ public UserSession build() { private UserSession() { queryCount = new AtomicInteger(0); +sessionId = nextSessionId.getAndIncrement(); } --- End diff -- Yes. This approach doesn't take distribution in consideration. Looking for inputs on what should be the approach for distributed environment. As suggested by @paul-rogers I will look into #666 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] drill pull request #685: Drill 5043: Function that returns a unique id per s...
GitHub user nagarajanchinnasamy opened a pull request: https://github.com/apache/drill/pull/685 Drill 5043: Function that returns a unique id per session/connection similar to MySQL's CONNECTION_ID() Please check [DRILL-5043](https://issues.apache.org/jira/browse/DRILL-5043) for the details on changes made and other details. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nagarajanchinnasamy/drill DRILL-5043 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/685.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #685 commit a579e1beaa5ea65c30a08f55abe41a689d8d6ead Author: Nagarajan Chinnasamy Date: 2016-11-19T15:23:34Z [DRILL-5043] Added session_id() to ContextFunctions - Initial changes commit a29269b7368de022eb7360b22315cf9471bf8f62 Author: Nagarajan Chinnasamy Date: 2016-11-19T15:38:46Z Merge https://github.com/apache/drill --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---