avnerschwartz opened a new issue, #15492:
URL: https://github.com/apache/druid/issues/15492

   Hello,
   I'm trying to add a string dimension, which involves some basic conditional 
expression on another string dimension.
   
   I have an existing string dimension called "isTest" with two values: 'true' 
and 'false' (verified these are the only two values for this dimension using 
SQL query to get the distinct values).
    
   In my ingestion spec, i'd like to define another dimension called "bucket", 
with the following expression:
   ```json
   "transformSpec": {
     "transforms": [
       {
         "type": "expression",
         "name": "bucket",
         "expression": "if(notnull(\"isTest\") && \"isTest\"=='true','A','B')"
       }
     ]
   }
   ```
   
   After submitting the ingestion spec, I see that my "bucket" dimension has 
the following values:
   ```
   'A'
   null
   ```
   
   I tried implementing the conditional expression using `if` and 
`case_searched`, and both yielded the same unexpected behavior.
   
   Any idea what could be wrong?
   
   
   Here's the relevant part from the ingestion spec:
   ```json
   {
     "type": "kafka",
     "spec": {
       "dataSchema": {
         "dataSource": "test-datasource",
         "timestampSpec": {
           "column": "eventTimestamp",
           "format": "millis",
           "missingValue": null
         },
         "dimensionsSpec": {
           "dimensions": [
             {
               "type": "string",
               "name": "isTest",
               "multiValueHandling": "SORTED_ARRAY",
               "createBitmapIndex": true
             },
             {
               "type": "string",
               "name": "bucket",
               "multiValueHandling": "SORTED_ARRAY",
               "createBitmapIndex": true
             }
           ],
           "dimensionExclusions": [
             "eventTimestamp",
             "__time",
             "count"
           ]
         },
         "metricsSpec": [
           {
             "type": "count",
             "name": "count"
           }
         ],
         "granularitySpec": {
           "type": "uniform",
           "segmentGranularity": "HOUR",
           "queryGranularity": "HOUR",
           "rollup": true,
           "intervals": []
         },
         "transformSpec": {
           "transforms": [
             {
               "type": "expression",
               "name": "bucket",
               "expression": "if(notnull(\"isTest\") && 
\"isTest\"=='true','A','B')"
             }
           ]
         }
       }
     }
   }
   ```


-- 
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]

Reply via email to