Copilot commented on code in PR #19090:
URL: https://github.com/apache/pinot/pull/19090#discussion_r3654108255
##########
pinot-tools/src/main/java/org/apache/pinot/tools/Quickstart.java:
##########
@@ -110,48 +146,120 @@ true, getAuthProvider(),
QuickstartRunner.DEFAULT_CONTROLLER_PORT));
}
+ /**
+ * Three servers so that the multi-stage sample queries below actually
exercise a cross-server exchange, which is
+ * what the merged MULTI_STAGE and JOIN quickstarts used to set up.
+ */
protected int getNumQuickstartRunnerServers() {
- return 1;
+ return 3;
}
Review Comment:
Changing Quickstart's default to 3 servers affects every quickstart that
subclasses Quickstart (e.g., GeoSpatialQuickStart, NullHandlingQuickstart,
etc.), not just `-type BATCH` as described; this increases resource usage and
can change behavior for those types.
##########
pinot-tools/src/main/java/org/apache/pinot/tools/RealtimeQuickStart.java:
##########
@@ -48,71 +67,126 @@ public static void main(String[] args)
@Override
protected Map<String, Object> getConfigOverrides() {
- Map<String, Object> configOverrides = new HashMap<>();
+ Map<String, Object> configOverrides = new
HashMap<>(super.getConfigOverrides());
configOverrides.put(CommonConstants.Server.CONFIG_OF_ENABLE_THREAD_CPU_TIME_MEASUREMENT,
true);
return configOverrides;
}
@Override
public void runSampleQueries(QuickstartRunner runner)
throws Exception {
- String q1 = "select count(*) from meetupRsvp limit 1";
- printStatus(Color.YELLOW, "Total number of documents in the table");
- printStatus(Color.CYAN, "Query : " + q1);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q1)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q2 =
- "select group_city, sum(rsvp_count) from meetupRsvp group by
group_city order by sum(rsvp_count) desc limit 10";
- printStatus(Color.YELLOW, "Top 10 cities with the most rsvp");
- printStatus(Color.CYAN, "Query : " + q2);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q2)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q3 = "select * from meetupRsvp order by mtime limit 10";
- printStatus(Color.YELLOW, "Show 10 most recent rsvps");
- printStatus(Color.CYAN, "Query : " + q3);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q3)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q4 =
- "select event_name, sum(rsvp_count) from meetupRsvp group by
event_name order by sum(rsvp_count) desc limit 10";
- printStatus(Color.YELLOW, "Show top 10 rsvp'ed events");
- printStatus(Color.CYAN, "Query : " + q4);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q4)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q5 = "select count(*) from meetupRsvp limit 1";
- printStatus(Color.YELLOW, "Total number of documents in the table");
- printStatus(Color.CYAN, "Query : " + q5);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q5)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q6 = "select count(*) from fineFoodReviews";
- printStatus(Color.YELLOW, "Total number of documents in fineFoodReviews");
- printStatus(Color.CYAN, "Query : " + q6);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q6)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q7 = "select count(*) from \"fineFoodReviews-federated\"";
- printStatus(Color.YELLOW, "Total number of documents in
fineFoodReviews-federated");
- printStatus(Color.CYAN, "Query : " + q7);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q7)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q8 = "select count(*) from \"fineFoodReviews_part_0\"";
- printStatus(Color.YELLOW, "Total number of documents in
fineFoodReviews_part_0");
- printStatus(Color.CYAN, "Query : " + q8);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q8)));
- printStatus(Color.GREEN,
"***************************************************");
-
- String q9 = "select count(*) from \"fineFoodReviews_part_1\"";
- printStatus(Color.YELLOW, "Total number of documents in
fineFoodReviews_part_1");
- printStatus(Color.CYAN, "Query : " + q9);
- printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q9)));
- printStatus(Color.GREEN,
"***************************************************");
-
- runVectorQueryExamples(runner);
+ runMeetupRsvpQueries(runner);
+ runJsonIndexQueries(runner);
+ runComplexTypeQueries(runner);
+ runUpsertQueries(runner);
+ runUpsertJsonIndexQueries(runner);
+ runPartialUpsertQueries(runner);
+ runFineFoodReviewsQueries(runner);
+ if (hasTables("fineFoodReviews")) {
+ runVectorQueryExamples(runner);
+ }
+ }
+
+ private void runMeetupRsvpQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("meetupRsvp")) {
+ return;
+ }
+ printStatus(Color.YELLOW, "***** Meetup RSVPs *****");
+ runAndPrintQuery(runner, "Total number of documents in the table", "select
count(*) from meetupRsvp limit 1");
+ runAndPrintQuery(runner, "Top 10 cities with the most rsvp", "select
group_city, sum(rsvp_count) from meetupRsvp "
+ + "group by group_city order by sum(rsvp_count) desc limit 10");
+ runAndPrintQuery(runner, "Show 10 most recent rsvps", "select * from
meetupRsvp order by mtime limit 10");
+ runAndPrintQuery(runner, "Show top 10 rsvp'ed events", "select event_name,
sum(rsvp_count) from meetupRsvp "
+ + "group by event_name order by sum(rsvp_count) desc limit 10");
+ }
+
+ private void runJsonIndexQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("meetupRsvpJson")) {
+ return;
+ }
+ printStatus(Color.YELLOW, "***** JSON index *****");
+ runAndPrintQuery(runner, "Events related to topic_name0",
+ "select json_extract_scalar(event_json, '$.event_name', 'STRING') from
meetupRsvpJson where json_match"
+ + "(group_json,
'\"$.group_topics[*].topic_name\"=''topic_name0''') limit 10");
+ }
+
+ private void runComplexTypeQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("meetupRsvpComplexType")) {
+ return;
+ }
+ printStatus(Color.YELLOW, "***** Complex type handling *****");
+ runAndPrintQuery(runner, "Flattened group topics",
+ "select \"group.group_topics.urlkey\",
\"group.group_topics.topic_name\", \"group.group_id\" from "
+ + "meetupRsvpComplexType limit 10");
+ }
+
+ private void runUpsertQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("upsertMeetupRsvp")) {
+ return;
+ }
+ printStatus(Color.YELLOW, "***** Upsert *****");
+ printStatus(Color.YELLOW, "***** The expected number of documents per
event_id is 1 *****");
+ runAndPrintQuery(runner, "Total number of documents per event_id in the
table",
+ "select event_id, count(*) from upsertMeetupRsvp group by event_id
limit 10");
+ }
+
+ private void runUpsertJsonIndexQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("upsertJsonMeetupRsvp")) {
+ return;
+ }
+ printStatus(Color.YELLOW, "***** Upsert with JSON index *****");
+ runAndPrintQuery(runner, "Events related to topic_name0",
+ "select json_extract_scalar(event_json, '$.event_name', 'STRING') from
upsertJsonMeetupRsvp where json_match"
+ + "(group_json,
'\"$.group_topics[*].topic_name\"=''topic_name0''') limit 10");
+ }
+
+ private void runPartialUpsertQueries(QuickstartRunner runner)
+ throws Exception {
+ if (!hasTables("upsertPartialMeetupRsvp")) {
+ return;
+ }
+ // The expected behavior for total number of documents per PK should be 1.
+ // The expected behavior for total number of rsvp_counts per PK should >=1
since it's incremented and updated.
+ // The expected behavior for nums of values in group_name fields should
equals to rsvp_counts.
+ printStatus(Color.YELLOW, "***** Partial upsert *****");
+ printStatus(Color.YELLOW, "***** The expected behavior for total number of
documents per PK should be 1 *****");
+ printStatus(Color.YELLOW,
+ "***** The expected behavior for total number of rsvp_counts per PK
should >=1 since it's incremented and "
+ + "updated. *****");
+ printStatus(Color.YELLOW,
+ "***** The expected behavior for nums of values in group_name fields
should equals to rsvp_counts. *****");
+ runAndPrintQuery(runner, "Total number of documents, total number of
rsvp_counts per event_id in the table",
+ "select event_id, count(*), sum(rsvp_count) from
upsertPartialMeetupRsvp group by event_id order by sum"
+ + "(rsvp_count) desc limit 10");
+
+ printStatus(Color.YELLOW,
+ "***** Nums of values in group_name fields should less than or equals
to rsvp_count. Duplicate records are "
+ + "not allowed. *****");
+ printStatus(Color.YELLOW,
+ "***** Nums of values in renue_name fields should equals to
rsvp_count. Duplicates are allowed. *****");
Review Comment:
Typo in log message: "renue_name" should be "venue_name".
This issue also appears on line 172 of the same file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]