drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] vdiravka commented on a change in pull request #1686: DRILL-6524: Prevent incorrect scalar replacement for the case of assigning references inside if block
Date Tue, 12 Mar 2019 16:43:59 GMT
vdiravka 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_r264773286
 
 

 ##########
 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:
   What about additional datatypes: `MAP`, `LIST`, `NULL` ( and others from `Types.getBaseSqlTypeName()`)?
   Is `emptyResult` fine for them?

----------------------------------------------------------------
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

Mime
View raw message