Tabnine Logo
Type
Code IndexAdd Tabnine to your IDE (free)

How to use
Type
in
org.apache.kudu

Best Java code snippets using org.apache.kudu.Type (Showing top 20 results out of 315)

origin: apache/nifi

switch (colType.getDataType(colSchema.getTypeAttributes())) {
  case BOOL:
    row.addBoolean(colIdx, record.getAsBoolean(colName));
origin: Impetus/Kundera

.equals(KuduDBValidationClassMapper.getValidTypeForClass(columnInfo.getType())))
origin: org.apache.kudu/kudu-client

public static Type getTypeForName(String name) {
 for (Type t : values()) {
  if (t.name().equals(name)) {
   return t;
  }
 }
 throw new IllegalArgumentException("The provided name doesn't map to any known type: " + name);
}
origin: org.apache.kudu/kudu-client

private void checkType(int columnIndex, Type expectedType) {
 ColumnSchema columnSchema = schema.getColumnByIndex(columnIndex);
 Type columnType = columnSchema.getType();
 if (!columnType.equals(expectedType)) {
  throw new IllegalArgumentException("Column (name: " + columnSchema.getName() +
    ", index: " + columnIndex + ") is of type " +
    columnType.getName() + " but was requested as a type " + expectedType.getName());
 }
}
origin: org.apache.kudu/kudu-client

