LakshSingla commented on code in PR #12770:
URL: https://github.com/apache/druid/pull/12770#discussion_r928774981
##########
sql/src/main/java/org/apache/druid/sql/calcite/external/ExternalTableMacro.java:
##########
@@ -59,6 +63,16 @@ public TranslatableTable apply(final List<Object> arguments)
final InputFormat inputFormat = jsonMapper.readValue((String)
arguments.get(1), InputFormat.class);
final RowSignature signature = jsonMapper.readValue((String)
arguments.get(2), RowSignature.class);
+ // Prevent a RowSignature that has a ColumnSignature with name "__time"
and type that is not LONG because it
+ // will be automatically casted to LONG while processing in
RowBasedColumnSelectorFactory.
+ // This can cause an issue when the incorrectly typecasted data is
ingested or processed upon. One such example
+ // of inconsistency is that functions such as TIME_PARSE evaluate
incorrectly
+ Optional<ColumnType> timestampColumnTypeOptional =
signature.getColumnType(ColumnHolder.TIME_COLUMN_NAME);
+ if (timestampColumnTypeOptional.isPresent() &&
!timestampColumnTypeOptional.get().equals(ColumnType.LONG)) {
+ throw new ISE("EXTERN function with __time column can be used when
__time column is of type long. "
Review Comment:
I think the original one should be correct. We are only allowing EXTERN
function with __time columns iff they are of type long.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]