Github user jinfengni commented on a diff in the pull request:
https://github.com/apache/drill/pull/546#discussion_r71368874
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
---
@@ -129,8 +129,14 @@ private void setFlattenVector() {
try {
final TypedFieldId typedFieldId =
incoming.getValueVectorId(popConfig.getColumn());
final MaterializedField field =
incoming.getSchema().getColumn(typedFieldId.getFieldIds()[0]);
- final RepeatedValueVector vector =
RepeatedValueVector.class.cast(incoming.getValueAccessorById(
- field.getValueClass(),
typedFieldId.getFieldIds()).getValueVector());
+ RepeatedValueVector vector = null;
+ try {
+ vector =
RepeatedValueVector.class.cast(incoming.getValueAccessorById(
+ field.getValueClass(),
typedFieldId.getFieldIds()).getValueVector());
+ } catch(ClassCastException ex) {
+ //if cast fail
--- End diff --
If the input to flatten happens to be a scalar value, i.e (int 100), what's
the desired result? The previous behavior is to hit ClassCastException, which
might need improve the error message. With your change, flatten(100) will
return a single value of (100), or just an empty repeated map?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---