Is there a way to perform arbitrary array spreading in ByteBuddy? - byte-buddy

ByteBuddy lets you use the withArgumentArrayElements method to "spread" an array "into" distinct method parameters.
Is there a way to perform this spreading on arbitrary Object arrays, such as those that might be returned from a MethodCall invocation?

Related

Can I use named parameters with jOOQ SQL executor?

I am using jOOQ to execute arbitrary SQL queries. I am doing this as following:
String result = create.fetchSingle("SELECT ...").getValue(0, String.class);
This query always returns one row and one column, hence the usage of fetchSingle and getValue(0, T). I could not find a method which combines the two.
I now want to pass a named parameter to that query. The parameter is used at several places, so I thought using a named parameter was a good usage here. The type of this parameter is an array of strings.
How can I do this? How do I refer to that parameter in the query? In JDBC, I would write :name_of_parameter::text[].
The API you're looking for is DSLContext.fetchSingle(String, Object...), which accepts a SQL string with parameter placeholders, as well as the actual bindings.
However, it does not support named parameters, only indexed parameters, so you'll have to repeat the value several times, e.g.
create.fetchSingle("SELECT 'a' WHERE ?::text[] = ?::text[]", value, value)
.getValue(0, String.class);

Invalid value for implementation data types

How to configure the Invalid Value for implementation data types (Especially for arrays, based on the size of the array we have to create that many array value specifications)??
For a single ImplementationDataType of category ARRAY, you just create one ArrayValueSpecification that contains as many NumericalValueSpecifications as required.

Keen IO mixed property values (integers as strings)

Since Keen is not strongly typed, I've noticed it is possible to send data of different types into the same property. For instance, some events may have a property whose value is a String (sent surrounded by quotes), and some whose value is an integer (sent without quotes). In the case of mathematical operations, what is the expected behavior?
Our comparator will only compute mathematical operations on numbers. If you have a property whose values are mixed, the operation will only apply to the numbers, strings will be ignored. You can see the values in your property by running a select_unique query on that property as the target_property, then (if you're using the Explorer) selecting JSON from the drop-down in the top-right. Any values you see there that are surrounded by quotes will be ignored by a mathematical query type (minimum, maximum, median, average, percentile, and sum).
If you are just starting out, and you know you want to be able to do mathematical operations on this property, we recommend making sure that you always send integers as numbers (without quotes). If you really want to keep your dataset clean, you can even start a new collection once you've made sure you are no longer sending any strings.
Yes, you're correct, Keen can accept data of different types as the value for your properties. An example of Keen's lenient data type is that a property such as VisitorID can contain both numbers (ie 14558) or strings (ie "14558").
This is article from the Keen site is useful for seeing where you can check data types: https://keen.io/docs/data-collection/data-modeling-guide-200/#check-for-data-type-mismatch

Do Apache Pig UDFs ever get called with null tuples?

https://wiki.apache.org/pig/UDFManual
The example UDF has a null-check on the input tuple in the exec method. The various built-in methods sometimes do and sometimes don't.
Are there actually any cases where a Pig script will cause a UDF to be called with a null input tuple? Certainly an empty input tuple is normal and expected, or a tuple of one null value, but I've never the tuple itself be null.
A tuple may be null because a previous UDF returns null.
Think on log analysis system, where you 1. parse the log, 2. enrich it with external data.
LOG --(PARSER)--> PARSED_LOG --(ENRICHENER)--> ENRICHED_LOG
If one log LOG have wrong format and cannot be parsed, the UDF PARSED_LOG may returns null.
Therefore, if used directly, the ENRICHENER have to test the input.
You can FILTER those null values before too, specially if the tuples are used multiple times or STORED.
My best understanding after working with Pig for a while is that bare nulls are never passed bare nulls, always a non-null Tuple (which itself may contain nulls.)

Comparing an NSArray of NSStrings with another NSArray of NSStrings

I have two NSArrays each containing NSStrings. I need to test whether the two arrays are equal. In this instance, equality means not that the arrays contain the same objects, but that each object returns true for isEqualToString when compared its counterpart. The arrays are also not equal if one contains more items than the other, or the order of the items is different.
Can I assume isEqualToArray won't help me here?
Similarly, I don't see an approach using NSSet that would fulfill all of the criteria.
How might I test the equality of these two arrays?
The docs for isEqualToArray state:
Two arrays have equal contents if they each hold the same number of objects and objects at a given index in each array satisfy the isEqual: test.
That seems like it fits your criteria.