-
Notifications
You must be signed in to change notification settings - Fork 63
allow opt-in for new unset field semantics on csp.Struct (disc #536) #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
195165f
345f37f
4acbb08
2af2edf
685bf73
a8751cf
6816484
2603e73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,6 +520,9 @@ void ParquetStructAdapter::dispatchValue( const utils::Symbol *symbol, bool isNu | |
{ | ||
fieldSetter( s ); | ||
} | ||
|
||
CSP_TRUE_OR_THROW_RUNTIME( s -> validate(), "Struct validation failed for Parquet message, some fields are missing" ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be double-checked to make sure things are being caught properly. From the call graph of All the way at |
||
|
||
dispatchedValue = &s; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,9 @@ StructPtr JSONMessageStructConverter::convertJSON( const char * fieldname, const | |
} ); | ||
} | ||
|
||
if( !struct_ -> validate() ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This propagates to the |
||
CSP_THROW( ValueError, "JSON conversion of struct " << sType.meta() -> name() << " failed; some required fields were not set" ); | ||
|
||
return struct_; | ||
} | ||
|
||
|
@@ -251,6 +254,7 @@ csp::StructPtr JSONMessageStructConverter::asStruct( void * bytes, size_t size ) | |
} | ||
); | ||
} | ||
// root struct validation (validate()) deferred to adapter level | ||
|
||
return data; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,8 +52,15 @@ void ClientAdapterManager::start( DateTime starttime, DateTime endtime ) | |
if( m_inputAdapter ) { | ||
m_endpoint -> setOnMessage( | ||
[ this ]( void* c, size_t t ) { | ||
PushBatch batch( m_engine -> rootEngine() ); | ||
m_inputAdapter -> processMessage( c, t, &batch ); | ||
try | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not super familiar with the most natural way of handling this, so this should be double-checked. |
||
{ | ||
PushBatch batch( m_engine -> rootEngine() ); | ||
m_inputAdapter -> processMessage( c, t, &batch ); | ||
} | ||
catch( csp::Exception & err ) | ||
{ | ||
pushStatus( StatusLevel::ERROR, ClientStatusType::GENERIC_ERROR, err.what() ); | ||
} | ||
} | ||
); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processMessage
is called inKafkaSubscriber.cpp
and in line 37 should catch this exception, I think