-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General Druid refactors #16708
Open
adarshsanjeev
wants to merge
17
commits into
apache:master
Choose a base branch
from
adarshsanjeev:misc-refactors
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+638
−87
Open
General Druid refactors #16708
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a8dcf15
Minor refactors
adarshsanjeev 57e9b02
Refactor write to return index of value written
adarshsanjeev cb79da4
Refactor compressionFactory
adarshsanjeev 615bf32
Fix checkstyle
adarshsanjeev d09706c
Remove some unused code
adarshsanjeev ee8766b
Fix broken test
adarshsanjeev 70b13da
Add tests
adarshsanjeev c80eaf7
Additional changes
adarshsanjeev 396c71f
Switch to throwing an exception for invalid find calls
adarshsanjeev ceafa09
Remove comment
adarshsanjeev 5f014e3
Merge remote-tracking branch 'origin/master' into misc-refactors
adarshsanjeev 927f7b9
Merge remote-tracking branch 'origin/master' into misc-refactors
adarshsanjeev 33732ac
Minor changes
adarshsanjeev 496376a
Update processing/src/main/java/org/apache/druid/error/NotYetImplemen…
asdf2014 ab36689
Address review comments
adarshsanjeev f58ffba
Revert accidental change
adarshsanjeev f9befcd
Refactor
adarshsanjeev 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 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
67 changes: 67 additions & 0 deletions
67
processing/src/main/java/org/apache/druid/error/NotYetImplemented.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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.druid.error; | ||
|
||
/** | ||
* A failure class that is used to indicate that something is just not implemented yet. This is useful when a | ||
* developer builds something and they intentionally do not implement a specific branch of code or type of object. | ||
* <p> | ||
* The lack of implementation is not necessarily a statement that it SHOULDN'T be implemented, it's just an indication | ||
* that it has not YET been implemented. When one of these exceptions is seen, it is usually an indication that it is | ||
* now time to actually implement the path that was previously elided. | ||
* <p> | ||
* Oftentimes, the code path wasn't implemented because the developer thought that it wasn't actually possible to | ||
* see it executed. So, collecting and providing information about why the particular path got executed is often | ||
* extremely helpful in understanding why it happened and accelerating the implementation of what the correct behavior | ||
* should be. | ||
*/ | ||
public class NotYetImplemented extends DruidException.Failure | ||
{ | ||
public static DruidException ex(Throwable t, String msg, Object... args) | ||
{ | ||
return DruidException.fromFailure(new NotYetImplemented(t, msg, args)); | ||
} | ||
|
||
private final Throwable t; | ||
private final String msg; | ||
private final Object[] args; | ||
|
||
public NotYetImplemented(Throwable t, String msg, Object[] args) | ||
{ | ||
super("notYetImplemented"); | ||
this.t = t; | ||
this.msg = msg; | ||
this.args = args; | ||
} | ||
|
||
|
||
@Override | ||
protected DruidException makeException(DruidException.DruidExceptionBuilder bob) | ||
{ | ||
bob = bob.forPersona(DruidException.Persona.DEVELOPER) | ||
.ofCategory(DruidException.Category.DEFENSIVE); | ||
|
||
if (t == null) { | ||
return bob.build(msg, args); | ||
} else { | ||
return bob.build(t, msg, args); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
this conditional looks odd... its not wrong; but it will only skip the set if it went over the full stacktrace; but when its
0
it still does it...I guess the intention here is to clip the exception construction process?
could you add a test for this?
with a case which checks what happens if a
DruidException
is set as a cause for anotherDruidException
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.
Changed this to
if (firstNonDruidExceptionIndex > 0)
If
firstNonDruidExceptionIndex == stackTrace.length
, we should copy an empty array, which is what would happen, and if the the exception is 0, we should not need a copy.