[Table Model] Schema Validation Interface#12707
[Table Model] Schema Validation Interface#12707JackieTien97 merged 4 commits intoapache:ty/TableModelGrammarfrom
Conversation
| * This class acts as a request for device schema validation and defines the necessary information | ||
| * interfaces. | ||
| */ | ||
| public interface ITableDeviceSchemaValidation { |
There was a problem hiding this comment.
add java doc for each method and examples
|
|
||
| List<String> getAttributeColumnNameList(); | ||
|
|
||
| List<List<String>> getAttributeValue(); |
There was a problem hiding this comment.
column-based or row-based?
There was a problem hiding this comment.
List<Object[]> will be better? If we extend attribute columns to allow other types.
|
|
||
| String getTableName(); | ||
|
|
||
| List<String[]> getDeviceIdList(); |
There was a problem hiding this comment.
column-based or row-based?
There was a problem hiding this comment.
List<Object[]> will be better? If we extend idcolumns to allow other types.
There was a problem hiding this comment.
Row-based. Already update the interface.
| * <p>When the input dataType or category of one column is null, the column cannot be auto | ||
| * created. | ||
| */ | ||
| TableSchema validateTableHeaderSchema( |
There was a problem hiding this comment.
What if auto create is false? So I think should return Optional, if we cannot auto craete this table we just return Optinal.empty()
There was a problem hiding this comment.
what if schema validation failed? dataType miss match? throw what kind of exception?
There was a problem hiding this comment.
Throw SemanticException
| * <p>When device attribute is missing or different from that stored in IoTDB, the attribute will | ||
| * be auto upsert. | ||
| */ | ||
| void validateDeviceSchema(ITableDeviceSchemaValidation schemaValidation, MPPQueryContext context); |
There was a problem hiding this comment.
think about partial insert, how to return info to caller about:
- auto create failed(because auto_create is false or other reasons like exceed device limit)
- auto create succeed or this device already exists before.
There was a problem hiding this comment.
First, We haven't define what is "partial insert" in table model. Device level or series level? Second, to support partial insert, another interface "markFailed(int index)" shall be added to the ITableDeviceSchemaValidation and will be recalled during validation process.
For "auto create succeed or this device already exists before", no exception or info should be return in current stage. Id column data type may be should be returned if we support device id values with different data type.
There was a problem hiding this comment.
After confirmation with @jt2594838 and @qiaojialin , auto create won't affect device creation, so the creation for device won't failed because of auto_create is false, but there may be other reasons.
If your current implementation will throw some specific exception if any device creation failed, it's ok but you need add that exception in java doc and make your interface more clear.
jt2594838
left a comment
There was a problem hiding this comment.
Please resolve the problems @JackieTien97 has mentioned.
Description
Setup schema validation interfaces, including table schema validation and device schema validation.