Skip to content

Bring json and vector functions from sqrl project #77

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
merged 2 commits into from
Apr 21, 2025
Merged

Bring json and vector functions from sqrl project #77

merged 2 commits into from
Apr 21, 2025

Conversation

velo
Copy link
Collaborator

@velo velo commented Apr 21, 2025

No description provided.

@velo velo requested a review from Copilot April 21, 2025 13:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request brings a set of JSON functions and corresponding utilities from the sqrl project into the codebase, as well as introduces a PostgreSQL vector type serializer.

  • Introduces new JSON functions and aggregators (e.g., ObjectAgg, JsonToString, JsonQuery, JsonObject, JsonExtract, JsonArrayAgg, and JsonArray).
  • Implements a new PostgreSQL vector type serializer and extends JDBC testing to verify the updated functionality.

Reviewed Changes

Copilot reviewed 29 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
types/json-type/src/main/java/com/datasqrl/types/json/functions/ObjectAgg.java New aggregation class for JSON objects.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonToString.java New function converting JSON to string (note the included FIXME comment).
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonQuery.java New JSON query function using JsonPath.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonObjectAgg.java Aggregation of JSON objects into one.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonObject.java Function to create JSON objects from key-value pairs.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonFunctions.java Static holder class for JSON functions.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonExtract.java Provides different overloads to extract JSON values with default returns.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonExists.java Checks if a given JSON path exists in a JSON object.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonConcat.java Merges two JSON objects into one.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonArrayAgg.java Aggregates JSON elements into an array.
types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonArray.java Creates a JSON array from arbitrary objects, including JSON types.
types/json-type/src/main/java/com/datasqrl/types/json/functions/ArrayAgg.java Implements a helper class for aggregation operations.
connectors/postgresql-connector/src/test/java/com/datasqrl/connector/postgresql/jdbc/FlinkJdbcTest.java Tests to verify JSON and vector function integration with PostgreSQL via JDBC.
connectors/postgresql-connector/src/main/java/com/datasqrl/connector/postgresql/type/PostgresVectorTypeSerializer.java New serializer implementation for handling vector types with PostgreSQL.
Files not reviewed (5)
  • connectors/postgresql-connector/pom.xml: Language not supported
  • connectors/postgresql-connector/src/main/resources/META-INF/services/com.datasqrl.connector.postgresql.type.JdbcTypeSerializer: Language not supported
  • pom.xml: Language not supported
  • testing/system-functions-sample/pom.xml: Language not supported
  • types/json-type/pom.xml: Language not supported
Comments suppressed due to low confidence (2)

types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonToString.java:25

  • The FIXME comment indicates unresolved behavior regarding the sqrl cast. Consider addressing the cast functionality by either implementing the missing interface or clarifying the intended behavior.
public class JsonToString extends ScalarFunction implements /* FIXME what to do about the sqrl cast? SqrlCastFunction, */ AutoRegisterSystemFunction {

types/json-type/src/main/java/com/datasqrl/types/json/functions/JsonObject.java:59

  • [nitpick] There is an inconsistency in accessing the JSON content; elsewhere the getter method (getJson()) is used. For better consistency and maintainability, consider using the accessor method uniformly.
objectNode.put(key, type.json);

velo added 2 commits April 21, 2025 10:08
Signed-off-by: Marvin Froeder <marvin@datasqrl.com>
Signed-off-by: Marvin Froeder <marvin@datasqrl.com>
@velo velo merged commit b5e4740 into main Apr 21, 2025
3 checks passed
@velo velo deleted the vector branch April 21, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant