Skip to content

Commit

Permalink
change v2 tests now that it supports case insensitivy
Browse files Browse the repository at this point in the history
  • Loading branch information
albertobastos committed Jan 21, 2025
1 parent 1bece38 commit 29a9929
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ public void testCaseInsensitivityV1(boolean useMultiStageQueryEngine)
List<String> queries = new ArrayList<>();
baseQueries.forEach(q -> queries.add(q.replace("mytable", "MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));
baseQueries.forEach(
q -> queries.add(q.replace("mytable", "MYDB.MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));
q -> queries.add(q.replace("mytable", "DEFAULT.MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));

for (String query : queries) {
JsonNode response = postQuery(query);
Expand All @@ -2994,25 +2994,29 @@ public void testCaseSensitivityV2()
int daysSinceEpoch = 16138;
int hoursSinceEpoch = 16138 * 24;
int secondsSinceEpoch = 16138 * 24 * 60 * 60;
List<String> baseQueries = Arrays.asList("SELECT * FROM mytable",
"SELECT DaysSinceEpoch, timeConvert(DaysSinceEpoch,'DAYS','SECONDS') FROM mytable",
List<String> baseQueries = Arrays.asList("SELECT * FROM mytable limit 10000",
"SELECT DaysSinceEpoch, timeConvert(DaysSinceEpoch,'DAYS','SECONDS') FROM mytable limit 10000",
"SELECT DaysSinceEpoch, timeConvert(DaysSinceEpoch,'DAYS','SECONDS') FROM mytable order by DaysSinceEpoch "
+ "limit 10000",
"SELECT DaysSinceEpoch, timeConvert(DaysSinceEpoch,'DAYS','SECONDS') FROM mytable order by timeConvert"
+ "(DaysSinceEpoch,'DAYS','SECONDS') DESC limit 10000",
"SELECT count(*) FROM mytable WHERE DaysSinceEpoch = " + daysSinceEpoch,
"SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','HOURS') = " + hoursSinceEpoch,
"SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','SECONDS') = " + secondsSinceEpoch,
"SELECT MAX(timeConvert(DaysSinceEpoch,'DAYS','SECONDS')) FROM mytable",
"SELECT count(*) FROM mytable WHERE DaysSinceEpoch = " + daysSinceEpoch + " limit 10000",
"SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','HOURS') = " + hoursSinceEpoch
+ " limit 10000",
"SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','SECONDS') = " + secondsSinceEpoch
+ " limit 10000",
"SELECT MAX(timeConvert(DaysSinceEpoch,'DAYS','SECONDS')) FROM mytable limit 10000",
"SELECT COUNT(*) FROM mytable GROUP BY dateTimeConvert(DaysSinceEpoch,'1:DAYS:EPOCH','1:HOURS:EPOCH',"
+ "'1:HOURS')");
+ "'1:HOURS') limit 10000");
List<String> queries = new ArrayList<>();
baseQueries.forEach(q -> queries.add(q.replace("mytable", "MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));
baseQueries.forEach(
q -> queries.add(q.replace("mytable", "MYDB.MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));
q -> queries.add(q.replace("mytable", "DEFAULT.MYTABLE").replace("DaysSinceEpoch", "DAYSSinceEpOch")));

for (String query : queries) {
testQueryError(query, QueryException.QUERY_PLANNING_ERROR_CODE);
//testQueryError(query, QueryException.QUERY_PLANNING_ERROR_CODE);
JsonNode response = postQuery(query);
assertTrue(response.get("numSegmentsProcessed").asLong() >= 1L, "Query: " + query + " failed");
}
}

Expand Down Expand Up @@ -3099,10 +3103,11 @@ public void testCaseSensitivityWithColumnNameContainsTableNameV2()
q -> queries.add(q.replace("mytable", "MYTABLE").replace("DaysSinceEpoch", "MYTABLE.DAYSSinceEpOch")));
// something like "SELECT MYDB.MYTABLE.DAYSSinceEpOch from MYDB.MYTABLE where MYDB.MYTABLE.DAYSSinceEpOch = 16138"
baseQueries.forEach(
q -> queries.add(q.replace("mytable", "MYDB.MYTABLE").replace("DaysSinceEpoch", "MYTABLE.DAYSSinceEpOch")));
q -> queries.add(q.replace("mytable", "DEFAULT.MYTABLE").replace("DaysSinceEpoch", "MYTABLE.DAYSSinceEpOch")));

for (String query : queries) {
testQueryError(query, QueryException.QUERY_PLANNING_ERROR_CODE);
JsonNode response = postQuery(query);
assertTrue(response.get("numSegmentsProcessed").asLong() >= 1L, "Query: " + query + " failed");
}
}

Expand Down

0 comments on commit 29a9929

Please sign in to comment.