You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2019/03/12 17:25:33 UTC

[GitHub] [drill] vvysotskyi commented on a change in pull request #1686: DRILL-6524: Prevent incorrect scalar replacement for the case of assigning references inside if block

vvysotskyi commented on a change in pull request #1686: DRILL-6524: Prevent incorrect scalar replacement for the case of assigning references inside if block
URL: https://github.com/apache/drill/pull/1686#discussion_r264793423
 
 

 ##########
 File path: exec/vector/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java
 ##########
 @@ -229,4 +231,77 @@ public static VarDecimalHolder getVarDecimalHolder(DrillBuf buf, BigDecimal bigD
 
     return dch;
   }
+
+  /**
+   * Returns list of field names which belong to holder corresponding to the specified {@code TypeProtos.MajorType type}.
+   *
+   * @param type type of holder whose fields should be returned
+   * @return list of field names which belong to holder corresponding to the specified {@code TypeProtos.MajorType type}.
+   */
+  public static List<String> getHolderParams(TypeProtos.MajorType type) {
+    ArrayList<String> result = new ArrayList<>();
+    switch (type.getMode()) {
+      case OPTIONAL:
+        result.add("isSet");
+        // fall through
+      case REQUIRED:
+        switch (type.getMinorType()) {
+          case BIGINT:
+          case FLOAT4:
+          case FLOAT8:
+          case INT:
+          case MONEY:
+          case SMALLINT:
+          case TINYINT:
+          case UINT1:
+          case UINT2:
+          case UINT4:
+          case UINT8:
+          case INTERVALYEAR:
+          case DATE:
+          case TIME:
+          case TIMESTAMP:
+          case BIT:
+          case DECIMAL9:
+          case DECIMAL18:
+            result.add("value");
+            return result;
+          case DECIMAL28DENSE:
+          case DECIMAL28SPARSE:
+          case DECIMAL38DENSE:
+          case DECIMAL38SPARSE:
+            result.add("start");
+            result.add("buffer");
+            result.add("scale");
+            result.add("precision");
+            return result;
+          case INTERVAL: {
+            result.add("months");
+            result.add("days");
+            result.add("milliseconds");
+            return result;
+          }
+          case INTERVALDAY: {
+            result.add("days");
+            result.add("milliseconds");
+            return result;
+          }
+          case VARDECIMAL:
+            result.add("scale");
+            result.add("precision");
+            // fall through
+          case VAR16CHAR:
+          case VARBINARY:
+          case VARCHAR:
+            result.add("start");
+            result.add("end");
+            result.add("buffer");
+            return result;
+          case UNION:
+            result.add("reader");
+            return result;
 
 Review comment:
   They are handled separately in the code generation classes, so there is no need to specify them here.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services