This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new c1a43aa Add context on data type transform failure (#6658)
c1a43aa is described below
commit c1a43aa6c74b9638f7c2d6252030fab236a59870
Author: Daniel Lavoie <[email protected]>
AuthorDate: Mon Mar 8 19:56:40 2021 -0500
Add context on data type transform failure (#6658)
Bubbles up the column name on failure when generating segments with invalid
schema.
---
.../recordtransformer/DataTypeTransformer.java | 62 ++++++++++++----------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java
b/pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java
index 4ab665c..ee2f5bc 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/data/recordtransformer/DataTypeTransformer.java
@@ -80,39 +80,43 @@ public class DataTypeTransformer implements
RecordTransformer {
public GenericRow transform(GenericRow record) {
for (Map.Entry<String, PinotDataType> entry : _dataTypes.entrySet()) {
String column = entry.getKey();
- Object value = record.getValue(column);
- if (value == null) {
- continue;
- }
- PinotDataType dest = entry.getValue();
- value = standardize(column, value, dest.isSingleValue());
- // NOTE: The standardized value could be null for empty
Collection/Map/Object[].
- if (value == null) {
- record.putValue(column, null);
- continue;
- }
+ try {
+ Object value = record.getValue(column);
+ if (value == null) {
+ continue;
+ }
+ PinotDataType dest = entry.getValue();
+ value = standardize(column, value, dest.isSingleValue());
+ // NOTE: The standardized value could be null for empty
Collection/Map/Object[].
+ if (value == null) {
+ record.putValue(column, null);
+ continue;
+ }
- // Convert data type if necessary
- PinotDataType source;
- if (value instanceof Object[]) {
- // Multi-value column
- Object[] values = (Object[]) value;
- source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass());
- if (source == null) {
- source = PinotDataType.OBJECT_ARRAY;
+ // Convert data type if necessary
+ PinotDataType source;
+ if (value instanceof Object[]) {
+ // Multi-value column
+ Object[] values = (Object[]) value;
+ source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass());
+ if (source == null) {
+ source = PinotDataType.OBJECT_ARRAY;
+ }
+ } else {
+ // Single-value column
+ source = SINGLE_VALUE_TYPE_MAP.get(value.getClass());
+ if (source == null) {
+ source = PinotDataType.OBJECT;
+ }
}
- } else {
- // Single-value column
- source = SINGLE_VALUE_TYPE_MAP.get(value.getClass());
- if (source == null) {
- source = PinotDataType.OBJECT;
+ if (source != dest) {
+ value = dest.convert(value, source);
}
- }
- if (source != dest) {
- value = dest.convert(value, source);
- }
- record.putValue(column, value);
+ record.putValue(column, value);
+ } catch (Exception e) {
+ throw new RuntimeException("Caught exception while transforming data
type for column: " + column, e);
+ }
}
return record;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]