當前位置: 首頁>>代碼示例>>Java>>正文


Java DataMode.REQUIRED屬性代碼示例

本文整理匯總了Java中org.apache.drill.common.types.TypeProtos.DataMode.REQUIRED屬性的典型用法代碼示例。如果您正苦於以下問題:Java DataMode.REQUIRED屬性的具體用法?Java DataMode.REQUIRED怎麽用?Java DataMode.REQUIRED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.drill.common.types.TypeProtos.DataMode的用法示例。


在下文中一共展示了DataMode.REQUIRED屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLeastRestrictiveDataMode

public static DataMode getLeastRestrictiveDataMode(List<DataMode> dataModes) {
  boolean hasOptional = false;
  for(DataMode dataMode : dataModes) {
    switch (dataMode) {
      case REPEATED:
        return dataMode;
      case OPTIONAL:
        hasOptional = true;
    }
  }

  if(hasOptional) {
    return DataMode.OPTIONAL;
  } else {
    return DataMode.REQUIRED;
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:17,代碼來源:TypeCastRules.java

示例2: getDrillObjectInspector

public static ObjectInspector getDrillObjectInspector(DataMode mode, MinorType minorType) {
  try {
    if (mode == DataMode.REQUIRED) {
      if (OIMAP_REQUIRED.containsKey(minorType)) {
        return (ObjectInspector) OIMAP_REQUIRED.get(minorType).newInstance();
      }
    } else if (mode == DataMode.OPTIONAL) {
      if (OIMAP_OPTIONAL.containsKey(minorType)) {
        return (ObjectInspector) OIMAP_OPTIONAL.get(minorType).newInstance();
      }
    } else {
      throw new UnsupportedOperationException("Repeated types are not supported as arguement to Hive UDFs");
    }
  } catch(InstantiationException | IllegalAccessException e) {
    throw new RuntimeException("Failed to instantiate ObjectInspector", e);
  }

  throw new UnsupportedOperationException(
      String.format("Type %s[%s] not supported as arguement to Hive UDFs", minorType.toString(), mode.toString()));
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:20,代碼來源:ObjectInspectorHelper.java

示例3: getOtherNullableVersion

public MaterializedField getOtherNullableVersion(){
  MajorType mt = key.type;
  DataMode newDataMode = null;
  switch (mt.getMode()){
  case OPTIONAL:
    newDataMode = DataMode.REQUIRED;
    break;
  case REQUIRED:
    newDataMode = DataMode.OPTIONAL;
    break;
  default:
    throw new UnsupportedOperationException();
  }
  return new MaterializedField(key.path, mt.toBuilder().setMode(newDataMode).build());
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:15,代碼來源:MaterializedField.java

示例4: getOtherNullableVersion

public MaterializedField getOtherNullableVersion() {
  MajorType mt = type;
  DataMode newDataMode;
  switch (mt.getMode()){
  case OPTIONAL:
    newDataMode = DataMode.REQUIRED;
    break;
  case REQUIRED:
    newDataMode = DataMode.OPTIONAL;
    break;
  default:
    throw new UnsupportedOperationException();
  }
  return new MaterializedField(name, mt.toBuilder().setMode(newDataMode).build(), children);
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:15,代碼來源:MaterializedField.java

示例5: getReplacingCastFunction

/**
* Get a replacing cast function for the original function, based on the specified data mode
* @param originalCastFunction original cast function
* @param dataMode data mode of the input data
* @param inputType input (minor) type for cast
* @return the name of replaced cast function
*/
public static String getReplacingCastFunction(String originalCastFunction, DataMode dataMode, MinorType inputType) {
  if(dataMode == DataMode.OPTIONAL) {
    return getReplacingCastFunctionFromNullable(originalCastFunction, inputType);
  }

  if(dataMode == DataMode.REQUIRED) {
    return getReplacingCastFunctionFromNonNullable(originalCastFunction, inputType);
  }

  throw new RuntimeException(
     String.format("replacing cast function for datatype %s is not defined", dataMode));
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:19,代碼來源:CastFunctions.java

示例6: getDrillObjectInspector

public static ObjectInspector getDrillObjectInspector(DataMode mode, MinorType minorType, boolean varCharToStringReplacement) {
  try {
    if (mode == DataMode.REQUIRED) {
      if (OIMAP_REQUIRED.containsKey(minorType)) {
        if (varCharToStringReplacement && minorType == MinorType.VARCHAR) {
          return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[1]).newInstance();
        } else {
          return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[0]).newInstance();
        }
      }
    } else if (mode == DataMode.OPTIONAL) {
      if (OIMAP_OPTIONAL.containsKey(minorType)) {
        if (varCharToStringReplacement && minorType == MinorType.VARCHAR) {
          return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[1]).newInstance();
        } else {
          return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[0]).newInstance();
        }
      }
    } else {
      throw new UnsupportedOperationException("Repeated types are not supported as arguement to Hive UDFs");
    }
  } catch(InstantiationException | IllegalAccessException e) {
    throw new RuntimeException("Failed to instantiate ObjectInspector", e);
  }

  throw new UnsupportedOperationException(
      String.format("Type %s[%s] not supported as arguement to Hive UDFs", minorType.toString(), mode.toString()));
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:28,代碼來源:ObjectInspectorHelper.java

示例7: clone

@Override
public GroupScan clone(List<SchemaPath> columns) {
  if (columns.isEmpty()) {
    throw new IllegalArgumentException("No columns for mock scan");
  }
  List<MockColumn> mockCols = new ArrayList<>();
  Pattern p = Pattern.compile("(\\w+)_([isdb])(\\d*)");
  for (SchemaPath path : columns) {
    String col = path.getLastSegment().getNameSegment().getPath();
    if (col.equals("*")) {
      return this;
    }
    Matcher m = p.matcher(col);
    if (!m.matches()) {
      throw new IllegalArgumentException(
          "Badly formatted mock column name: " + col);
    }
    @SuppressWarnings("unused")
    String name = m.group(1);
    String type = m.group(2);
    String length = m.group(3);
    int width = 10;
    if (!length.isEmpty()) {
      width = Integer.parseInt(length);
    }
    MinorType minorType;
    switch (type) {
    case "i":
      minorType = MinorType.INT;
      break;
    case "s":
      minorType = MinorType.VARCHAR;
      break;
    case "d":
      minorType = MinorType.FLOAT8;
      break;
    case "b":
      minorType = MinorType.BIT;
      break;
    default:
      throw new IllegalArgumentException(
          "Unsupported field type " + type + " for mock column " + col);
    }
    MockTableDef.MockColumn mockCol = new MockColumn(
        col, minorType, DataMode.REQUIRED, width, 0, 0, null, 1, null);
    mockCols.add(mockCol);
  }
  MockScanEntry entry = readEntries.get(0);
  MockColumn types[] = new MockColumn[mockCols.size()];
  mockCols.toArray(types);
  MockScanEntry newEntry = new MockScanEntry(entry.records, true, 0, 1, types);
  List<MockScanEntry> newEntries = new ArrayList<>();
  newEntries.add(newEntry);
  return new MockGroupScanPOP(url, newEntries);
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:55,代碼來源:MockGroupScanPOP.java

示例8: RequiredVectorTester

public RequiredVectorTester(OperatorFixture fixture) {
  super(fixture, DataMode.REQUIRED, "Required vector");
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:3,代碼來源:PerformanceTool.java

示例9: RepeatedVectorTester

public RepeatedVectorTester(OperatorFixture fixture) {
  super(fixture, DataMode.REQUIRED, "Repeated vector");
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:3,代碼來源:PerformanceTool.java

示例10: RequiredWriterTester

public RequiredWriterTester(OperatorFixture fixture) {
  super(fixture, DataMode.REQUIRED, "Required writer");
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:3,代碼來源:PerformanceTool.java

示例11: ArrayWriterTester

public ArrayWriterTester(OperatorFixture fixture) {
  super(fixture, DataMode.REQUIRED, "Array writer");
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:3,代碼來源:PerformanceTool.java

示例12: addMap

/**
 * Add a map column. The returned schema builder is for the nested
 * map. Building that map, using {@link MapBuilder#buildMap()},
 * will return the original schema builder.
 *
 * @param pathName the name of the map column
 * @return a builder for the map
 */

public MapBuilder addMap(String pathName) {
  return new MapBuilder(this, pathName, DataMode.REQUIRED);
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:12,代碼來源:SchemaBuilder.java


注:本文中的org.apache.drill.common.types.TypeProtos.DataMode.REQUIRED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。