This repository was archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
[LENS-1545]: Fixed a Bug and made changes for PreparedQuery. #34
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
98ab7a5
exposing jmx port for monitoring the threads, cpu and memory
RajashekharInmobi d3b41b3
Fix for RNA-10440: Lens driver not picking hadoop conf
RajashekharInmobi 69e9e64
added the files
RajashekharInmobi 616aeec
Merge remote-tracking branch 'upstream/master'
RajashekharInmobi 3dffffb
Adding support for Partition Columns to queried without giving additi…
RajashekharInmobi 7783450
reverting old change
RajashekharInmobi 149a192
resolved imports
RajashekharInmobi c7aa785
added Example for supporting the non-timed partition as filter while …
787c7e2
Merge remote-tracking branch 'upstream/master'
1dc444c
Merge remote-tracking branch 'upstream/master'
c0cb51a
fixed the yaml
RajashekharInmobi 65174d2
licence
RajashekharInmobi dbbf4f5
Merge remote-tracking branch 'upstream/master'
RajashekharInmobi 8e921d5
Merge remote-tracking branch 'upstream/master'
RajashekharInmobi 0519d9d
made few changes to the code for azure deployment
RajashekharInmobi bc6f628
Fixed the test case, removed instances where Prepare was hitting the …
RajashekharInmobi 2d6fb3d
reversed few changes
RajashekharInmobi 0caecd7
removing not needed commits
RajashekharInmobi 2ce78dc
undid the unit test cases
RajashekharInmobi 2400d8e
made one more change
RajashekharInmobi 5fa2800
fixed code review comments
RajashekharInmobi 926b604
fixed code review comments
RajashekharInmobi 353dd56
fixed code review comments
RajashekharInmobi b183d21
Merge branch 'master' of https://github.com/RajashekharInmobi/lens
RajashekharInmobi fc4358e
made some changes
RajashekharInmobi 75c440d
Merge branch 'master' of https://github.com/RajashekharInmobi/lens
RajashekharInmobi fe57a2e
added the files
RajashekharInmobi 0cdd720
added the code review fix
RajashekharInmobi dc67c27
added a unit test case
RajashekharInmobi 8d3e015
added the test case
RajashekharInmobi af1f5d4
fixed unit test case
RajashekharInmobi 24783d6
fixed unit test case
RajashekharInmobi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |
| import org.apache.lens.api.query.QueryStatus; | ||
| import org.apache.lens.server.api.error.LensException; | ||
| import org.apache.lens.server.api.query.FinishedLensQuery; | ||
| import org.apache.lens.server.api.query.PreparedQueryContext; | ||
| import org.apache.lens.server.api.query.QueryContext; | ||
| import org.apache.lens.server.session.LensSessionImpl; | ||
| import org.apache.lens.server.util.UtilityMethods; | ||
|
|
@@ -47,6 +48,7 @@ | |
| import org.apache.hadoop.conf.Configuration; | ||
|
|
||
| import com.google.common.collect.Lists; | ||
|
|
||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| /** | ||
|
|
@@ -105,6 +107,20 @@ public void createFinishedQueriesTable() throws Exception { | |
| log.warn("Unable to create finished queries table", e); | ||
| } | ||
| } | ||
|
|
||
| public void createPreparedQueriesTable() throws Exception { | ||
| String sql = "CREATE TABLE if not exists prepared_queries (handle varchar(255) NOT NULL unique, userquery " | ||
| + "varchar(20000), submitter varchar(255) NOT NULL, timetaken bigint, queryname varchar(255) DEFAULT NULL, " | ||
| + "drivername varchar(10000) DEFAULT NULL, driverquery varchar(1000000), starttime bigint)"; | ||
| try { | ||
| QueryRunner runner = new QueryRunner(ds); | ||
| runner.update(sql); | ||
| log.info("Created prepared_queries queries table"); | ||
| } catch (SQLException e) { | ||
| log.warn("Unable to create prepared_queries queries table", e); | ||
| } | ||
| } | ||
|
|
||
| public void createFailedAttemptsTable() throws Exception { | ||
| String sql = "CREATE TABLE if not exists failed_attempts (handle varchar(255) not null," | ||
| + "attempt_number int, drivername varchar(10000), progress float, progressmessage varchar(10000), " | ||
|
|
@@ -821,4 +837,35 @@ public boolean deleteActiveSession(LensSessionHandle sessionId) throws LensExcep | |
|
|
||
| return result; | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add update prepare query also
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't update the prepared query, we insert only prepared query, so it is not needed. |
||
| /** | ||
| * DAO method to insert a new Prepared query into Table. | ||
| * | ||
| * @param preparedQueryContext to be inserted | ||
| * @throws SQLException the exception | ||
| */ | ||
| public void insertPreparedQuery(PreparedQueryContext preparedQueryContext) throws LensException { | ||
| String sql = "insert into prepared_queries (handle, userquery, submitter, timetaken, queryname, drivername, " | ||
| + "driverquery, starttime)" + " values (?,?,?,?,?,?,?,?)"; | ||
| Connection conn = null; | ||
| try { | ||
| conn = getConnection(); | ||
| conn.setAutoCommit(false); | ||
| QueryRunner runner = new QueryRunner(); | ||
|
|
||
| long timeTaken = | ||
| preparedQueryContext.getPrepareEndTime().getTime() - preparedQueryContext.getPrepareStartTime().getTime(); | ||
|
|
||
| runner.update(conn, sql, preparedQueryContext.getPrepareHandle().getQueryHandleString(), | ||
| preparedQueryContext.getUserQuery(), preparedQueryContext.getSubmittedUser(), timeTaken, | ||
| preparedQueryContext.getQueryName(), preparedQueryContext.getDriverContext().getSelectedDriver().toString(), | ||
| preparedQueryContext.getSelectedDriverQuery(), preparedQueryContext.getPrepareStartTime().getTime()); | ||
| conn.commit(); | ||
| } catch (SQLException e) { | ||
| log.error("Failed to insert prepared query into database with error, " + e); | ||
| throw new LensException(e); | ||
| } finally { | ||
| DbUtils.closeQuietly(conn); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a unit test be added for the bug fixed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.