Skip to content

Commit

Permalink
using set instead of list, apache#15482
Browse files Browse the repository at this point in the history
  • Loading branch information
Pankaj260100 committed Dec 19, 2023
1 parent 5de0f76 commit 1f289c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import org.apache.druid.common.config.NullHandling;
Expand Down Expand Up @@ -368,7 +369,7 @@ public void testParseNestedDataSchemaless() throws Exception
InputRow row = transformingReader.read().next();

Assert.assertEquals(
ImmutableList.of(
ImmutableSet.of(
"someOtherId",
"someIntColumn",
"isValid",
Expand All @@ -381,7 +382,7 @@ public void testParseNestedDataSchemaless() throws Exception
"id",
"someBytesColumn"
),
row.getDimensions()
ImmutableSet.copyOf(row.getDimensions())
);

Assert.assertEquals(ImmutableMap.of("bar", "baz"), row.getRaw("foo"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,15 @@ private void validateParser(
}
final Expr.BindingAnalysis deets = parsed.analyzeInputs();
Assert.assertEquals(expression, expected, parsed.toString());
Assert.assertEquals(expression, identifiers, deets.getRequiredBindingsList());
Assert.assertEquals(expression, ImmutableSet.copyOf(identifiers), ImmutableSet.copyOf(deets.getRequiredBindingsList()));
Assert.assertEquals(expression, scalars, deets.getScalarVariables());
Assert.assertEquals(expression, arrays, deets.getArrayVariables());

final Expr parsedNoFlatten = Parser.parse(expression, ExprMacroTable.nil(), false);
final Expr roundTrip = Parser.parse(parsedNoFlatten.stringify(), ExprMacroTable.nil());
Assert.assertEquals(parsed.stringify(), roundTrip.stringify());
final Expr.BindingAnalysis roundTripDeets = roundTrip.analyzeInputs();
Assert.assertEquals(expression, identifiers, roundTripDeets.getRequiredBindingsList());
Assert.assertEquals(expression, ImmutableSet.copyOf(identifiers), ImmutableSet.copyOf(roundTripDeets.getRequiredBindingsList()));
Assert.assertEquals(expression, scalars, roundTripDeets.getScalarVariables());
Assert.assertEquals(expression, arrays, roundTripDeets.getArrayVariables());
}
Expand Down

0 comments on commit 1f289c9

Please sign in to comment.