This message was deleted.
# general
s
This message was deleted.
k
what would your
key
and
value
be in this case?
k
Key would be string and values would be some computes quantilesDoublesSketch - A result of
groupBy
query is going to be used in a lookup table for quicker access.
Or is there a way to cast
string
type to
quantilesDoublesSketch
? I can store sketches as string in lookup table and when doing query - I can cast them to ``quantilesDoublesSketch``
@Vijay Narayanan - Any thoughts on this?
v
group by query will not give you a sketch. It will get you a number
k
Copy code
{
  "queryType": "groupBy",
  "dataSource": "table_name",
  "granularity": "all",
  "dimensions": [
    "column_name"
  ],
  "aggregations": [
    {
      "type": "quantilesDoublesSketch",
      "fieldName": "double_sketch",
      "k": 256,
      "name": "baseline_quantile_sketch"
    }
  ],
  "postAggregations": [
    {
      "type": "fieldAccess",
      "fieldName": "baseline_quantile_sketch",
      "name": "baseline_quantile_sketch_raw"
    }
  ],
  "filter": {
    "type": "and",
    "fields": [
      {
        "type": "selector",
        "dimension": "__model_id__",
        "value": "079c6aa9-2027-4c0e-8fbf-c3c0817514d1"
      },
      {
        "type": "in",
        "dimension": "column_name",
        "values": [
          "area",
          "baths",
          "beds",
          "datePriceChanged"
        ]
      }
    ]
  },
  "intervals": "2015-08-28/2025-10-20"
}
This is my query, intension is to store
column_name
as key and
baseline_quantile_sketch_raw
as value. I’m able to store
baseline_quantile_sketch_raw
as the value but in string datatype - wanted to see if this can be stored as sketch type?
group by query will not give you a sketch. It will get you a number
@Vijay Narayanan - Couldn’t really follow your comment, can you see the query I posted above..
v
if you just use an aggregation then you can get the sketch. The post aggregation will result in a number. I think what yo are trying to do is us a rilled table and join with another table. As far as I know this can't be done using a lookup. You need a join.
k
FYI: @Apoorv Gupta
Is there a way that I can cast string type to sketch type and store/retrive sketch from the lookup table?
a
@Kumar Saket Is there a quick way to verify?
k
Copy code
SELECT
  TIME_FLOOR(CASE WHEN CAST("t_hour" AS BIGINT) > 0 THEN MILLIS_TO_TIMESTAMP(CAST("t_hour" AS BIGINT)) ELSE TIME_PARSE("t_hour") END, 'PT1H') AS __time,
  "channel",
  SUM("__count") AS "__count",
  DS_THETA(COMPLEX_DECODE_BASE64('thetaSketch', "theta_user")) AS "theta_user",
  DS_HLL(COMPLEX_DECODE_BASE64('HLLSketch', "hll_user")) AS "hll_user"
FROM "source"
GROUP BY 1, 2
PARTITIONED BY DAY
May be using
COMPLEX_DECODE_BASE64
with
DS_THETA
or something similar should do the Job. Not sure though..
v
As far as I know you cannot go from string to sketch (sketch to string is possible as the sketches output string in the post agg for. Debugging