You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/09/04 19:19:16 UTC
[GitHub] [incubator-pinot] jackjlli opened a new pull request #5984: Add row based schema validation code to detect schema mismatch
jackjlli opened a new pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984
## Description
This PR adds row based schema validation code to detect schema mismatch.
This validation will capture the schema mismatch on row basis, so that we don't miss any cases when converting the raw data to pinot data.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
mayankshriv commented on a change in pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#discussion_r485309751
##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -586,22 +586,32 @@ public boolean isSingleValue() {
public PinotDataType getSingleValueType() {
switch (this) {
+ case BYTE:
Review comment:
If this PR is just adding a check, why does it need to modify the functionality?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] jackjlli commented on pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
jackjlli commented on pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#issuecomment-689274482
Most of the cases can be covered by validating pinot schema and avro schema. One tricky thing is that when all the fields are required to be fetched, we convert the avro generic record to string first, then parse it as a json:
https://github.com/apache/incubator-pinot/blob/d54b04a2562f86dfb3adaa02ff400951d8108738/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java#L49
```
/**
* Converts from a GenericRecord to a json map
*/
public static Map<String, Object> genericRecordToJson(GenericRecord genericRecord) {
try {
String jsonString = genericRecord.toString();
return DEFAULT_MAPPER.readValue(jsonString, new TypeReference<Map<String, Object>>() {
});
} catch (IOException e) {
throw new IllegalStateException("Caught exception when converting generic record " + genericRecord + " to JSON");
}
}
```
The data type of the value from the k-v pair might get changed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] mayankshriv commented on pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
mayankshriv commented on pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#issuecomment-689270729
@jackjlli Could you describe the case which is not caught by schema level check?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] jackjlli closed pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
jackjlli closed pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] jackjlli commented on a change in pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
jackjlli commented on a change in pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#discussion_r485312383
##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -586,22 +586,32 @@ public boolean isSingleValue() {
public PinotDataType getSingleValueType() {
switch (this) {
+ case BYTE:
Review comment:
This change is to get the single value type for single value type. This method should return the same single value type for single value type itself.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] Jackie-Jiang commented on pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#issuecomment-689836238
> Most of the cases can be covered by validating pinot schema and avro schema. One tricky thing is that when all the fields are required to be fetched, we convert the avro generic record to string first, then parse it as a json:
> https://github.com/apache/incubator-pinot/blob/d54b04a2562f86dfb3adaa02ff400951d8108738/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java#L49
>
> ```
> /**
> * Converts from a GenericRecord to a json map
> */
> public static Map<String, Object> genericRecordToJson(GenericRecord genericRecord) {
> try {
> String jsonString = genericRecord.toString();
> return DEFAULT_MAPPER.readValue(jsonString, new TypeReference<Map<String, Object>>() {
> });
> } catch (IOException e) {
> throw new IllegalStateException("Caught exception when converting generic record " + genericRecord + " to JSON");
> }
> }
> ```
>
> The data type of the value from the k-v pair might get changed.
I don't think we ever init record extractor without the fields. Also, converting to string then serializing as json doesn't seem correct. We should fix that instead of adding the row based validation.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] Jackie-Jiang commented on pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#issuecomment-689256109
High level question, do we really need row level validation? What is the overhead of this validation?
Seems like the validation only applies to the Avro reader. In that case, validating Pinot schema and Avro schema should be enough. IMO we are paying a lot of overhead for very little gain.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] jackjlli commented on pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
jackjlli commented on pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#issuecomment-785333799
This PR can be closed as we've already had the schema validation in another PR(https://github.com/apache/incubator-pinot/pull/5873).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] jackjlli commented on a change in pull request #5984: Add row based schema validation code to detect schema mismatch
Posted by GitBox <gi...@apache.org>.
jackjlli commented on a change in pull request #5984:
URL: https://github.com/apache/incubator-pinot/pull/5984#discussion_r485313915
##########
File path: pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
##########
@@ -586,22 +586,32 @@ public boolean isSingleValue() {
public PinotDataType getSingleValueType() {
switch (this) {
+ case BYTE:
Review comment:
And this method would be called in https://github.com/apache/incubator-pinot/blob/2cfaed37cf581362b87a36e924cdd5744d430e03/pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java#L112
If the single value type between source and dest are the same, the data type are the same. E.g. if source is string_array and dest is string, the data type is the same, even though we should mark the flag of `single-value multi-value mismatch`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org