This message was deleted.
# general
s
This message was deleted.
a
This is probably due to the form of latest, if that column is a string. I think using
LATEST(expr, maxBytes)
form (https://druid.apache.org/docs/latest/querying/sql-functions.html#latest) should resolve this.
LATEST(expr)
expects that expr is a numeric value.
a
what version are you on btw?
j
@Adarsh Sanjeev Hi I've tried that too with maxBytes = 16 and 32 but it gives the same error-
Copy code
select
            key_score_id ,
            key_entity_id ,
            key_entity_type ,
            key_started ,
            latest(evaluation_started, 16) from "int.cp.druid.intelligent_scoring_test_druid_ingestion"
            group by key_score_id ,
            key_entity_id ,
            key_entity_type ,
            key_started
@Abhishek Agarwal Hi, I'm using
Copy code
2022.09.0-iap
druid version
a
@Jasvir Singh Walia A few questions, • What is the engine you are using for this? You can see it next to the run button. I'm guessing that it is sql-msq-task, and that you are using an EXTERN source in the FROM clause? • Is the type of the column
int.cp.druid.intelligent_scoring_test_druid_ingestion
string? Currently, MSQ only supports LATEST (irrespective of form of LATEST) on string columns.(https://druid.apache.org/docs/latest/multi-stage-query/known-issues.html#select) If the column is not a string, I believe that sql-native engine does support it. The reason it is using sql-msq-task is that reading from an external source (EXTERN) is only used in msq. If you ingest it into druid first, an sql-native task would work.
Alternatively, you could change the column type to string, depending on your other use cases.
j
@Adarsh Sanjeev • I'm using "sql-native" engine • the type of the column "evaluation_started" is BIGINT
Also i need this column as BIGINT only so can't change the type to string
a
I believe
sql-native
should support integer values for
LATEST(expr)
. Could you post the full query and stack trace for the exception?
j
@Adarsh Sanjeev sure, Query -
Copy code
select
            key_score_id ,
            key_entity_id ,
            key_entity_type ,
            key_started 
            ,
            latest(evaluation_started, 32) 
            from "int.cp.druid.intelligent_scoring_test_druid_ingestion"
            group by key_score_id ,
            key_entity_id ,
            key_entity_type ,
            key_started
Full Error-
Copy code
Error: Unknown exception

java.util.concurrent.ExecutionException: org.apache.druid.java.util.common.UOE: Cannot make VectorValueSelector for column with class[org.apache.druid.segment.column.StringDictionaryEncodedColumn]

java.lang.RuntimeException
a
@Jasvir Singh Walia I didn't notice the
group by
clause due to the indentation, my mistake. The above exception is what is thrown from MSQ engine, so that is interesting to see it for a sql-native query. Could you try setting "vectorize": false in the query context and see if that resolves this?
a
this is likely a bug. you should file a GH issue with the stack traces.
a
To clarify since it could be misunderstood, I meant that currently doing a latest(numeric) in MSQ throws the above exception, not that it can't be thrown in sql-native.
j
Hey @Adarsh Sanjeev sorry i'm new to druid ui, where can i set the query context? I'm using druid's query tab to run my query.
a
There should be an option when clicking on the engine
Edit context
.
j
@Adarsh Sanjeev Thanks a lot, this worked for now, but my actual use case is to query this via looker api and there i don't see an option to pass this property.
a
@Jasvir Singh Walia I think this is a bug, we should not need to manually disable vectorize to make the query run. I believe that Latest() should support vectorization as well. Could you raise a github issue for the same as Abhishek mentioned? I'm not familiar with looker api, you should probably be able to pass the context with the query if it is using the http endpoint