walterddr commented on code in PR #9726:
URL: https://github.com/apache/pinot/pull/9726#discussion_r1015566450
##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/OperatorTestUtil.java:
##########
@@ -18,33 +18,43 @@
*/
package org.apache.pinot.query.runtime.operator;
+import java.util.Arrays;
import java.util.List;
-import org.apache.pinot.common.datablock.BaseDataBlock;
-import org.apache.pinot.common.datablock.DataBlockUtils;
import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.core.operator.BaseOperator;
import org.apache.pinot.query.runtime.blocks.TransferableBlock;
+import org.apache.pinot.query.testutils.MockDataBlockOperatorFactory;
public class OperatorTestUtil {
- private OperatorTestUtil() {
- }
+ // simple key-value collision schema/data test set: "Aa" and "BB" have same
hash code in java.
+ private static final List<List<Object[]>> SIMPLE_KV_DATA_ROWS =
Arrays.asList(
+ Arrays.asList(new Object[]{1, "Aa"}, new Object[]{2, "BB"}, new
Object[]{3, "BB"}),
+ Arrays.asList(new Object[]{1, "AA"}, new Object[]{2, "Aa"}));
+ private static final MockDataBlockOperatorFactory MOCK_OPERATOR_FACTORY;
- public static final DataSchema TEST_DATA_SCHEMA = new DataSchema(new
String[]{"foo", "bar"},
+ public static final DataSchema SIMPLE_KV_DATA_SCHEMA = new DataSchema(new
String[]{"foo", "bar"},
new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.INT,
DataSchema.ColumnDataType.STRING});
- public static TransferableBlock getEndOfStreamRowBlock() {
- return getEndOfStreamRowBlockWithSchema();
+ public static final String OP_1 = "op1";
+ public static final String OP_2 = "op2";
+
+ static {
+ MOCK_OPERATOR_FACTORY = new MockDataBlockOperatorFactory()
+ .registerOperator(OP_1, SIMPLE_KV_DATA_SCHEMA)
+ .registerOperator(OP_2, SIMPLE_KV_DATA_SCHEMA)
+ .addRows(OP_1, SIMPLE_KV_DATA_ROWS.get(0))
+ .addRows(OP_2, SIMPLE_KV_DATA_ROWS.get(1));
Review Comment:
FYI @61yao this would be how I envision ppl use this data block operator to
add test data.
also add multiple rows means return multiple data blocks (this would be
super useful to test more complex cases)
--
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]