You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/05/27 06:55:22 UTC

[incubator-pinot] branch fixing_literal_in_selection created (now ca63e41)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a change to branch fixing_literal_in_selection
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at ca63e41  Make Literal transformer return string literals

This branch includes the following new commits:

     new ca63e41  Make Literal transformer return string literals

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[incubator-pinot] 01/01: Make Literal transformer return string literals

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch fixing_literal_in_selection
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit ca63e41d1ba9f690e12e4d98e2c6078d0b689c0e
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Tue May 26 23:55:03 2020 -0700

    Make Literal transformer return string literals
---
 .../pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java |  2 +-
 .../transform/function/LiteralTransformFunction.java         | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
index 1ce9a06..f4a9639 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
@@ -128,7 +128,7 @@ public class PinotQuery2BrokerRequestConverter {
           if (selection == null) {
             selection = new Selection();
           }
-          selection.addToSelectionColumns(expression.getLiteral().getStringValue());
+          selection.addToSelectionColumns(expression.getLiteral().getFieldValue().toString());
           break;
         case IDENTIFIER:
           if (selection == null) {
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
index 24a2374..4317a2b 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
@@ -18,11 +18,13 @@
  */
 package org.apache.pinot.core.operator.transform.function;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import org.apache.pinot.core.common.DataSource;
 import org.apache.pinot.core.operator.blocks.ProjectionBlock;
 import org.apache.pinot.core.operator.transform.TransformResultMetadata;
+import org.apache.pinot.core.plan.DocIdSetPlanNode;
 import org.apache.pinot.core.segment.index.readers.Dictionary;
 
 
@@ -32,6 +34,7 @@ import org.apache.pinot.core.segment.index.readers.Dictionary;
  */
 public class LiteralTransformFunction implements TransformFunction {
   private final String _literal;
+  private String[] _result;
 
   public LiteralTransformFunction(String literal) {
     _literal = literal;
@@ -48,12 +51,11 @@ public class LiteralTransformFunction implements TransformFunction {
 
   @Override
   public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) {
-    throw new UnsupportedOperationException();
   }
 
   @Override
   public TransformResultMetadata getResultMetadata() {
-    throw new UnsupportedOperationException();
+    return BaseTransformFunction.STRING_SV_NO_DICTIONARY_METADATA;
   }
 
   @Override
@@ -93,7 +95,11 @@ public class LiteralTransformFunction implements TransformFunction {
 
   @Override
   public String[] transformToStringValuesSV(ProjectionBlock projectionBlock) {
-    throw new UnsupportedOperationException();
+    if (_result == null) {
+      _result = new String[DocIdSetPlanNode.MAX_DOC_PER_CALL];
+      Arrays.fill(_result, _literal);
+    }
+    return _result;
   }
 
   @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org