-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Remote plan execution #14012
Remote plan execution #14012
Conversation
324372b
to
8796b28
Compare
8796b28
to
e58a5a7
Compare
e58a5a7
to
3df2ad4
Compare
e46e379
to
f893ce8
Compare
One minor comment, I have seen the word case THRIFT:
// do not interpret remote functions on coordinator
return call(node.getDisplayName(), functionHandle, node.getType(),
toRowExpressions(argumentValues, node.getArguments())); I'd suggest replace By using |
b49c01e
to
a459539
Compare
I agree with the principle. That's why in planning we only distinguish |
a459539
to
d27084d
Compare
d27084d
to
a46b880
Compare
.../facebook/presto/functionNamespace/execution/SimpleAddressSqlFunctionLanguageConfigSpec.java
Outdated
Show resolved
Hide resolved
...n/java/com/facebook/presto/functionNamespace/execution/thrift/ThriftSqlFunctionExecutor.java
Outdated
Show resolved
Hide resolved
...n/java/com/facebook/presto/functionNamespace/execution/thrift/ThriftSqlFunctionExecutor.java
Show resolved
Hide resolved
...n/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java
Outdated
Show resolved
Hide resolved
23c0ccf
to
42d1dd6
Compare
Ready for review @caithagoras @highker |
Thanks! Will take a pass today. |
presto-main/src/main/java/com/facebook/presto/sql/planner/PlanFragmenter.java
Show resolved
Hide resolved
public class SqlFunctionExecutors | ||
{ | ||
private final Map<Language, FunctionImplementationType> supportedLanguages; | ||
private final ThriftSqlFunctionExecutor thriftSqlFunctionExecutor; |
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 field does not have a getter, are we not using 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.
Added in later commit. I can also remove it from injection i suppose. The commits are not well separated logically (cause I broke them up later and both commits modified same files).
...src/main/java/com/facebook/presto/functionNamespace/execution/SqlFunctionLanguageConfig.java
Outdated
Show resolved
Hide resolved
queryRunner.enableTestFunctionNamespaces( | ||
ImmutableList.of("testing", "example"), | ||
ImmutableMap.of( | ||
"supported-function-languages", "sql, java", |
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.
nit: Usually comma-separate do not contains space. We can still support space, but maybe remove space here in the test example.
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.
It's good to test that space is fine though?
...n/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java
Outdated
Show resolved
Hide resolved
2a80bce
to
c08821c
Compare
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.
"RemoteProjectOperator.java" generally looks good.
presto-main/src/main/java/com/facebook/presto/operator/RemoteProjectOperator.java
Outdated
Show resolved
Hide resolved
private boolean processingPage() | ||
{ | ||
for (int i = 0; i < result.length; i++) { | ||
if (result[i] != null) { |
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.
If I understand correctly, if result
array contains non-null element, it means addInput
was called after last getOutput
: this is because in getOutput
, result
array will be filled with null
(line 110).
If that's the case, does it make sense to just have a AtomicBoolean
for this flag, say something like inputsAdded
? For two reason:
- More efficient (probably not really important)
- I was originally looking into the difference between
resultReady
, and wondering why we don't need to checkresult[i].isDone()
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.
I didn't quite get the second reason. I thought about the first one. Didn't do it cause feels performance is not enough reason to add an additional variable here. Maintaining two states separately has "maintenance cost" as well. I can add it if you prefer. Don't have strong opinion 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.
// result array will be filled with all null values after getOutput() get called
presto-main/src/main/java/com/facebook/presto/operator/RemoteProjectOperator.java
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/RemoteProjectOperator.java
Show resolved
Hide resolved
c08821c
to
ef1163c
Compare
lgtm % @wenleix 's comment and failing builds. |
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class SqlFunctionExecutors |
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.
curious: why this is called SqlFunctionExecutors
instead of SqlFunctionExecutor
? Looks like there is just one ThriftSqlFunctionExecutor
inside ? 😂
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.
Since execution is configurable, and Presto communication is primarily in http there could potentially be a http executor as well. Or maybe if we want to add other RPC protocol later. Calling it "executors" instead of "executor" just so we don't need to rename it in case any of those happens 😂
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.
"Remote function execution with thrift executor". Skimmed, generally looks good. Some random comments.
Don't have enough context about what RoutineCharacteristics.Language
represents...are we plan to use hive
in production?
A side note is there seems to be two similar "RoutineCharacteristics" exists in com.facebook.presto.spi.function
and com.facebook.presto.sql.tree
?
this.thriftUdfClient = thriftUdfClient; | ||
} | ||
|
||
public CompletableFuture<Block> executeFunction(ThriftScalarFunctionImplementation functionImplementation, Page input, List<Integer> channels, List<Type> argumentTypes, Type returnType) |
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.
curious: why not just return ListenableFuture
? I see guava
library is included in presto-function-namepsaces-manager
?
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.
The API in FunctionNamespaceManager
is in SPI.
...n/java/com/facebook/presto/functionNamespace/execution/thrift/ThriftSqlFunctionExecutor.java
Outdated
Show resolved
Hide resolved
...n/java/com/facebook/presto/functionNamespace/execution/thrift/ThriftSqlFunctionExecutor.java
Outdated
Show resolved
Hide resolved
return toCompletableFuture(thriftUdfClient.get(Optional.of(functionImplementation.getLanguage().getLanguage())).invokeUdf( | ||
new ThriftFunctionHandle( | ||
functionId.getFunctionName().toString(), | ||
functionId.getArgumentTypes().stream() |
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 comment doesn't request any change. Just purely a comment: at first glance seeing "argument types" contained in FunctionId
looks weird 😃
I can totally imagine how does this happen. -- We are running out of words such as FunctionSigature
, etc. ... So FunctionId
becomes the best word. 😂
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.
Hmm now you mention it, it does feel non-obvious. But the unique identifier of a function is name + argument types so that's why the name is FunctionId
and it includes the name and the argument types.
yes, one is a syntax tree construct directly from ast, the other is what we use in plan. |
a54911c
to
c7666be
Compare
Comment addressed. @caithagoras @wenleix |
c7666be
to
5520210
Compare
The default Locality when not specified is UNKNOWN, which should be illegal after planning. We have a plan sanity check rule to make sure no ProjectNode has Locality UNKOWN. Unfortunately this code is added after plan sanity check so we didn't catch the error.
5520210
to
aaeff3f
Compare
Resolves #14053
depended by https://github.com/facebookexternal/presto-facebook/pull/1149