diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ExternalColumnSelectorFactory.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ExternalColumnSelectorFactory.java index 2d0966f7c805..fc9f59ad32c6 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ExternalColumnSelectorFactory.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ExternalColumnSelectorFactory.java @@ -73,6 +73,7 @@ public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec) return new DimensionSelector() { final DimensionSelector delegateDimensionSelector = delegate.makeDimensionSelector(dimensionSpec); + final ExpressionType expressionType = ExpressionType.fromColumnType(dimensionSpec.getOutputType()); @Override public IndexedInts getRow() @@ -103,7 +104,6 @@ public void inspectRuntimeShape(RuntimeShapeInspector inspector) public Object getObject() { try { - ExpressionType expressionType = ExpressionType.fromColumnType(dimensionSpec.getOutputType()); if (expressionType == null) { return delegateDimensionSelector.getObject(); } @@ -154,6 +154,9 @@ public ColumnValueSelector makeColumnValueSelector(String columnName) return new ColumnValueSelector() { final ColumnValueSelector delegateColumnValueSelector = delegate.makeColumnValueSelector(columnName); + final ExpressionType expressionType = ExpressionType.fromColumnType( + rowSignature.getColumnType(columnName).orElse(null) + ); @Override public double getDouble() @@ -205,9 +208,6 @@ public boolean isNull() public Object getObject() { try { - ExpressionType expressionType = ExpressionType.fromColumnType(rowSignature - .getColumnType(columnName) - .orElse(null)); if (expressionType == null) { return delegateColumnValueSelector.getObject(); }