int columnIdx = table.getSchema().getColumnIndex(column.getName());
ColumnSchema schema = table.getSchema().getColumnByIndex(columnIdx);
if (column.getType() != schema.getType().getDataType(schema.getTypeAttributes())) {
 throw new IllegalStateException(String.format(
   "invalid type %s for column '%s' in scan token, expected: %s",
   column.getType().name(), column.getName(), schema.getType().name()));
origin: org.apache.kudu/kudu-client-tools

private static PrimitiveType.PrimitiveTypeName getTypeName(Type type) {
 switch (type) {
  case BOOL:
   return PrimitiveType.PrimitiveTypeName.BOOLEAN;
  case INT8:
   return PrimitiveType.PrimitiveTypeName.INT32;
  case INT16:
   return PrimitiveType.PrimitiveTypeName.INT64;
  case INT32:
   return PrimitiveType.PrimitiveTypeName.INT32;
  case INT64:
   return PrimitiveType.PrimitiveTypeName.INT64;
  case STRING:
   return PrimitiveType.PrimitiveTypeName.BINARY;
  case FLOAT:
   return PrimitiveType.PrimitiveTypeName.FLOAT;
  case DOUBLE:
   return PrimitiveType.PrimitiveTypeName.DOUBLE;
  default:
   throw new IllegalArgumentException("Type " + type.getName() + " not recognized");
 }
}
origin: org.apache.kudu/kudu-client

private Type getShiftedType(Type type) {
 int shiftedPosition = (type.ordinal() + 1) % Type.values().length;
 return Type.values()[shiftedPosition];
}
origin: org.apache.kudu/kudu-client

private ColumnSchema(String name, Type type, boolean key, boolean nullable,
           Object defaultValue, int desiredBlockSize, Encoding encoding,
           CompressionAlgorithm compressionAlgorithm, ColumnTypeAttributes typeAttributes) {
 this.name = name;
 this.type = type;
 this.key = key;
 this.nullable = nullable;
 this.defaultValue = defaultValue;
 this.desiredBlockSize = desiredBlockSize;
 this.encoding = encoding;
 this.compressionAlgorithm = compressionAlgorithm;
 this.typeAttributes = typeAttributes;
 this.typeSize = type.getSize(typeAttributes);
}
origin: org.apache.kudu/kudu-client

/**
 * Private constructor used to pre-create the types
 * @param dataType DataType from the common's pb
 * @param name string representation of the type
 */
private Type(DataType dataType, String name) {
 this.dataTypes = ImmutableList.of(dataType);
 this.name = name;
 this.size = getTypeSize(dataType);
}
origin: org.apache.kudu/kudu-client

buf.append(type.name());
buf.append(" ").append(col.getName());
if (col.getTypeAttributes() != null) {
origin: org.apache.kudu/kudu-client

public static ColumnSchema pbToColumnSchema(Common.ColumnSchemaPB pb) {
 Type type = Type.getTypeForDataType(pb.getType());
 ColumnTypeAttributes typeAttributes = pb.hasTypeAttributes() ?
   pbToColumnTypeAttributes(pb.getTypeAttributes()) : null;
 Object defaultValue = pb.hasWriteDefaultValue() ?
   byteStringToObject(type, typeAttributes, pb.getWriteDefaultValue()) : null;
 ColumnSchema.Encoding encoding = ColumnSchema.Encoding.valueOf(pb.getEncoding().name());
 ColumnSchema.CompressionAlgorithm compressionAlgorithm =
   ColumnSchema.CompressionAlgorithm.valueOf(pb.getCompression().name());
 int desiredBlockSize = pb.getCfileBlockSize();
 return new ColumnSchema.ColumnSchemaBuilder(pb.getName(), type)
             .key(pb.getIsKey())
             .nullable(pb.getIsNullable())
             .defaultValue(defaultValue)
             .encoding(encoding)
             .compressionAlgorithm(compressionAlgorithm)
             .desiredBlockSize(desiredBlockSize)
             .typeAttributes(typeAttributes)
             .build();
}
origin: org.apache.kudu/kudu-client

 private void checkColumn(Type... passedTypes) {
  for (Type type : passedTypes) {
   if (this.column.getType().equals(type)) {
    return;
   }
  }
  throw new IllegalArgumentException(String.format("%s's type isn't %s, it's %s",
    column.getName(), Arrays.toString(passedTypes), column.getType().getName()));
 }
}
origin: org.apache.kudu/kudu-client

@Override
public String toString() {
 StringBuilder sb = new StringBuilder();
 sb.append("Column name: ");
 sb.append(name);
 sb.append(", type: ");
 sb.append(type.getName());
 if (typeAttributes != null) {
  sb.append(typeAttributes.toStringForType(type));
 }
 return sb.toString();
}
origin: org.apache.kudu/kudu-client

/**
 * Builds an IN list predicate from a collection of raw values. The collection
 * must be sorted and deduplicated.
 *
 * @param column the column
 * @param values the IN list values
 * @return an IN list predicate
 */
private static KuduPredicate buildInList(ColumnSchema column, Collection<byte[]> values) {
 // IN (true, false) predicates can be simplified to IS NOT NULL.
 if (column.getType().getDataType(column.getTypeAttributes()) ==
   Common.DataType.BOOL && values.size() > 1) {
  return newIsNotNullPredicate(column);
 }
 switch (values.size()) {
  case 0: return KuduPredicate.none(column);
  case 1: return new KuduPredicate(PredicateType.EQUALITY, column,
                   values.iterator().next(), null);
  default: return new KuduPredicate(column, values.toArray(new byte[values.size()][]));
 }
}
origin: org.apache.kudu/kudu-client

/**
 * Checks that the column is one of the expected types.
 * @param column the column being checked
 * @param passedTypes the expected types (logical OR)
 */
private static void checkColumn(ColumnSchema column, Type... passedTypes) {
 for (Type type : passedTypes) {
  if (column.getType().equals(type)) {
   return;
  }
 }
 throw new IllegalArgumentException(String.format("%s's type isn't %s, it's %s",
                          column.getName(), Arrays.toString(passedTypes),
                          column.getType().getName()));
}
origin: org.apache.kudu/kudu-client

/**
 * Appends a debug string for the provided columns in the row.
 *
 * @param idxs the column indexes
 * @param sb the string builder to append to
 */
void appendDebugString(List<Integer> idxs, StringBuilder sb) {
 boolean first = true;
 for (int idx : idxs) {
  if (first) {
   first = false;
  } else {
   sb.append(", ");
  }
  ColumnSchema col = schema.getColumnByIndex(idx);
  sb.append(col.getType().getName());
  sb.append(' ');
  sb.append(col.getName());
  sb.append('=');
  appendCellValueDebugString(idx, sb);
 }
}
origin: apache/apex-malhar

switch ( aKuduTableColumn.getType().getDataType().getNumber()) {
 case Common.DataType.BINARY_VALUE:
  setterMap.put(kuduColumnName,PojoUtils.createSetter(clazzForResultObject,
origin: org.apache.kudu/kudu-client

/**
 * Verifies if the column exists and belongs to one of the specified types
 * @param column column the user wants to set
 * @param types types we expect
 * @throws IllegalArgumentException if the column or type was invalid
 */
private void checkColumn(ColumnSchema column, Type... types) {
 checkColumnExists(column);
 for (Type type : types) {
  if (column.getType().equals(type)) {
   return;
  }
 }
 throw new IllegalArgumentException(String.format("%s isn't %s, it's %s", column.getName(),
   Arrays.toString(types), column.getType().getName()));
}
origin: org.apache.kudu/kudu-client

/** {@inheritDoc} */
@Override
public String toString() {
 int numCols = schema.getColumnCount();
 StringBuilder sb = new StringBuilder();
 sb.append('(');
 boolean first = true;
 for (int idx = 0; idx < numCols; ++idx) {
  if (!columnsBitSet.get(idx)) {
   continue;
  }
  if (first) {
   first = false;
  } else {
   sb.append(", ");
  }
  ColumnSchema col = schema.getColumnByIndex(idx);
  sb.append(col.getType().getName());
  if (col.getTypeAttributes() != null) {
   sb.append(col.getTypeAttributes().toStringForType(col.getType()));
  }
  sb.append(' ');
  sb.append(col.getName());
  sb.append('=');
  appendCellValueDebugString(idx, sb);
 }
 sb.append(')');
 return sb.toString();
}
origin: org.apache.kudu/kudu-client

switch (column.getType().getDataType(column.getTypeAttributes())) {
 case BOOL: return Boolean.toString(Bytes.getBoolean(value));
 case INT8: return Byte.toString(Bytes.getByte(value));
org.apache.kuduType

Javadoc

Describes all the types available to build table schemas.

Most used methods

  • getDataType
    Get the data type from the common's pb
  • equals
  • getName
    Get the string representation of this type
  • values
  • getSize
    The size of this type on the wire
  • getTypeForDataType
    Convert the pb DataType to a Type
  • getTypeSize
    Gives the size in bytes for a given DataType, as per the pb specification
  • name
  • ordinal
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JButton (javax.swing)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now