Tabnine Logo
RelDataTypeFactory.createTypeWithCharsetAndCollation
Code IndexAdd Tabnine to your IDE (free)

How to use
createTypeWithCharsetAndCollation
method
in
org.apache.calcite.rel.type.RelDataTypeFactory

Best Java code snippets using org.apache.calcite.rel.type.RelDataTypeFactory.createTypeWithCharsetAndCollation (Showing top 20 results out of 315)

origin: apache/drill

private RelDataType getRelDataType(PrimitiveTypeInfo pTypeInfo, SqlTypeName typeName) {
 int maxLen = TypeInfoUtils.getCharacterLengthForType(pTypeInfo);
 RelDataType relDataType = typeFactory.createSqlType(typeName, maxLen);
 return typeFactory.createTypeWithCharsetAndCollation(relDataType, Util.getDefaultCharset(),
   SqlCollation.IMPLICIT);
}
origin: apache/incubator-druid

/**
 * Like RelDataTypeFactory.createSqlTypeWithNullability, but creates types that align best with how Druid
 * represents them.
 */
public static RelDataType createSqlTypeWithNullability(
  final RelDataTypeFactory typeFactory,
  final SqlTypeName typeName,
  final boolean nullable
)
{
 final RelDataType dataType;
 switch (typeName) {
  case TIMESTAMP:
   // Our timestamps are down to the millisecond (precision = 3).
   dataType = typeFactory.createSqlType(typeName, 3);
   break;
  case CHAR:
  case VARCHAR:
   dataType = typeFactory.createTypeWithCharsetAndCollation(
     typeFactory.createSqlType(typeName),
     Calcites.defaultCharset(),
     SqlCollation.IMPLICIT
   );
   break;
  default:
   dataType = typeFactory.createSqlType(typeName);
 }
 return typeFactory.createTypeWithNullability(dataType, nullable);
}
origin: apache/hive

 break;
case STRING:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.VARCHAR, Integer.MAX_VALUE),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
 break;
case VARCHAR:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.VARCHAR, ((BaseCharTypeInfo) type).getLength()),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
 break;
case CHAR:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.CHAR, ((BaseCharTypeInfo) type).getLength()),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
origin: apache/drill

 break;
case STRING:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.VARCHAR, Integer.MAX_VALUE),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
 break;
case VARCHAR:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.VARCHAR, ((BaseCharTypeInfo) type).getLength()),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
 break;
case CHAR:
 convertedType = dtFactory.createTypeWithCharsetAndCollation(
     dtFactory.createSqlType(SqlTypeName.CHAR, ((BaseCharTypeInfo) type).getLength()),
     Charset.forName(ConversionUtil.NATIVE_UTF16_CHARSET_NAME), SqlCollation.IMPLICIT);
origin: apache/flink

