-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
20 additions
and
87 deletions.
There are no files selected for viewing
66 changes: 1 addition & 65 deletions
66
exasol_machine_learning_library/execution/sql_stage_graph/sql_stage_graph.py
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 |
---|---|---|
@@ -1,68 +1,4 @@ | ||
from typing import Set, List | ||
|
||
from exasol.analytics.query_handler.context.scope import ScopeQueryHandlerContext | ||
|
||
from exasol_machine_learning_library.execution.execution_graph import ExecutionGraph | ||
from exasol_machine_learning_library.execution.sql_stage_graph_execution.sql_stage_input_output import \ | ||
SQLStageInputOutput | ||
from exasol_machine_learning_library.execution.stage_graph.stage import UDFStage, SQLStage | ||
from exasol_machine_learning_library.execution.stage_graph.sql_stage_train_query_handler import \ | ||
SQLStageTrainQueryHandler | ||
from exasol_machine_learning_library.execution.stage_graph.sql_stage import SQLStage | ||
|
||
UDFStageGraph = ExecutionGraph[UDFStage] | ||
SQLStageGraph = ExecutionGraph[SQLStage] | ||
|
||
|
||
class UDFRunnerPlaceholderSQLStage(SQLStage): | ||
def __init__(self, udf_stages_component: Set[UDFStage]): | ||
self._udf_stage_component = udf_stages_component | ||
|
||
@property | ||
def conntected_udf_stages(self) -> Set[UDFStage]: | ||
return set(self._udf_stage_component) | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}@{id(self)}" | ||
|
||
def create_train_query_handler(self, stage_inputs: List[SQLStageInputOutput], | ||
query_handler_context: ScopeQueryHandlerContext) -> SQLStageTrainQueryHandler: | ||
raise NotImplemented("The method create_train_query_handler should never be called on this stage, " | ||
"because it is a placeholder for graph rewriting.") | ||
|
||
|
||
class UDFRunnerSQLStage(SQLStage): | ||
def __init__(self, udf_stage_graph: UDFStageGraph): | ||
self._udf_stage_graph = udf_stage_graph | ||
|
||
@property | ||
def udf_stage_graph(self) -> UDFStageGraph: | ||
return self._udf_stage_graph | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}@{id(self)}" | ||
|
||
def create_train_query_handler(self, stage_inputs: List[SQLStageInputOutput], | ||
query_handler_context: ScopeQueryHandlerContext) -> SQLStageTrainQueryHandler: | ||
raise NotImplemented("The create_train_query_handler method needs a implementation.") | ||
|
||
|
||
class ColumnSelectorPlaceholderUDFStage(UDFStage): | ||
def __init__(self, input_sql_stage: List[SQLStage]): | ||
self._input_sql_stages = input_sql_stage | ||
|
||
@property | ||
def input_sql_stages(self) -> List[SQLStage]: | ||
return self._input_sql_stages | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}@{id(self)}" | ||
|
||
|
||
class SourceUDFStage(UDFStage): | ||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}@{id(self)}" | ||
|
||
|
||
class SinkUDFStage(UDFStage): | ||
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}@{id(self)}" |
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
15 changes: 15 additions & 0 deletions
15
exasol_machine_learning_library/execution/stage_graph/sql_stage.py
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,15 @@ | ||
import abc | ||
|
||
from exasol.analytics.query_handler.context.scope import ScopeQueryHandlerContext | ||
from exasol_machine_learning_library.execution.stage_graph.stage import Stage | ||
from exasol_machine_learning_library.execution.stage_graph.sql_stage_train_query_handler import \ | ||
SQLStageTrainQueryHandler, SQLStageTrainQueryHandlerInput | ||
|
||
class SQLStage(Stage): | ||
@abc.abstractmethod | ||
def create_train_query_handler( | ||
self, | ||
stage_input: SQLStageTrainQueryHandlerInput, | ||
query_handler_context: ScopeQueryHandlerContext, | ||
) -> SQLStageTrainQueryHandler: | ||
pass |
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
2 changes: 1 addition & 1 deletion
2
exasol_machine_learning_library/execution/stage_graph/stage_graph.py
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from exasol_machine_learning_library.execution.execution_graph import ExecutionGraph | ||
from exasol_machine_learning_library.execution.stage_graph.stage import SQLStage, UDFStage, Stage | ||
from exasol_machine_learning_library.execution.stage_graph.stage import Stage | ||
|
||
StageGraph = ExecutionGraph[Stage] |
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