-
Notifications
You must be signed in to change notification settings - Fork 16
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
List tables command #1510
List tables command #1510
Conversation
…needed because tables need multiple vector config.
…TOR_EMBEDDING_TEXT_FIELD`
…TOR_EMBEDDING_TEXT_FIELD`
…TOR_EMBEDDING_TEXT_FIELD`
…ct-multiple-vectorize
…te/data-api into schema-outject-multiple-vectorize
…needed because tables need multiple vector config.
.../java/io/stargate/sgv2/jsonapi/api/model/command/table/definition/datatype/ComplexTypes.java
Outdated
Show resolved
Hide resolved
.../java/io/stargate/sgv2/jsonapi/api/model/command/table/definition/datatype/ComplexTypes.java
Outdated
Show resolved
Hide resolved
...in/java/io/stargate/sgv2/jsonapi/api/model/command/table/definition/datatype/ColumnType.java
Show resolved
Hide resolved
...n/java/io/stargate/sgv2/jsonapi/api/model/command/serializer/ColumnDefinitionSerializer.java
Show resolved
Hide resolved
jsonGenerator.writeEndObject(); | ||
} | ||
|
||
public record ApiSupport( |
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.
Could/should this be private
?
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.
... or, should the 2 separate definitions be combined?
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.
Made to private
for now. But this will evolve as we analyze how different unsuported format are handled.
src/main/java/io/stargate/sgv2/jsonapi/api/model/command/serializer/OrderingKeySerializer.java
Outdated
Show resolved
Hide resolved
...in/java/io/stargate/sgv2/jsonapi/api/model/command/table/definition/datatype/ColumnType.java
Outdated
Show resolved
Hide resolved
|
||
/** Interface for primitive column types similar to what is defined in cassandra java driver. */ | ||
public class PrimitiveTypes { | ||
public enum PrimitiveTypes implements ColumnType { |
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.
Nice simplification by changing to Enum!
...ava/io/stargate/sgv2/jsonapi/api/model/command/table/definition/datatype/PrimitiveTypes.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/TableSchemaObject.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/TableSchemaObject.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/TableSchemaObject.java
Outdated
Show resolved
Hide resolved
columnVectorDefinition.vectorizeConfig().modelName(), | ||
columnVectorDefinition.vectorizeConfig().authentication(), | ||
columnVectorDefinition.vectorizeConfig().parameters()); | ||
return new ComplexTypes.VectorType(PrimitiveTypes.FLOAT, vt.getDimensions(), vectorizeConfig); |
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.
Should we do any verification wrt vector being of "Float" type? I know we currently only support that, but is there any benefit from future-proofing?
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.
I left this to have a format hardcoded since cql driver has it. If and when cassandra adds support for other type, We can enable it with minimal changes and exposing it in api request.
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/TableSchemaObject.java
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/service/operation/tables/ListTablesOperation.java
Outdated
Show resolved
Hide resolved
src/test/java/io/stargate/sgv2/jsonapi/api/v1/tables/ListTablesIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/stargate/sgv2/jsonapi/api/v1/tables/ListTablesIntegrationTest.java
Show resolved
Hide resolved
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.
Looks mostly good, but did have some notes on CqlIdentifier
handling, integration tests that I'd like clarified.
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.
LGTM
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.
I would have -1 this PR, it needs changes to use the OperationAttempt model and there are a number of code quality issues.
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType; | ||
import org.eclipse.microprofile.openapi.annotations.media.Schema; | ||
|
||
@Schema(description = "Command that lists all available tables in a namespace.") |
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.
This should say keyspace not namespace
public record ListTablesCommand(Options options) implements TableOnlyCommand { | ||
public record Options( | ||
@Schema( | ||
description = "include table properties.", |
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.
typo: "include" to "Include" also this is not the most descriptive.
is this more truthful ? "When True the schema for the table is returned, when false just the table name"
* @param read | ||
* @param cqlDefinition | ||
*/ | ||
private record ApiSupport( |
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.
why is this record here and in ColumnDefinitionSerializer ?
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.
I have added a comment in there, this is just a place holder object to generate apiSupport
for unsupported columns, This needs to be analyzed for what operation can be supported for unsupported types.
@@ -16,9 +19,15 @@ | |||
// implementation = Object.class, | |||
// description = "Represents the table primary key") |
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.
can we remove the commented out lines now ?
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.
Eventually these are needed when we go public, why remove them?
default String getApiName() { | ||
return getApiDataType().getApiName(); | ||
} | ||
|
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.
why does this list getSupportedTypes() exist seperate to the definitions of the data types we have else where ?
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.
There is no consolidated place to get all supported data types. Error messages needs to be revisited, May be not a good idea to return list of supported types.
@@ -115,4 +128,121 @@ public static TableSchemaObject from(TableMetadata tableMetadata, ObjectMapper o | |||
} | |||
return new TableSchemaObject(tableMetadata, vectorConfig); | |||
} | |||
|
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.
there are a number of things to imprve in the from() function #1521
* @param tableMatcher {@link CollectionTableMatcher} | ||
* @param commandContext {@link CommandContext} | ||
*/ | ||
public record ListTablesOperation( |
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.
pls use a class, cut back on records unless they are basic pojo objects
// below ? | ||
private static final CollectionTableMatcher TABLE_MATCHER = new CollectionTableMatcher(); | ||
|
||
public ListTablesOperation( |
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.
Why dont we use the GenericOperation and OperationAttempt ?
if (keyspaceMetadata == null) { | ||
return Uni.createFrom() | ||
.failure( | ||
ErrorCodeV1.KEYSPACE_DOES_NOT_EXIST.toApiException( |
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.
no v1 error code in the table work
/** {@inheritDoc} */ | ||
@Override | ||
public Operation resolveKeyspaceCommand( | ||
CommandContext<KeyspaceSchemaObject> ctx, ListTablesCommand command) { |
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.
This should be using the OperationAttempt model
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.
We didn't have a cql command executed in here, so did not use the OperationAttempt model.
What this PR does:
Which issue(s) this PR fixes:
Fixes #1500
Checklist