if (SqlTypeUtil.inCharFamily(inferredType)) {
  newInferredType =
    typeFactory.createTypeWithCharsetAndCollation(
      newInferredType,
      inferredType.getCharset(),
origin: Qihoo360/Quicksql

    str.getValue().length());
type =
  typeFactory.createTypeWithCharsetAndCollation(
    type,
    charset,
origin: org.apache.calcite/calcite-core

    str.getValue().length());
type =
  typeFactory.createTypeWithCharsetAndCollation(
    type,
    charset,
origin: Qihoo360/Quicksql

typeFactory.createTypeWithCharsetAndCollation(
  type,
  charset,
origin: org.apache.kylin/atopcalcite

typeFactory.createTypeWithCharsetAndCollation(
    type,
    charset,
origin: org.apache.druid/druid-sql

/**
 * Like RelDataTypeFactory.createSqlTypeWithNullability, but creates types that align best with how Druid
 * represents them.
 */
public static RelDataType createSqlTypeWithNullability(
  final RelDataTypeFactory typeFactory,
  final SqlTypeName typeName,
  final boolean nullable
)
{
 final RelDataType dataType;
 switch (typeName) {
  case TIMESTAMP:
   // Our timestamps are down to the millisecond (precision = 3).
   dataType = typeFactory.createSqlType(typeName, 3);
   break;
  case CHAR:
  case VARCHAR:
   dataType = typeFactory.createTypeWithCharsetAndCollation(
     typeFactory.createSqlType(typeName),
     Calcites.defaultCharset(),
     SqlCollation.IMPLICIT
   );
   break;
  default:
   dataType = typeFactory.createSqlType(typeName);
 }
 return typeFactory.createTypeWithNullability(dataType, nullable);
}
origin: org.apache.calcite/calcite-core

typeFactory.createTypeWithCharsetAndCollation(
  type,
  charset,
origin: Qihoo360/Quicksql

protected RelDataType adjustType(
  SqlValidator validator,
  SqlCall call,
  RelDataType type) {
 if (SqlTypeUtil.inCharFamily(type)) {
  // Determine coercibility and resulting collation name of
  // unary operator if needed.
  RelDataType operandType =
    validator.getValidatedNodeType(call.operand(0));
  if (null == operandType) {
   throw new AssertionError("operand's type should have been derived");
  }
  if (SqlTypeUtil.inCharFamily(operandType)) {
   SqlCollation collation = operandType.getCollation();
   assert null != collation
     : "An implicit or explicit collation should have been set";
   type =
     validator.getTypeFactory()
       .createTypeWithCharsetAndCollation(
         type,
         type.getCharset(),
         new SqlCollation(
           collation.getCollationName(),
           collation.getCoercibility()));
  }
 }
 return type;
}
origin: Qihoo360/Quicksql

protected RelDataType adjustType(
  SqlValidator validator,
  SqlCall call,
  RelDataType type) {
 if (SqlTypeUtil.inCharFamily(type)) {
  // Determine coercibility and resulting collation name of
  // unary operator if needed.
  RelDataType operandType =
    validator.getValidatedNodeType(call.operand(0));
  if (null == operandType) {
   throw new AssertionError("operand's type should have been derived");
  }
  if (SqlTypeUtil.inCharFamily(operandType)) {
   SqlCollation collation = operandType.getCollation();
   assert null != collation
     : "An implicit or explicit collation should have been set";
   type =
     validator.getTypeFactory()
       .createTypeWithCharsetAndCollation(
         type,
         type.getCharset(),
         new SqlCollation(
           collation.getCollationName(),
           collation.getCoercibility()));
  }
 }
 return type;
}
origin: org.apache.calcite/calcite-core

protected RelDataType adjustType(
  SqlValidator validator,
  SqlCall call,
  RelDataType type) {
 if (SqlTypeUtil.inCharFamily(type)) {
  // Determine coercibility and resulting collation name of
  // unary operator if needed.
  RelDataType operandType =
    validator.getValidatedNodeType(call.operand(0));
  if (null == operandType) {
   throw new AssertionError("operand's type should have been derived");
  }
  if (SqlTypeUtil.inCharFamily(operandType)) {
   SqlCollation collation = operandType.getCollation();
   assert null != collation
     : "An implicit or explicit collation should have been set";
   type =
     validator.getTypeFactory()
       .createTypeWithCharsetAndCollation(
         type,
         type.getCharset(),
         new SqlCollation(
           collation.getCollationName(),
           collation.getCoercibility()));
  }
 }
 return type;
}
origin: org.apache.calcite/calcite-core

protected RelDataType adjustType(
  SqlValidator validator,
  SqlCall call,
  RelDataType type) {
 if (SqlTypeUtil.inCharFamily(type)) {
  // Determine coercibility and resulting collation name of
  // unary operator if needed.
  RelDataType operandType =
    validator.getValidatedNodeType(call.operand(0));
  if (null == operandType) {
   throw new AssertionError("operand's type should have been derived");
  }
  if (SqlTypeUtil.inCharFamily(operandType)) {
   SqlCollation collation = operandType.getCollation();
   assert null != collation
     : "An implicit or explicit collation should have been set";
   type =
     validator.getTypeFactory()
       .createTypeWithCharsetAndCollation(
         type,
         type.getCharset(),
         new SqlCollation(
           collation.getCollationName(),
           collation.getCoercibility()));
  }
 }
 return type;
}
origin: Qihoo360/Quicksql

type =
  validator.getTypeFactory()
    .createTypeWithCharsetAndCollation(
      type,
      type.getCharset(),
origin: org.apache.calcite/calcite-core

type =
  validator.getTypeFactory()
    .createTypeWithCharsetAndCollation(
      type,
      type.getCharset(),
origin: Qihoo360/Quicksql

type =
  validator.getTypeFactory()
    .createTypeWithCharsetAndCollation(
      type,
      type.getCharset(),
origin: org.apache.calcite/calcite-core

public RelDataType transformType(
  SqlOperatorBinding opBinding,
  RelDataType typeToTransform) {
 switch (typeToTransform.getSqlTypeName()) {
 case VARCHAR:
 case VARBINARY:
  return typeToTransform;
 }
 SqlTypeName retTypeName = toVar(typeToTransform);
 RelDataType ret =
   opBinding.getTypeFactory().createSqlType(
     retTypeName,
     typeToTransform.getPrecision());
 if (SqlTypeUtil.inCharFamily(typeToTransform)) {
  ret =
    opBinding.getTypeFactory()
      .createTypeWithCharsetAndCollation(
        ret,
        typeToTransform.getCharset(),
        typeToTransform.getCollation());
 }
 return opBinding.getTypeFactory().createTypeWithNullability(
   ret,
   typeToTransform.isNullable());
}
origin: Qihoo360/Quicksql

public RelDataType transformType(
  SqlOperatorBinding opBinding,
  RelDataType typeToTransform) {
 switch (typeToTransform.getSqlTypeName()) {
 case VARCHAR:
 case VARBINARY:
  return typeToTransform;
 }
 SqlTypeName retTypeName = toVar(typeToTransform);
 RelDataType ret =
   opBinding.getTypeFactory().createSqlType(
     retTypeName,
     typeToTransform.getPrecision());
 if (SqlTypeUtil.inCharFamily(typeToTransform)) {
  ret =
    opBinding.getTypeFactory()
      .createTypeWithCharsetAndCollation(
        ret,
        typeToTransform.getCharset(),
        typeToTransform.getCollation());
 }
 return opBinding.getTypeFactory().createTypeWithNullability(
   ret,
   typeToTransform.isNullable());
}
org.apache.calcite.rel.typeRelDataTypeFactorycreateTypeWithCharsetAndCollation

Javadoc

Creates a type that is the same as another type but with possibly different charset or collation. For types without a concept of charset or collation this function must throw an error.

Popular methods of RelDataTypeFactory

  • createSqlType
    Creates a SQL type with precision and scale.
  • createTypeWithNullability
    Creates a type that is the same as another type but with possibly different nullability. The output
  • createStructType
    Creates a type that represents a structured collection of fields, given lists of the names and types
  • builder
    Creates a org.apache.calcite.rel.type.RelDataTypeFactory.FieldInfoBuilder. But since FieldInfoBuilde
  • createMapType
    Creates a map type. Maps are unordered collections of key/value pairs.
  • getTypeSystem
    Returns the type system.
  • createArrayType
    Creates an array type. Arrays are ordered collections of elements.
  • createJavaType
    Creates a type that corresponds to a Java class.
  • createSqlIntervalType
    Creates a SQL interval type.
  • leastRestrictive
    Returns the most general of a set of types (that is, one type to which they can all be cast), or nul
  • createMultisetType
    Creates a multiset type. Multisets are unordered collections of elements.
  • copyType
    Duplicates a type, making a deep copy. Normally, this is a no-op, since canonical type objects are r
  • createMultisetType,
  • copyType,
  • createUnknownType,
  • getDefaultCharset,
  • createJoinType,
  • useDoubleMultiplication

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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