Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Adding additional logging to ExprMissingValue exception #973

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BindingTuple {
* @return binding value.
*/
public ExprValue resolve(String bindingName) {
return bindingMap.getOrDefault(bindingName, new ExprMissingValue());
return bindingMap.getOrDefault(bindingName, new ExprMissingValue(bindingName, bindingMap.keySet()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@

package com.amazon.opendistroforelasticsearch.sql.legacy.expression.model;

import java.util.Set;

/**
* The definition of the missing value.
*/
public class ExprMissingValue implements ExprValue {
private final String missingValue;
penghuo marked this conversation as resolved.
Show resolved Hide resolved
private final Set<String> availableValues;

public ExprMissingValue(String missingValue, Set<String> availableValues) {
this.missingValue = missingValue;
this.availableValues = availableValues;
}

@Override
public Object value() {
throw new IllegalStateException("invalid value operation on " + kind() + " (" + this.missingValue + "), available: " + this.availableValues.toString());
}

@Override
public ExprValueKind kind() {
return ExprValueKind.MISSING_VALUE;
Expand Down