Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -395,6 +395,13 @@ private static DataType getDataType(Expression expression, Schema schema) {
String targetTypeLiteral =
expression.getFunctionCall().getOperands().get(1).getLiteral().getStringValue().toUpperCase();
DataType dataType;

// Strip out _ARRAY suffix that can be used to represent an MV field type since the semantics here will be the
// same as that for the equivalent SV field of the same type
if (targetTypeLiteral.endsWith("_ARRAY")) {
targetTypeLiteral = targetTypeLiteral.substring(0, targetTypeLiteral.length() - 6);
}

if ("INTEGER".equals(targetTypeLiteral)) {
dataType = DataType.INT;
} else if ("VARCHAR".equals(targetTypeLiteral)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,14 @@ public void testSearch()
assertNoError(jsonNode);
}

@Test
public void testMVNumericCastInFilter() throws Exception {
String sqlQuery = "SELECT COUNT(*) FROM mytable WHERE arrayToMV(CAST(DivAirportIDs AS BIGINT ARRAY)) > 0";
JsonNode jsonNode = postQuery(sqlQuery);
assertNoError(jsonNode);
assertEquals(jsonNode.get("resultTable").get("rows").get(0).get(0).asInt(), 15482);
}

@Override
protected String getTableName() {
return _tableName;
Expand Down