Skip to content

Commit

Permalink
Minor cleanup.
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Jan 30, 2025
1 parent 289dfa2 commit 028c183
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/opensearch/sql/analysis/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ public LogicalPlan visitFlatten(Flatten node, AnalysisContext context) {
if (fieldType != STRUCT) {
String msg =
StringUtils.format(
"Invalid field type '%s' for flatten command. Supported field types: '%s'.",
fieldType, STRUCT.typeName());
"Invalid field type for flatten command. Expected '%s' but got '%s'.",
STRUCT.typeName(), fieldType);
throw new IllegalArgumentException(msg);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public class FlattenOperator extends PhysicalPlan {
private final PhysicalPlan input;
private final ReferenceExpression field;

private static final String PATH_SEPARATOR = ".";
private static final Pattern PATH_SEPARATOR_PATTERN =
Pattern.compile(PATH_SEPARATOR, Pattern.LITERAL);
private static final Pattern PATH_SEPARATOR_PATTERN = Pattern.compile(".", Pattern.LITERAL);

@Override
public <R, C> R accept(PhysicalPlanNodeVisitor<R, C> visitor, C context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ void testInvalidType() {
assertThrows(IllegalArgumentException.class, () -> analyze(actualUnresolvedPlan))
.getMessage();
assertEquals(
"Invalid field type 'INTEGER' for flatten command. Supported field types: 'STRUCT'.",
actualMsg);
"Invalid field type for flatten command. Expected 'STRUCT' but got 'INTEGER'.", actualMsg);
}

@Test
Expand Down

0 comments on commit 028c183

Please sign in to comment.