SQL Lookup query

459 views
Skip to first unread message

Андрей

unread,
Mar 12, 2019, 2:20:10 PM3/12/19
to Druid User
Hi there!

I've created Lookup using JSON like this:

{
 
"__default": {
   
"group_tov": {
     
"version": "v1",
     
"lookupExtractorFactory": {
       
"type": "map",
       
"map": {'test': 'test1'}
     
}
   
}
 
}
}


It's successfully created. The response of GET request to http://localhost:8081/druid/coordinator/v1/lookups/config is:

["__default"]

  
So i want to use this lookup in my SQL query:

SELECT "BasePrice",
       LOOKUP
(CAST(id_tov_cl AS VARCHAR), "group_tov")
FROM
"druid"."vv_checklines"
LIMIT
10

But the answer is:

Unknown exception (org.apache.calcite.tools.ValidationException): org.apache.calcite.runtime.CalciteContextException: From line 2, column 43 to line 2, column 51: Column 'group_tov' not found in any table

Maybe someone can help me?
Thanks!

Gian Merlino

unread,
Mar 12, 2019, 3:14:31 PM3/12/19
to druid...@googlegroups.com
Hey Андрей,

It should be 'group_tov' (with single quotes) not "group_tov".

Gian


--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To post to this group, send email to druid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/2acdb34c-4f4e-4cb5-bf5c-9e1a0ea5c1f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Андрей

unread,
Mar 12, 2019, 3:26:16 PM3/12/19
to Druid User
Damn! Thanks! But now i have another error:

Unknown exception (java.lang.NullPointerException): Lookup [group_tov] not found

But i've created the lookup... Why it can't see it?

вторник, 12 марта 2019 г., 22:14:31 UTC+3 пользователь Gian Merlino написал:

Андрей

unread,
Mar 13, 2019, 8:26:21 AM3/13/19
to Druid User
Ok, i found in https://stackoverflow.com/questions/31697828/docker-run-name-is-already-in-use-by-container

You can try few of the things to get it resolve.


Delete all the lookups which you are not using
either
use "__default" as tier name or mention you tier whatever you want but don't forget to mention in ALL your runtime.properties with as druid.lookup.lookupTierIsDatasource=false druid.lookup.lookupTier=_default_tier
make sure GET is working on that lookup (see the documentation for get api for lookup )
  1. I've created own tier and now it work. But the question is why by default '__default' tier not working?

вторник, 12 марта 2019 г., 22:26:16 UTC+3 пользователь Андрей написал:

va...@imply.io

unread,
Apr 5, 2019, 6:55:51 PM4/5/19
to Druid User
Is it possible that when you first created the lookup you did not initialize the lookups?

In http://druid.io/docs/latest/querying/lookups.html see "If you have NEVER configured lookups before, you MUST post an empty json object {} to ..."

If so maybe you initialized them by your second usage?

Andrew

unread,
Apr 11, 2019, 8:42:55 AM4/11/19
to Druid User
Maybe, yes. Now it's work pretty fine.

суббота, 6 апреля 2019 г., 1:55:51 UTC+3 пользователь va...@imply.io написал:
Reply all
Reply to author
Forward
0 new messages