Codota Logo
RelDataTypeFactory.createSqlType
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain RelDataTypeFactory
private void myMethod () {
RelDataTypeFactory r =
  • Codota IconRexBuilder rexBuilder;rexBuilder.getTypeFactory()
  • Codota IconSqlOperatorBinding opBinding;opBinding.getTypeFactory()
  • Codota IconRelOptCluster cluster;cluster.getTypeFactory()
  • Smart code suggestions by Codota
}
origin: apache/flink

private void handleOffsetFetch(SqlNode offset, SqlNode fetch) {
  if (offset instanceof SqlDynamicParam) {
    setValidatedNodeType(offset,
      typeFactory.createSqlType(SqlTypeName.INTEGER));
  }
  if (fetch instanceof SqlDynamicParam) {
    setValidatedNodeType(fetch,
      typeFactory.createSqlType(SqlTypeName.INTEGER));
  }
}
origin: apache/storm

public TableBuilderInfo field(String name, SqlTypeName type) {
  return field(name, typeFactory.createSqlType(type));
}
origin: apache/hive

public List<RelDataType> getParameterTypes(RelDataTypeFactory typeFactory) {
 return ImmutableList.of(
   typeFactory.createTypeWithNullability(
     typeFactory.createSqlType(SqlTypeName.ANY), true));
}
origin: apache/hive

public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
 return typeFactory.createTypeWithNullability(
   typeFactory.createSqlType(SqlTypeName.ANY), true);
}
origin: apache/storm

public TableBuilderInfo field(String name, SqlTypeName type, ColumnConstraint constraint) {
  interpretConstraint(constraint, fields.size());
  return field(name, typeFactory.createSqlType(type));
}
origin: apache/incubator-druid

private RexNode integerLiteral(final int integer)
{
 return rexBuilder.makeLiteral(new BigDecimal(integer), typeFactory.createSqlType(SqlTypeName.INTEGER), true);
}
origin: apache/hive

/** Creates an expression that casts an expression to a given type. */
public RexNode cast(RexNode expr, SqlTypeName typeName) {
 final RelDataType type = cluster.getTypeFactory().createSqlType(typeName);
 return cluster.getRexBuilder().makeCast(type, expr);
}
origin: apache/hive

/** Creates an expression that casts an expression to a type with a given name
 * and precision or length. */
public RexNode cast(RexNode expr, SqlTypeName typeName, int precision) {
 final RelDataType type =
   cluster.getTypeFactory().createSqlType(typeName, precision);
 return cluster.getRexBuilder().makeCast(type, expr);
}
origin: apache/hive

/** Creates an expression that casts an expression to a type with a given
 * name, precision and scale. */
public RexNode cast(RexNode expr, SqlTypeName typeName, int precision,
          int scale) {
 final RelDataType type =
   cluster.getTypeFactory().createSqlType(typeName, precision, scale);
 return cluster.getRexBuilder().makeCast(type, expr);
}
origin: apache/hive

@Override
public AggregateCall other(RelDataTypeFactory typeFactory, AggregateCall e) {
 return AggregateCall.create(
   new HiveSqlCountAggFunction(isDistinct, returnTypeInference, operandTypeInference, operandTypeChecker),
   false, ImmutableIntList.of(), -1,
   typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT), true), "count");
}
origin: apache/drill

 @Override
 public AggregateCall other(RelDataTypeFactory typeFactory, AggregateCall e) {
  return AggregateCall.create(
    new HiveSqlCountAggFunction(isDistinct, returnTypeInference, operandTypeInference, operandTypeChecker),
    false, ImmutableIntList.of(), -1,
    typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT), true), "count");
 }
}
origin: apache/hive

@Override
public AggregateCall other(RelDataTypeFactory typeFactory, AggregateCall e) {
 RelDataType countRetType = typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT), true);
 return AggregateCall.create(
  new HiveSqlCountAggFunction(isDistinct, ReturnTypes.explicit(countRetType), operandTypeInference, operandTypeChecker),
  false, ImmutableIntList.of(), -1, countRetType, "count");
}
origin: apache/hive

private RexNode makeCast(SqlTypeName typeName, final RexNode child) {
 RelDataType sqlType = cluster.getTypeFactory().createSqlType(typeName);
 RelDataType nullableType = cluster.getTypeFactory().createTypeWithNullability(sqlType, true);
 return cluster.getRexBuilder().makeCast(nullableType, child);
}
origin: apache/drill

@Override
public AggregateCall other(RelDataTypeFactory typeFactory, AggregateCall e) {
 RelDataType countRetType = typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT), true);
 return AggregateCall.create(
  new HiveSqlCountAggFunction(isDistinct, ReturnTypes.explicit(countRetType), operandTypeInference, operandTypeChecker),
  false, ImmutableIntList.of(), -1, countRetType, "count");
}
origin: apache/incubator-druid

