You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 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.#fromtypingimportSet, List, Typefromitertoolsimportchainfrompywy.core.channelimportCH_T, ChannelDescriptorfrompywy.operators.unaryimportFlatmapOperatorfrompywy.platforms.jvm.channelsimportDISPATCHABLE_CHANNEL_DESCRIPTOR, DispatchableChannelfrompywy.platforms.jvm.operator.jvm_execution_operatorimportJVMExecutionOperatorfrompywy.platforms.commons.channelsimport (
CommonsCallableChannel
)
frompywy.platforms.jvm.serializable.wayang_jvm_operatorimportWayangJVMMappartitionOperator, WayangJVMOperatorclassJVMFlatmapOperator(FlatmapOperator, JVMExecutionOperator):
def__init__(self, origin: FlatmapOperator=None, **kwargs):
fm_function=NoneiforiginisNoneelseorigin.fm_functionsuper().__init__(fm_function)
self.set_context(**kwargs)
defexecute(self, inputs: List[Type[CH_T]], outputs: List[Type[CH_T]]):
self.validate_channels(inputs, outputs)
udf=self.fm_functionifisinstance(inputs[0], DispatchableChannel):
py_in_dispatch_channel: DispatchableChannel=inputs[0]
py_out_dispatch_channel: DispatchableChannel=outputs[0]
deffunc(iterator):
returnchain.from_iterable(map(udf, iterator))
py_out_dispatch_channel.accept_callable(
CommonsCallableChannel.concatenate(
func,
py_in_dispatch_channel.provide_callable()
)
)
op: WayangJVMOperator=py_in_dispatch_channel.provide_dispatchable()
ifisinstance(op, WayangJVMMappartitionOperator):
py_out_dispatch_channel.accept_dispatchable(op)
returncurrent: WayangJVMMappartitionOperator=WayangJVMMappartitionOperator(self.name)
# TODO check for the case where the index matterop.connect_to(0, current, 0)
self.close_operator(op)
py_out_dispatch_channel.accept_dispatchable(current)
else:
raiseException("Channel Type does not supported")
defget_input_channeldescriptors(self) ->Set[ChannelDescriptor]:
return {DISPATCHABLE_CHANNEL_DESCRIPTOR}
defget_output_channeldescriptors(self) ->Set[ChannelDescriptor]:
return {DISPATCHABLE_CHANNEL_DESCRIPTOR}
a0e00e9d708aa85292080382017bfe2eb174f24e
The text was updated successfully, but these errors were encountered:
check for the case where the index matter
incubator-wayang/python/old_code/src/pywy/platforms/jvm/operator/jvm_unary_flatmap.py
Line 62 in c25c656
a0e00e9d708aa85292080382017bfe2eb174f24e
The text was updated successfully, but these errors were encountered: