congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SqlDialect.getDatabaseProduct
Code IndexAdd Tabnine to your IDE (free)

How to use
getDatabaseProduct
method
in
org.apache.calcite.sql.SqlDialect

Best Java code snippets using org.apache.calcite.sql.SqlDialect.getDatabaseProduct (Showing top 5 results out of 315)

origin: qubole/quark

public Result visitSort(Sort e) {
 final Result x = visitChild(0, e.getInput());
 final Builder builder = x.builder(e, Clause.ORDER_BY);
 List<SqlNode> orderByList = Expressions.list();
 for (RelFieldCollation fieldCollation : e.getCollation().getFieldCollations()) {
  if (fieldCollation.nullDirection != RelFieldCollation.NullDirection.UNSPECIFIED
    && dialect.getDatabaseProduct() == SqlDialect.DatabaseProduct.MYSQL) {
   orderByList.add(
     ISNULL_FUNCTION.createCall(POS,
       builder.context.field(fieldCollation.getFieldIndex())));
   fieldCollation = new RelFieldCollation(fieldCollation.getFieldIndex(),
     fieldCollation.getDirection());
  }
  orderByList.add(builder.context.toSql(fieldCollation));
 }
 builder.setOrderBy(new SqlNodeList(orderByList, POS));
 return builder.result();
}
origin: qubole/quark

switch (sqlDialect.getDatabaseProduct()) {
 case MYSQL:
 case HSQLDB:
  selectList.add(nullLiteral);
  final SqlNode unionOperand;
  switch (sqlDialect.getDatabaseProduct()) {
   case MYSQL:
    wrappedOperand = operand;
    + sqlDialect.getDatabaseProduct());
  return aggCall;
origin: qubole/quark

 public static String getParsedSql(RelNode relNode, SqlDialect dialect) throws SQLException {
  if (dialect.getDatabaseProduct() == SqlDialect.DatabaseProduct.HIVE) {
   final HepProgram program = new HepProgramBuilder()
     .addRuleInstance(JoinCalcTransposeRule.LEFT_CALC)
     .addRuleInstance(JoinCalcTransposeRule.RIGHT_CALC)
     .addRuleInstance(CalcMergeRule.INSTANCE)
     .build();
   final RelOptPlanner planner = relNode.getCluster().getPlanner();
   final HepPlanner hepPlanner =
     new HepPlanner(program, planner.getContext());
   hepPlanner.setRoot(relNode);
   relNode = hepPlanner.findBestExp();
  }
  RelToSqlConverter relToSqlConverter = new RelToSqlConverter(dialect);
  RelToSqlConverter.Result res = relToSqlConverter.visitChild(0, relNode);
  SqlNode sqlNode = res.asQuery();
  String result = sqlNode.toSqlString(dialect, false).getSql();
  return result.replace("\n", " ");
 }
}
origin: qubole/quark

private SqlNode toSql(RelDataType type) {
 switch (dialect.getDatabaseProduct()) {
  case MYSQL:
   switch (type.getSqlTypeName()) {
    case VARCHAR:
     // MySQL doesn't have a VARCHAR type, only CHAR.
     return new SqlDataTypeSpec(new SqlIdentifier("CHAR", POS),
       type.getPrecision(), -1, null, null, POS);
    case INTEGER:
     return new SqlDataTypeSpec(new SqlIdentifier("_UNSIGNED", POS),
       type.getPrecision(), -1, null, null, POS);
   }
   break;
 }
 if (type instanceof BasicSqlType) {
  return new SqlDataTypeSpec(
    new SqlIdentifier(type.getSqlTypeName().name(), POS),
    type.getPrecision(),
    type.getScale(),
    type.getCharset() != null
      && dialect.supportsCharSet()
      ? type.getCharset().name()
      : null,
    null,
    POS);
 }
 return SqlTypeUtil.convertTypeToSpec(type);
 //throw new AssertionError(type); // TODO: implement
}
origin: dremio/dremio-oss

final String viewSql = createView.getQuery().toSqlString(new SqlDialect(SqlDialect.CALCITE.getDatabaseProduct(), SqlDialect.CALCITE.getDatabaseProduct().name(), ParserConfig.QUOTING.string)).getSql();
final ConvertedRelNode convertedRelNode = PrelTransformer.validateAndConvert(config, createView.getQuery());
final RelDataType validatedRowType = convertedRelNode.getValidatedRowType();
org.apache.calcite.sqlSqlDialectgetDatabaseProduct

Javadoc

Returns the database this dialect belongs to, SqlDialect.DatabaseProduct#UNKNOWN if not known, never null.

Please be judicious in how you use this method. If you wish to determine whether a dialect has a particular capability or behavior, it is usually better to add a method to SqlDialect and override that method in particular sub-classes of SqlDialect.

Popular methods of SqlDialect

  • quoteStringLiteral
    Converts a string into a string literal. For example, can't run becomes 'can''t run'.
  • unparseCall
  • <init>
    Creates a SqlDialect.
  • quoteIdentifier
    Quotes a multi-part identifier.
  • supportsAggregateFunction
  • supportsCharSet
    Returns whether the dialect supports character set names as part of a data type, for instance VARCHA
  • allowsAs
  • containsNonAscii
    Returns whether the string contains any characters outside the comfortable 7-bit ASCII range (32 thr
  • defaultNullDirection
    Returns whether NULL values are sorted first or last, in this dialect, in an ORDER BY item of a give
  • emulateNullDirection
    Returns the SqlNode for emulating the null direction for the given field or null if no emulation ne
  • getCalendarPolicy
  • getCastSpec
  • getCalendarPolicy,
  • getCastSpec,
  • getNullCollation,
  • hasImplicitTableAlias,
  • identifierNeedsToBeQuoted,
  • quoteStringLiteralUnicode,
  • quoteTimestampLiteral,
  • rewriteSingleValueExpr,
  • supportsAliasedValues

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • getResourceAsStream (ClassLoader)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Collectors (java.util.stream)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Best IntelliJ plugins
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