-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SparkDataType as wrapper for unmapped spark data type (#2492)
* Add SparkDataType as wrapper for unmapped spark data type Signed-off-by: Peng Huo <[email protected]> * add IT for parsing explain query reponse Signed-off-by: Peng Huo <[email protected]> --------- Signed-off-by: Peng Huo <[email protected]>
- Loading branch information
Showing
8 changed files
with
460 additions
and
56 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
spark/src/main/java/org/opensearch/sql/spark/data/type/SparkDataType.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,24 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.data.type; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.RequiredArgsConstructor; | ||
import org.opensearch.sql.data.type.ExprType; | ||
|
||
/** Wrapper of spark data type */ | ||
@EqualsAndHashCode | ||
@RequiredArgsConstructor | ||
public class SparkDataType implements ExprType { | ||
|
||
/** Spark datatype name. */ | ||
private final String typeName; | ||
|
||
@Override | ||
public String typeName() { | ||
return typeName; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
spark/src/main/java/org/opensearch/sql/spark/data/value/SparkExprValue.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,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.data.value; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.opensearch.sql.data.model.AbstractExprValue; | ||
import org.opensearch.sql.data.model.ExprValue; | ||
import org.opensearch.sql.data.type.ExprType; | ||
import org.opensearch.sql.spark.data.type.SparkDataType; | ||
|
||
/** SparkExprValue hold spark query response value. */ | ||
@RequiredArgsConstructor | ||
public class SparkExprValue extends AbstractExprValue { | ||
|
||
private final SparkDataType type; | ||
private final Object value; | ||
|
||
@Override | ||
public Object value() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public ExprType type() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public int compare(ExprValue other) { | ||
throw new UnsupportedOperationException("SparkExprValue is not comparable"); | ||
} | ||
|
||
@Override | ||
public boolean equal(ExprValue other) { | ||
return value.equals(other.value()); | ||
} | ||
} |
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.