Repository navigation
Christmas #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Christmas #27
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
29918fa
Sending the json header
e4c5 e937356
Query formatting
e4c5 6ccec50
logger improvements
e4c5 947bb30
QueryOptimizer optimization
e4c5 b73e1e2
Add indexes for the joins
e4c5 cb579cb
Merge branch 'main' into christmas
e4c5 c8f73f7
This file was in the wrong place
e4c5 28a1734
Stats logging improvements
e4c5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,8 @@ | ||||||||||
| package sa.com.cloudsolutions.antikythera.examples; | ||||||||||
|
|
||||||||||
| import org.slf4j.Logger; | ||||||||||
| import org.slf4j.LoggerFactory; | ||||||||||
|
|
||||||||||
| import java.io.FileWriter; | ||||||||||
| import java.io.IOException; | ||||||||||
| import java.io.PrintStream; | ||||||||||
|
|
@@ -14,8 +17,9 @@ | |||||||||
| * the changes made to repository classes. | ||||||||||
| */ | ||||||||||
| public class OptimizationStatsLogger { | ||||||||||
| private static final Logger logger = LoggerFactory.getLogger(OptimizationStatsLogger.class); | ||||||||||
| private static final String CSV_FILENAME = "query-optimization-stats.csv"; | ||||||||||
| private static final String CSV_HEADER = "Date,Repositories,Queries,Annotations Changed,Signatures Changed,Calls Updated,Dependency Classes,Indexes Created, Indexes Dropped"; | ||||||||||
| private static final String CSV_HEADER = "Date,Repository Name,Queries,Annotations Changed,Signatures Changed,Calls Updated,Dependency Classes,Indexes Created,Indexes Dropped"; | ||||||||||
| private static Stats current = null; | ||||||||||
| private static Stats total; | ||||||||||
|
|
||||||||||
|
|
@@ -40,7 +44,11 @@ public static class Stats { | |||||||||
| */ | ||||||||||
| private int methodCallsChanged = 0; | ||||||||||
| /** | ||||||||||
| * The number of classes changed so far! | ||||||||||
| * The number of repository files that were actually modified. | ||||||||||
| */ | ||||||||||
| private int repositoriesModified = 0; | ||||||||||
| /** | ||||||||||
| * The number of dependent classes changed (not including repositories). | ||||||||||
| */ | ||||||||||
| private int dependentClassesModified = 0; | ||||||||||
| /** | ||||||||||
|
|
@@ -68,34 +76,59 @@ public static Stats getCurrent() { | |||||||||
| return current; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void initialize(String repo) throws IOException { | ||||||||||
| Path csvPath = Paths.get(CSV_FILENAME); | ||||||||||
| FileWriter fw = new FileWriter(CSV_FILENAME, true); | ||||||||||
| PrintWriter out = new PrintWriter(fw); | ||||||||||
|
|
||||||||||
| if (!csvPath.toFile().exists()) { | ||||||||||
| out.println(CSV_HEADER); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void initialize(String repo) { | ||||||||||
| if (current == null) { | ||||||||||
| current = new Stats(repo); | ||||||||||
| total = new Stats(""); | ||||||||||
| } else { | ||||||||||
| flush(); | ||||||||||
| current = new Stats(repo); | ||||||||||
| } | ||||||||||
| totalRepositoriesProcessed++; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void flush() { | ||||||||||
| if (current == null) { | ||||||||||
| return; | ||||||||||
| } | ||||||||||
| logStats(current); | ||||||||||
| // Reset current stats to zero for any post-analysis global updates, | ||||||||||
| // but preserve the repo name to avoid NullPointerException if used. | ||||||||||
| current.queriesAnalyzed = 0; | ||||||||||
| current.queryAnnotationsChanged = 0; | ||||||||||
| current.methodSignaturesChanged = 0; | ||||||||||
| current.methodCallsChanged = 0; | ||||||||||
| current.repositoriesModified = 0; | ||||||||||
| current.dependentClassesModified = 0; | ||||||||||
| current.liquibaseIndexesGenerated = 0; | ||||||||||
| current.liquibaseIndexesDropped = 0; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| private static void logStats(Stats stats) { | ||||||||||
| Path csvPath = Paths.get(CSV_FILENAME); | ||||||||||
| boolean exists = csvPath.toFile().exists(); | ||||||||||
|
|
||||||||||
| try (FileWriter fw = new FileWriter(CSV_FILENAME, true); | ||||||||||
| PrintWriter out = new PrintWriter(fw)) { | ||||||||||
|
|
||||||||||
| if (!exists) { | ||||||||||
| out.println(CSV_HEADER); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| out.println(String.format("%s,%s,%d,%d,%d,%d,%d,%d,%d", | ||||||||||
| java.time.LocalDate.now(), | ||||||||||
| current.repo, | ||||||||||
| current.queriesAnalyzed, | ||||||||||
| current.queryAnnotationsChanged, | ||||||||||
| current.methodSignaturesChanged, | ||||||||||
| current.methodCallsChanged, | ||||||||||
| current.dependentClassesModified, | ||||||||||
| current.liquibaseIndexesGenerated, | ||||||||||
| current.liquibaseIndexesDropped)); | ||||||||||
| current = new Stats(repo); | ||||||||||
| totalRepositoriesProcessed++; | ||||||||||
| stats.repo, | ||||||||||
| stats.queriesAnalyzed, | ||||||||||
| stats.queryAnnotationsChanged, | ||||||||||
| stats.methodSignaturesChanged, | ||||||||||
| stats.methodCallsChanged, | ||||||||||
| stats.dependentClassesModified, | ||||||||||
| stats.liquibaseIndexesGenerated, | ||||||||||
| stats.liquibaseIndexesDropped)); | ||||||||||
| } catch (IOException e) { | ||||||||||
| logger.error("Failed to write to CSV: {}", e.getMessage()); | ||||||||||
| } | ||||||||||
| out.close(); | ||||||||||
| fw.close(); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void updateQueriesAnalyzed(int queriesAnalyzed) { | ||||||||||
|
|
@@ -118,6 +151,11 @@ public static void updateMethodCallsChanged(int i) { | |||||||||
| total.methodCallsChanged += i; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static void updateRepositoriesModified(int i) { | ||||||||||
| current.repositoriesModified += i; | ||||||||||
|
||||||||||
| current.repositoriesModified += i; | |
| if (current != null) { | |
| current.repositoriesModified += i; | |
| } |
e4c5 marked this conversation as resolved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Gemini 1.5 Flash responseMimeType responseSchema structured JSON output support💡 Result:
Short answer: Yes — the Gemini API supports structured JSON outputs via response_mime_type = "application/json" plus a response_json_schema/responseSchema, but Gemini 1.5 Flash has limited/spotty behavior and some JSON‑Schema keywords (and array constraints like maxItems) have caused failures; Google recommends using the newer Gemini 2.5 models for full, reliable JSON Schema structured-output support.
Sources:
If you want, I can: (a) draft an example generation request for gemini-1.5-flash (with a fallback strategy), or (b) show the same example targeting gemini-2.5-flash which is recommended for robust JSON Schema support. Which do you prefer?
🏁 Script executed:
Repository: e4c5/antikythera-examples
Length of output: 141
Upgrade model to Gemini 2.5 for reliable JSON Schema support.
Gemini 1.5 Flash has spotty and limited support for structured JSON output via
responseMimeTypeandresponseSchema. Per official Google documentation, Gemini 2.5 models are recommended for robust JSON Schema support. Consider updating the model fromgemini-1.5-flash(line 258) togemini-2.5-flashto ensure reliable structured output handling.🤖 Prompt for AI Agents