@Test
public void testTimeMinusDayTimeInterval()
{
 final Period period = new Period("P1DT1H1M");
 testExpression(
   rexBuilder.makeCall(
     typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
     SqlStdOperatorTable.MINUS_DATE,
     ImmutableList.of(
       inputRef("t"),
       rexBuilder.makeIntervalLiteral(
         new BigDecimal(period.toStandardDuration().getMillis()), // DAY-TIME literals value is millis
         new SqlIntervalQualifier(TimeUnit.DAY, TimeUnit.MINUTE, SqlParserPos.ZERO)
       )
     )
   ),
   DruidExpression.of(
     null,
     "(\"t\" - 90060000)"
   ),
   DateTimes.of("2000-02-03T04:05:06").minus(period).getMillis()
 );
}
origin: apache/incubator-druid

@Test
public void testConcat()
{
 testExpression(
   rexBuilder.makeCall(
     typeFactory.createSqlType(SqlTypeName.VARCHAR),
     SqlStdOperatorTable.CONCAT,
     ImmutableList.of(
       inputRef("s"),
       rexBuilder.makeLiteral("bar")
     )
   ),
   DruidExpression.fromExpression("concat(\"s\",'bar')"),
   "foobar"
 );
}
origin: apache/incubator-druid

@Test
public void testTimeMinusYearMonthInterval()
{
 final Period period = new Period("P1Y1M");
 testExpression(
   rexBuilder.makeCall(
     typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
     SqlStdOperatorTable.MINUS_DATE,
     ImmutableList.of(
       inputRef("t"),
       rexBuilder.makeIntervalLiteral(
         new BigDecimal(13), // YEAR-MONTH literals value is months
         new SqlIntervalQualifier(TimeUnit.YEAR, TimeUnit.MONTH, SqlParserPos.ZERO)
       )
     )
   ),
   DruidExpression.of(
     null,
     "timestamp_shift(\"t\",concat('P', 13, 'M'),-1)"
   ),
   DateTimes.of("2000-02-03T04:05:06").minus(period).getMillis()
 );
}
origin: apache/incubator-druid

@Test
public void testCastAsDate()
{
 testExpression(
   rexBuilder.makeAbstractCast(
     typeFactory.createSqlType(SqlTypeName.DATE),
     inputRef("t")
   ),
   DruidExpression.fromExpression("timestamp_floor(\"t\",'P1D',null,'UTC')"),
   DateTimes.of("2000-02-03").getMillis()
 );
 testExpression(
   rexBuilder.makeAbstractCast(
     typeFactory.createSqlType(SqlTypeName.DATE),
     inputRef("dstr")
   ),
   DruidExpression.fromExpression(
     "timestamp_floor(timestamp_parse(\"dstr\",null,'UTC'),'P1D',null,'UTC')"
   ),
   DateTimes.of("2000-02-03").getMillis()
 );
}
origin: apache/incubator-druid

@Test
public void testCastAsTimestamp()
{
 testExpression(
   rexBuilder.makeAbstractCast(
     typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
     inputRef("t")
   ),
   DruidExpression.of(
     SimpleExtraction.of("t", null),
     "\"t\""
   ),
   DateTimes.of("2000-02-03T04:05:06Z").getMillis()
 );
 testExpression(
   rexBuilder.makeAbstractCast(
     typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
     inputRef("tstr")
   ),
   DruidExpression.of(
     null,
     "timestamp_parse(\"tstr\",null,'UTC')"
   ),
   DateTimes.of("2000-02-03T04:05:06Z").getMillis()
 );
}
origin: apache/incubator-druid

@Test
public void testTimeShift()
{
 testExpression(
   rexBuilder.makeCall(
     new TimeShiftOperatorConversion().calciteOperator(),
     inputRef("t"),
     rexBuilder.makeLiteral("PT2H"),
     rexBuilder.makeLiteral(-3, typeFactory.createSqlType(SqlTypeName.INTEGER), true)
   ),
   DruidExpression.fromExpression("timestamp_shift(\"t\",'PT2H',-3)"),
   DateTimes.of("2000-02-02T22:05:06").getMillis()
 );
}
org.apache.calcite.rel.typeRelDataTypeFactorycreateSqlType

Javadoc

Creates a SQL type with no precision or scale.

Popular methods of RelDataTypeFactory

  • 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.
  • createTypeWithCharsetAndCollation
    Creates a type that is the same as another type but with possibly different charset or collation. Fo
  • 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

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now