-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add query based input into interfaces (#25)
- Loading branch information
1 parent
78f3792
commit e682a4f
Showing
18 changed files
with
490 additions
and
148 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# This file is generated by the 'io.freefair.lombok' Gradle plugin | ||
config.stopBubbling = true | ||
lombok.addLombokGeneratedAnnotation = true | ||
lombok.nonNull.exceptionType = JDK |
44 changes: 44 additions & 0 deletions
44
common/src/main/java/org/opensearch/ml/common/dataset/DataFrameInputDataset.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,44 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.ml.common.dataset; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.ml.common.dataframe.DataFrame; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.experimental.FieldDefaults; | ||
|
||
/** | ||
* DataFrame based input data. Client directly passes the data frame to ML plugin with this. | ||
*/ | ||
@Getter | ||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) | ||
public class DataFrameInputDataset extends MLInputDataset { | ||
DataFrame dataFrame; | ||
|
||
@Builder | ||
public DataFrameInputDataset(@NonNull DataFrame dataFrame) { | ||
super(MLInputDataType.DATA_FRAME); | ||
this.dataFrame = dataFrame; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput streamOutput) throws IOException { | ||
super.writeTo(streamOutput); | ||
dataFrame.writeTo(streamOutput); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
common/src/main/java/org/opensearch/ml/common/dataset/MLInputDataType.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,17 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.ml.common.dataset; | ||
|
||
public enum MLInputDataType { | ||
SEARCH_QUERY, | ||
DATA_FRAME; | ||
} |
34 changes: 34 additions & 0 deletions
34
common/src/main/java/org/opensearch/ml/common/dataset/MLInputDataset.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,34 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.ml.common.dataset; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.common.io.stream.Writeable; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.FieldDefaults; | ||
|
||
@Getter | ||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) | ||
@RequiredArgsConstructor | ||
public abstract class MLInputDataset implements Writeable { | ||
MLInputDataType inputDataType; | ||
|
||
@Override | ||
public void writeTo(StreamOutput streamOutput) throws IOException { | ||
streamOutput.writeEnum(this.inputDataType); | ||
} | ||
} |
Oops, something went wrong.