tanmesh commented on code in PR #9184: URL: https://github.com/apache/pinot/pull/9184#discussion_r954213735
########## pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ExtractTransformFunction.java: ########## @@ -0,0 +1,97 @@ +package org.apache.pinot.core.operator.transform.function; + +import java.util.List; +import java.util.Map; +import org.apache.pinot.core.operator.blocks.ProjectionBlock; +import org.apache.pinot.core.operator.transform.TransformResultMetadata; +import org.apache.pinot.segment.spi.datasource.DataSource; +import org.joda.time.Chronology; +import org.joda.time.DateTimeField; +import org.joda.time.chrono.ISOChronology; + + +public class ExtractTransformFunction extends BaseTransformFunction { + public static final String FUNCTION_NAME = "extract"; + private TransformFunction _mainTransformFunction; + protected String _field; + protected Chronology _chronology = ISOChronology.getInstanceUTC(); + + @Override + public String getName() { return FUNCTION_NAME; } + + @Override + public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) { + if (arguments.size() != 2) { + throw new IllegalArgumentException("Exactly 2 arguments are required for EXTRACT transform function"); + } + + _field = ((LiteralTransformFunction) arguments.get(0)).getLiteral(); + if(!validField(_field)) { + throw new IllegalArgumentException("FIELD in EXTRACT expression is not valid"); + } + + _mainTransformFunction = arguments.get(1); + } + + private boolean validField(String field) { Review Comment: I have updated based on the comments. May I get some eyes on it. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org