Github user chunhui-shi commented on a diff in the pull request:
https://github.com/apache/drill/pull/546#discussion_r71471032
--- 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 --
Thanks Jinfeng for the review. The fix will return empty result if it is
flatten(100).
Since this fix is to address the issue when there is no incoming record,
flatten above convert_from should not throw exception. Meanwhile it is better
to keep other behavior unchanged unless we have strong reason to change it.
Based on this understanding, I am updating the change to still throw the same
cast exception if flatten is not getting a RepeatedValueVector to work on.
---
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.
---