Repository navigation
fix: warehouse transformations mismatches - #5779
Conversation
92bb4a6 to
e6fb943
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/1.48.x #5779 +/- ##
==================================================
- Coverage 76.89% 76.83% -0.06%
==================================================
Files 490 490
Lines 67081 67137 +56
==================================================
+ Hits 51580 51588 +8
- Misses 12685 12720 +35
- Partials 2816 2829 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0fa2494 to
b5d02f6
Compare
b5d02f6 to
18dd7a1
Compare
18dd7a1 to
3f15029
Compare
3f15029 to
ace3e77
Compare
There was a problem hiding this comment.
For string length calculation, always use utf8.RuneCount instead of len function to be compatible with JavaScript.
There was a problem hiding this comment.
@achettyiitr Fine to be compatible with js transformation. But if its about refshiftString size limit, ideally we should account for bytes than character count? And for this change, once we disable comparison we can move to len?
There was a problem hiding this comment.
Yeah, later we can move to bytes.
There was a problem hiding this comment.
Extract event name is coming as empty because rules calculation was being done later to the event name calculation.
- Moved the logic to
extractCommonPropsalong with handling ofsetDataAndMetadataFromRuleswhich populated the event name. - Also, for getting the event name need to check Output instead of event message.
- Added tests for Snowflake destinations for all event types.
There was a problem hiding this comment.
@achettyiitr Extract event name is coming as empty Was it only for some events? Trying to understand if this was some edge scenario vs consistent issue and this being identified now?
There was a problem hiding this comment.
It was happening only for Snowflake destination with extract event type, as in we were checking the event message instead of Output for event name. Since for Snowflake keys are caps, it was not able to find anything with EVENT key in message.
There was a problem hiding this comment.
Using receivedAt from metadata if empty in the event.
There was a problem hiding this comment.
Extract recordID to be empty in case of slices.
There was a problem hiding this comment.
Does this change mean that RecordID being slice is not a valid event?
There was a problem hiding this comment.
Yeah, recordID should not be an object or an array.
There was a problem hiding this comment.
Ok, is this some bug in ETL? Why we would get a non-string record id?
There was a problem hiding this comment.
Not sure though. But in the debug sample payloads that we receive it came in as Array.
There was a problem hiding this comment.
This can happen with bug in etl connector as in field being defined as identifier which can be array. @am6010 In case you remember any from top of your mind.
There was a problem hiding this comment.
For getting event type use event instead of metadata
There was a problem hiding this comment.
I have not been able to understand these switches ... some from metadata, some from event 😅
There was a problem hiding this comment.
For an event, type was coming as empty but metadata was having something. Not sure whether it's a valid case from server side. But since rudder-transformer relies on event payload rather then metadata, we need to move to event payload.
wEvent.Metadata.MessageID = utils.ExtractMessageID(event, uuidGenerator) -- This needs to be using event
wEvent.Metadata.ReceivedAt = utils.ExtractReceivedAt(event, now) -- This needs to be using event
wEvent.Metadata.SourceID = event.Metadata.SourceID -- For this we need to use metadata only
wEvent.Metadata.SourceType = event.Metadata.SourceType -- For this we need to use metadata only
wEvent.Metadata.DestinationID = event.Metadata.DestinationID -- For this we need to use metadata only
wEvent.Metadata.DestinationType = event.Metadata.DestinationType -- For this we need to use metadata only
wEvent.Metadata.SourceCategory = event.Metadata.SourceCategory -- For this we need to use metadata only
wEvent.Metadata.EventType = utils.ToString(event.Message["type"]) -- This needs to be using event
wEvent.Metadata.RecordID = event.Metadata.RecordID -- If we find something, we can later as well move this to using event.
There was a problem hiding this comment.
While doing JSON marshalling, handle HTML Unicode characters. By default, during marshalling, SetEscapeHTML is true. During Unmarshalling, the library is already taking care of the unescape. So if we do both Marshalling and UnMarshalling, there would be no effect,t which is why it's working for the Transformer response. But here in the warehouse, the transformer would need to handle it separately.
There was a problem hiding this comment.
While doing JSON marshalling, handle HTML Unicode characters. By default, during marshalling, SetEscapeHTML is true. During Unmarshalling, the library is already taking care of the unescape. So if we do both Marshalling and UnMarshalling, there would be no effect,t which is why it's working for the Transformer response. But here in the warehouse, the transformer would need to handle it separately.
There was a problem hiding this comment.
I am assuming that we are not doing any unmarshalling anywhere in warehouse, rt?
There was a problem hiding this comment.
New data formats keep popping up. And it would be difficult to maintain list of supported date time formats. Also, with the current logic of iterating to valid formats and finding the the valid one will become more expensive if the list grows too long. Moving to existing implementation of using dateparser.Any.
There was a problem hiding this comment.
// BenchmarkValidTimestamp
// BenchmarkValidTimestamp/old_parser
// BenchmarkValidTimestamp/old_parser-12 6999 163017 ns/op
// BenchmarkValidTimestamp/new_parser
// BenchmarkValidTimestamp/new_parser-12 89427 13392 ns/op
There was a problem hiding this comment.
Modify IsBlank for maps and slice of to be compatible with .isEmpty(.toString(value)).
// Corresponding lodash implementation: https://playcode.io/2371369
//
// const isBlank = (value) => {
// try {
// return _.isEmpty(_.toString(value));
// } catch (e) {
// console.error(`Error in isBlank: ${e.message}`);
// return false;
// }
// };
There was a problem hiding this comment.
Currently, we are not handling such cases where 0001-01-01 00:00:00 converting to an invalid case in JavaScript resulting in 2001-01-01T00:00:00.000Z. https://www.programiz.com/online-compiler/4SqZcIH5k6Yli
There was a problem hiding this comment.
Does this change mean that RecordID being slice is not a valid event?
There was a problem hiding this comment.
I am assuming that we are not doing any unmarshalling anywhere in warehouse, rt?
# Description Syncing patch release v1.48.5 to main branch **↓↓ Please review and edit commit overrides before merging ↓↓** BEGIN_COMMIT_OVERRIDE fix: warehouse transformations mismatches (#5779) chore: update rudder-go-kit to 0.49.2 (#5832) END_COMMIT_OVERRIDE --------- Co-authored-by: Aris Tzoumas <[email protected]> Co-authored-by: Sudip Paul <[email protected]> Co-authored-by: yeshwanth vuppu <[email protected]> Co-authored-by: Akash Chetty <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.49.0-rc.1](v1.48.0...v1.49.0-rc.1) (2025-05-12) ### Features * add support for processing of upload_v2 job type by slave ([#5796](#5796)) ([67988d1](67988d1)) * batch staging files for creating upload_v2 notifier jobs ([#5765](#5765)) ([7dc3a45](7dc3a45)) * enable worker-based kafka client batching ([#5788](#5788)) ([66dc19f](66dc19f)) * support claim renewal in notifier jobs ([#5818](#5818)) ([a499d9c](a499d9c)) * support new consent resolution strategy values ([#5798](#5798)) ([181b95b](181b95b)) * update config to add account details with destination in workspaceConfig ([#5753](#5753)) ([dbd46bf](dbd46bf)) * update contract for account and accountDefinition ([#5830](#5830)) ([c704b07](c704b07)) * use account to decide oauth type of a destination ([#5810](#5810)) ([9165e8c](9165e8c)) ### Bug Fixes * add check for nil secret on oauthv2 ([#5807](#5807)) ([fbc4abe](fbc4abe)) * convert bad request errors to 500 errors in oauth interceptor to prevent panics ([#5813](#5813)) ([3a08ec4](3a08ec4)) * **jobsdb:** completed datasets don't get deleted without a pair ([#5793](#5793)) ([54aee71](54aee71)) * reporting common client path with query ([#5842](#5842)) ([c068920](c068920)) * transformer client recycle ttl bound to connection idle timeout ([#5800](#5800)) ([b13f92c](b13f92c)) * update account type to remove id which we are getting as map key ([#5835](#5835)) ([bc52242](bc52242)) * ut mirroring race condition ([#5824](#5824)) ([a4d579f](a4d579f)) * warehouse cached schema mismatch ([#5805](#5805)) ([4656247](4656247)) * warehouse transformations mismatches ([#5779](#5779)) ([01a7b83](01a7b83)) ### Miscellaneous * **deps:** bump github.com/snowflakedb/gosnowflake from 1.13.2 to 1.13.3 in the go_modules group ([#5787](#5787)) ([41db33e](41db33e)) * **deps:** bump golangci/golangci-lint-action from 7 to 8 ([#5815](#5815)) ([bf3e808](bf3e808)) * **jobsdb:** cache distinct parameters query result for all datasets except last ([#5752](#5752)) ([e85811e](e85811e)) * migrate from denisenkom/go-mssqldb to microsoft/go-mssqldb ([#5776](#5776)) ([dbd46bf](dbd46bf)) * revert synapse staging table with max varchar length ([#5817](#5817)) ([2418329](2418329)) * **router:** support destination-specific configuration overrides for all options ([#5841](#5841)) ([695cf53](695cf53)) * synapse staging table with max varchar length ([#5775](#5775)) ([2fc5384](2fc5384)) * update accountDefination type with authenticationType ([#5791](#5791)) ([2a24e59](2a24e59)) * update rudder-go-kit to 0.49.2 ([#5832](#5832)) ([01a7b83](01a7b83)) * upload embedded dt response difference samples to s3 ([#5792](#5792)) ([c81001f](c81001f)) * warehouse transformer migration to embedded destination transformer package ([#5827](#5827)) ([e124bb0](e124bb0)) * warehouse transformer sample diff ([#5837](#5837)) ([8af55de](8af55de)) * warehouse transformer uploader ([#5828](#5828)) ([fc640bf](fc640bf)) * webhook integration test module upgrade ([#5665](#5665)) ([f4130d1](f4130d1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [1.49.0](v1.48.0...v1.49.0) (2025-05-13) ### Features * add dynamic config existence flag for destinations ([#5821](#5821)) ([1b4ea06](1b4ea06)) * add support for processing of upload_v2 job type by slave ([#5796](#5796)) ([67988d1](67988d1)) * batch staging files for creating upload_v2 notifier jobs ([#5765](#5765)) ([7dc3a45](7dc3a45)) * enable worker-based kafka client batching ([#5788](#5788)) ([66dc19f](66dc19f)) * support claim renewal in notifier jobs ([#5818](#5818)) ([a499d9c](a499d9c)) * support new consent resolution strategy values ([#5798](#5798)) ([181b95b](181b95b)) * update config to add account details with destination in workspaceConfig ([#5753](#5753)) ([dbd46bf](dbd46bf)) * update contract for account and accountDefinition ([#5830](#5830)) ([c704b07](c704b07)) * use account to decide oauth type of a destination ([#5810](#5810)) ([9165e8c](9165e8c)) ### Bug Fixes * add check for nil secret on oauthv2 ([#5807](#5807)) ([fbc4abe](fbc4abe)) * convert bad request errors to 500 errors in oauth interceptor to prevent panics ([#5813](#5813)) ([3a08ec4](3a08ec4)) * embedded transformations upload ([#5848](#5848)) ([0b19968](0b19968)) * **jobsdb:** completed datasets don't get deleted without a pair ([#5793](#5793)) ([54aee71](54aee71)) * reporting common client path with query ([#5842](#5842)) ([c068920](c068920)) * transformer client recycle ttl bound to connection idle timeout ([#5800](#5800)) ([b13f92c](b13f92c)) * update account type to remove id which we are getting as map key ([#5835](#5835)) ([bc52242](bc52242)) * ut mirroring race condition ([#5824](#5824)) ([a4d579f](a4d579f)) * warehouse cached schema mismatch ([#5805](#5805)) ([4656247](4656247)) * warehouse transformations mismatches ([#5779](#5779)) ([01a7b83](01a7b83)) ### Miscellaneous * **deps:** bump github.com/snowflakedb/gosnowflake from 1.13.2 to 1.13.3 in the go_modules group ([#5787](#5787)) ([41db33e](41db33e)) * **deps:** bump golangci/golangci-lint-action from 7 to 8 ([#5815](#5815)) ([bf3e808](bf3e808)) * enrich event with bot details ([#5836](#5836)) ([6035658](6035658)) * **jobsdb:** cache distinct parameters query result for all datasets except last ([#5752](#5752)) ([e85811e](e85811e)) * migrate from denisenkom/go-mssqldb to microsoft/go-mssqldb ([#5776](#5776)) ([dbd46bf](dbd46bf)) * revert synapse staging table with max varchar length ([#5817](#5817)) ([2418329](2418329)) * **router:** support destination-specific configuration overrides for all options ([#5841](#5841)) ([695cf53](695cf53)) * synapse staging table with max varchar length ([#5775](#5775)) ([2fc5384](2fc5384)) * update accountDefination type with authenticationType ([#5791](#5791)) ([2a24e59](2a24e59)) * update rudder-go-kit to 0.49.2 ([#5832](#5832)) ([01a7b83](01a7b83)) * upload embedded dt response difference samples to s3 ([#5792](#5792)) ([c81001f](c81001f)) * warehouse transformer migration to embedded destination transformer package ([#5827](#5827)) ([e124bb0](e124bb0)) * warehouse transformer sample diff ([#5837](#5837)) ([8af55de](8af55de)) * warehouse transformer uploader ([#5828](#5828)) ([fc640bf](fc640bf)) * webhook integration test module upgrade ([#5665](#5665)) ([f4130d1](f4130d1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Description
utf8.RuneCountinstead oflenfunction to be compatible with JavaScript.dateparser.Any._.isEmpty(_.toString(value)). Corresponding lodash implementation: https://playcode.io/2371369Linear Ticket
Security