@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); ExpressionCompiler compiler = new ExpressionCompiler(metadata); List<String> keys; switch (mapSize) { case 1: keys = ImmutableList.of("do_not_use"); break; case 13: keys = ImmutableList.of( "is_inverted", "device_model", "country", "carrier_id", "network_type", "os_version", "device_brand", "device_type", "interface", "device_os", "app_version", "device_type_class", "browser"); break; default: throw new UnsupportedOperationException(); } verify(keys.size() == mapSize); MapType mapType; Block valueBlock; switch (name) { case "fix-width": mapType = new MapType(createUnboundedVarcharType(), DOUBLE); valueBlock = createFixWidthValueBlock(POSITIONS, mapSize); break; case "var-width": mapType = new MapType(createUnboundedVarcharType(), createUnboundedVarcharType()); valueBlock = createVarWidthValueBlock(POSITIONS, mapSize); break; case "dictionary": mapType = new MapType(createUnboundedVarcharType(), createUnboundedVarcharType()); valueBlock = createDictionaryValueBlock(POSITIONS, mapSize); break; default: throw new UnsupportedOperationException(); } Block keyBlock = createKeyBlock(POSITIONS, keys); Block block = createMapBlock(POSITIONS, keyBlock, valueBlock); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Signature signature = new Signature( "$operator$" + SUBSCRIPT.name(), FunctionKind.SCALAR, mapType.getValueType().getTypeSignature(), mapType.getTypeSignature(), mapType.getKeyType().getTypeSignature()); for (int i = 0; i < mapSize; i++) { projectionsBuilder.add( new CallExpression( signature, mapType.getValueType(), ImmutableList.of( new InputReferenceExpression(0, mapType), new ConstantExpression(utf8Slice(keys.get(i)), createUnboundedVarcharType())))); } ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler .compilePageProcessor(new ConstantExpression(true, BooleanType.BOOLEAN), projections) .get(); pageBuilder = new PageBuilder( projections.stream().map(RowExpression::getType).collect(Collectors.toList())); page = new Page(block); }