Skip to content

Commit

Permalink
Reverted irrelevant changes
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <[email protected]>
  • Loading branch information
GumpacG committed May 30, 2023
1 parent 1345794 commit 1591a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import org.opensearch.search.sort.SortOrder;
import org.opensearch.sql.ast.tree.Sort;
import org.opensearch.sql.data.type.ExprCoreType;
import org.opensearch.sql.data.type.ExprType;
import org.opensearch.sql.expression.Expression;
import org.opensearch.sql.expression.ExpressionNodeVisitor;
import org.opensearch.sql.expression.NamedExpression;
import org.opensearch.sql.expression.ReferenceExpression;
import org.opensearch.sql.expression.aggregation.NamedAggregator;
import org.opensearch.sql.opensearch.data.type.OpenSearchDataType;
import org.opensearch.sql.opensearch.data.type.OpenSearchDateType;
import org.opensearch.sql.opensearch.response.agg.CompositeAggregationParser;
import org.opensearch.sql.opensearch.response.agg.MetricParser;
import org.opensearch.sql.opensearch.response.agg.NoBucketAggregationParser;
Expand Down Expand Up @@ -112,12 +112,10 @@ public Map<String, OpenSearchDataType> buildTypeMapping(
List<NamedAggregator> namedAggregatorList,
List<NamedExpression> groupByList) {
ImmutableMap.Builder<String, OpenSearchDataType> builder = new ImmutableMap.Builder<>();
namedAggregatorList.forEach(agg -> {
builder.put(agg.getName(), OpenSearchDataType.of(agg.type()));
});
groupByList.forEach(group -> {
builder.put(group.getNameOrAlias(), OpenSearchDataType.of(group.type()));
});
namedAggregatorList.forEach(agg -> builder.put(agg.getName(),
OpenSearchDataType.of(agg.type())));
groupByList.forEach(group -> builder.put(group.getNameOrAlias(),
OpenSearchDataType.of(group.type())));
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
package org.opensearch.sql.opensearch.storage.script.core;

import static java.util.stream.Collectors.toMap;
import static org.opensearch.sql.data.type.ExprCoreType.DATE;
import static org.opensearch.sql.data.type.ExprCoreType.DATETIME;
import static org.opensearch.sql.data.type.ExprCoreType.FLOAT;
import static org.opensearch.sql.data.type.ExprCoreType.INTEGER;
import static org.opensearch.sql.data.type.ExprCoreType.TIME;
import static org.opensearch.sql.data.type.ExprCoreType.TIMESTAMP;

import java.security.AccessController;
import java.security.PrivilegedAction;
Expand All @@ -26,15 +22,13 @@
import lombok.EqualsAndHashCode;
import org.opensearch.index.fielddata.ScriptDocValues;
import org.opensearch.sql.data.model.ExprValue;
import org.opensearch.sql.data.type.ExprCoreType;
import org.opensearch.sql.data.type.ExprType;
import org.opensearch.sql.expression.Expression;
import org.opensearch.sql.expression.ExpressionNodeVisitor;
import org.opensearch.sql.expression.ReferenceExpression;
import org.opensearch.sql.expression.env.Environment;
import org.opensearch.sql.expression.parse.ParseExpression;
import org.opensearch.sql.opensearch.data.type.OpenSearchDataType;
import org.opensearch.sql.opensearch.data.type.OpenSearchDateType;
import org.opensearch.sql.opensearch.data.type.OpenSearchTextType;
import org.opensearch.sql.opensearch.data.value.OpenSearchExprValueFactory;

Expand Down Expand Up @@ -113,9 +107,7 @@ public Object visitParse(ParseExpression node, Set<ReferenceExpression> context)

private OpenSearchExprValueFactory buildValueFactory(Set<ReferenceExpression> fields) {
Map<String, OpenSearchDataType> typeEnv = fields.stream().collect(toMap(
ReferenceExpression::getAttr, e -> {
return OpenSearchDataType.of(e.type());
}));
ReferenceExpression::getAttr, e -> OpenSearchDataType.of(e.type())));
return new OpenSearchExprValueFactory(typeEnv);
}

Expand Down

0 comments on commit 1591a85

Please sign in to comment.