You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "avnerschwartz (via GitHub)" <gi...@apache.org> on 2023/12/05 08:48:31 UTC

[I] Unexpected condition behavior in druid ingestion with transformSpec (druid)

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: commits-unsubscribe@druid.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [I] Unexpected condition behavior in druid ingestion with transformSpec (druid)

Posted by "avnerschwartz (via GitHub)" <gi...@apache.org>.
avnerschwartz closed issue #15492: Unexpected condition behavior in druid ingestion with transformSpec 
URL: https://github.com/apache/druid/issues/15492


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org