Enum SqlConformanceEnum

java.lang.Object
java.lang.Enum<SqlConformanceEnum>
org.apache.calcite.sql.validate.SqlConformanceEnum
All Implemented Interfaces:
Serializable, Comparable<SqlConformanceEnum>, Constable, SqlConformance

public enum SqlConformanceEnum extends Enum<SqlConformanceEnum> implements SqlConformance
Enumeration of built-in SQL compatibility modes.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Conformance value that allows anything supported by any dialect.
    Conformance value that instructs Calcite to use SQL semantics consistent with BigQuery.
    Calcite's default SQL behavior.
    Conformance value that allows just about everything supported by Calcite.
    Conformance value that instructs Calcite to use SQL semantics consistent with MySQL version 5.x.
    Conformance value that instructs Calcite to use SQL semantics consistent with Oracle version 10.
    Conformance value that instructs Calcite to use SQL semantics consistent with Oracle version 12.
    Conformance value that instructs Calcite to use SQL semantics consistent with the SQL:2003 standard, but ignoring its more inconvenient or controversial dicta.
    Conformance value that instructs Calcite to use SQL semantics consistent with the SQL:99 standard, but ignoring its more inconvenient or controversial dicta.
    Conformance value that instructs Calcite to use SQL semantics consistent with Presto.
    Conformance value that instructs Calcite to use SQL semantics consistent with Microsoft SQL Server version 2008.
    Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:2003 standard.
    Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:92 standard.
    Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:99 standard.
  • Field Summary

    Fields inherited from interface org.apache.calcite.sql.validate.SqlConformance

    DEFAULT, ORACLE_10, PRAGMATIC_2003, PRAGMATIC_99, STRICT_2003, STRICT_92, STRICT_99
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether directly alias array items in UNNEST.
    boolean
    Whether this dialect allows character literals as column aliases.
    boolean
    Whether to allow SQL syntax "ROW(expr1, expr2, expr3)".
    boolean
    Whether to allow mixing table columns with extended columns in INSERT (or UPSERT).
    boolean
    Whether TRIM should support more than one trim character.
    boolean
    Whether to allow geo-spatial extensions, including the GEOMETRY type.
    boolean
    Whether to allow hyphens in an unquoted table name.
    boolean
    Whether to allow lenient type coercions.
    boolean
    Whether to allow parentheses to be specified in calls to niladic functions and procedures (that is, functions and procedures with no parameters).
    boolean
    Whether interval literals should allow plural time units such as "YEARS" and "DAYS" in interval literals.
    boolean
    Whether to allow a qualified common column in a query that has a NATURAL join or a join with a USING clause.
    boolean
    Whether CROSS APPLY and OUTER APPLY operators are allowed in the parser.
    boolean
    Whether the bang-equal token != is allowed as an alternative to <> in the parser.
    boolean
    Whether FROM clause is required in a SELECT statement.
    boolean
    Whether to allow aliases from the SELECT clause to be used as column names in the GROUP BY clause.
    boolean
    Whether GROUP BY 2 is interpreted to mean 'group by the 2nd column in the select list'.
    boolean
    Whether to allow aliases from the SELECT clause to be used as column names in the HAVING clause.
    boolean
    Whether to allow INSERT (or UPSERT) with no column list but fewer values than the target table.
    boolean
    Whether this dialect supports features from a wide variety of dialects.
    boolean
    Whether to allow the SQL syntax "LIMIT start, count".
    boolean
    Whether MINUS is allowed as an alternative to EXCEPT in the parser.
    boolean
    Whether to allow the SQL syntax "OFFSET start LIMIT count" (that is, OFFSET before LIMIT, in addition to LIMIT before OFFSET and OFFSET before FETCH).
    boolean
    Whether the "%" operator is allowed by the parser as an alternative to the mod function.
    boolean
    Whether 'ORDER BY x' is interpreted to mean 'sort by the select list item whose alias is x' even if there is a column called x.
    boolean
    Whether "empno" is invalid in "select empno as x from emp order by empno" because the alias "x" obscures it.
    boolean
    Whether 'ORDER BY 2' is interpreted to mean 'sort by the 2nd column in the select list'.
    boolean
    Whether VALUE is allowed as an alternative to VALUES in the parser.
    Controls the behavior of operators that are part of Standard SQL but nevertheless have different behavior in different databases.
    boolean
    Whether the least restrictive type of a number of CHAR types of different lengths should be a VARCHAR type.
    boolean
    Whether to split a quoted table name.
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • DEFAULT

      public static final SqlConformanceEnum DEFAULT
      Calcite's default SQL behavior.
    • LENIENT

      public static final SqlConformanceEnum LENIENT
      Conformance value that allows just about everything supported by Calcite.
    • BABEL

      public static final SqlConformanceEnum BABEL
      Conformance value that allows anything supported by any dialect. Even more liberal than LENIENT.
    • STRICT_92

      public static final SqlConformanceEnum STRICT_92
      Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:92 standard.
    • STRICT_99

      public static final SqlConformanceEnum STRICT_99
      Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:99 standard.
    • PRAGMATIC_99

      public static final SqlConformanceEnum PRAGMATIC_99
      Conformance value that instructs Calcite to use SQL semantics consistent with the SQL:99 standard, but ignoring its more inconvenient or controversial dicta.
    • BIG_QUERY

      public static final SqlConformanceEnum BIG_QUERY
      Conformance value that instructs Calcite to use SQL semantics consistent with BigQuery.
    • MYSQL_5

      public static final SqlConformanceEnum MYSQL_5
      Conformance value that instructs Calcite to use SQL semantics consistent with MySQL version 5.x.
    • ORACLE_10

      public static final SqlConformanceEnum ORACLE_10
      Conformance value that instructs Calcite to use SQL semantics consistent with Oracle version 10.
    • ORACLE_12

      public static final SqlConformanceEnum ORACLE_12
      Conformance value that instructs Calcite to use SQL semantics consistent with Oracle version 12.

      As ORACLE_10 except for isApplyAllowed().

    • STRICT_2003

      public static final SqlConformanceEnum STRICT_2003
      Conformance value that instructs Calcite to use SQL semantics strictly consistent with the SQL:2003 standard.
    • PRAGMATIC_2003

      public static final SqlConformanceEnum PRAGMATIC_2003
      Conformance value that instructs Calcite to use SQL semantics consistent with the SQL:2003 standard, but ignoring its more inconvenient or controversial dicta.
    • PRESTO

      public static final SqlConformanceEnum PRESTO
      Conformance value that instructs Calcite to use SQL semantics consistent with Presto.
    • SQL_SERVER_2008

      public static final SqlConformanceEnum SQL_SERVER_2008
      Conformance value that instructs Calcite to use SQL semantics consistent with Microsoft SQL Server version 2008.
  • Method Details

    • values

      public static SqlConformanceEnum[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static SqlConformanceEnum valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isLiberal

      public boolean isLiberal()
      Description copied from interface: SqlConformance
      Whether this dialect supports features from a wide variety of dialects. This is enabled for the Babel parser, disabled otherwise.
      Specified by:
      isLiberal in interface SqlConformance
    • allowCharLiteralAlias

      public boolean allowCharLiteralAlias()
      Description copied from interface: SqlConformance
      Whether this dialect allows character literals as column aliases.

      For example,

         SELECT empno, sal + comm AS 'remuneration'
         FROM Emp

      Among the built-in conformance levels, true in BABEL, BIG_QUERY, LENIENT, MYSQL_5, SQL_SERVER_2008; false otherwise.

      Specified by:
      allowCharLiteralAlias in interface SqlConformance
    • isGroupByAlias

      public boolean isGroupByAlias()
      Description copied from interface: SqlConformance
      Whether to allow aliases from the SELECT clause to be used as column names in the GROUP BY clause.

      Among the built-in conformance levels, true in BABEL, BIG_QUERY, LENIENT, MYSQL_5; false otherwise.

      Specified by:
      isGroupByAlias in interface SqlConformance
    • isGroupByOrdinal

      public boolean isGroupByOrdinal()
      Description copied from interface: SqlConformance
      Whether GROUP BY 2 is interpreted to mean 'group by the 2nd column in the select list'.

      Among the built-in conformance levels, true in BABEL, BIG_QUERY, LENIENT, MYSQL_5, PRESTO; false otherwise.

      Specified by:
      isGroupByOrdinal in interface SqlConformance
    • isHavingAlias

      public boolean isHavingAlias()
      Description copied from interface: SqlConformance
      Whether to allow aliases from the SELECT clause to be used as column names in the HAVING clause.

      Among the built-in conformance levels, true in BABEL, BIG_QUERY, LENIENT, MYSQL_5; false otherwise.

      Specified by:
      isHavingAlias in interface SqlConformance
    • isSortByOrdinal

      public boolean isSortByOrdinal()
      Description copied from interface: SqlConformance
      Whether 'ORDER BY 2' is interpreted to mean 'sort by the 2nd column in the select list'.

      Among the built-in conformance levels, true in DEFAULT, BABEL, LENIENT, MYSQL_5, ORACLE_10, ORACLE_12, PRAGMATIC_99, PRAGMATIC_2003, PRESTO, SQL_SERVER_2008, STRICT_92; false otherwise.

      Specified by:
      isSortByOrdinal in interface SqlConformance
    • isSortByAlias

      public boolean isSortByAlias()
      Description copied from interface: SqlConformance
      Whether 'ORDER BY x' is interpreted to mean 'sort by the select list item whose alias is x' even if there is a column called x.

      Among the built-in conformance levels, true in DEFAULT, BABEL, BIG_QUERY, LENIENT, MYSQL_5, ORACLE_10, ORACLE_12, SQL_SERVER_2008, STRICT_92; false otherwise.

      Specified by:
      isSortByAlias in interface SqlConformance
    • isSortByAliasObscures

      public boolean isSortByAliasObscures()
      Description copied from interface: SqlConformance
      Whether "empno" is invalid in "select empno as x from emp order by empno" because the alias "x" obscures it.

      Among the built-in conformance levels, true in STRICT_92; false otherwise.

      Specified by:
      isSortByAliasObscures in interface SqlConformance
    • isFromRequired

      public boolean isFromRequired()
      Description copied from interface: SqlConformance
      Whether FROM clause is required in a SELECT statement.

      Among the built-in conformance levels, true in ORACLE_10, ORACLE_12, STRICT_92, STRICT_99, STRICT_2003; false otherwise.

      Specified by:
      isFromRequired in interface SqlConformance
    • splitQuotedTableName

      public boolean splitQuotedTableName()
      Description copied from interface: SqlConformance
      Whether to split a quoted table name. If true, `x.y.z` is parsed as if the user had written `x`.`y`.`z`.

      Among the built-in conformance levels, true in BIG_QUERY; false otherwise.

      Specified by:
      splitQuotedTableName in interface SqlConformance
    • allowHyphenInUnquotedTableName

      public boolean allowHyphenInUnquotedTableName()
      Description copied from interface: SqlConformance
      Whether to allow hyphens in an unquoted table name.

      If true, SELECT * FROM foo-bar.baz-buzz is valid, and is parsed as if the user had written SELECT * FROM `foo-bar`.`baz-buzz`.

      Among the built-in conformance levels, true in BIG_QUERY; false otherwise.

      Specified by:
      allowHyphenInUnquotedTableName in interface SqlConformance
    • isBangEqualAllowed

      public boolean isBangEqualAllowed()
      Description copied from interface: SqlConformance
      Whether the bang-equal token != is allowed as an alternative to <> in the parser.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5, ORACLE_10, ORACLE_12, PRESTO; false otherwise.

      Specified by:
      isBangEqualAllowed in interface SqlConformance
    • isMinusAllowed

      public boolean isMinusAllowed()
      Description copied from interface: SqlConformance
      Whether MINUS is allowed as an alternative to EXCEPT in the parser.

      Among the built-in conformance levels, true in BABEL, LENIENT, ORACLE_10, ORACLE_12; false otherwise.

      Note: MySQL does not support MINUS or EXCEPT (as of version 5.5).

      Specified by:
      isMinusAllowed in interface SqlConformance
    • isPercentRemainderAllowed

      public boolean isPercentRemainderAllowed()
      Description copied from interface: SqlConformance
      Whether the "%" operator is allowed by the parser as an alternative to the mod function.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5, PRESTO; false otherwise.

      Specified by:
      isPercentRemainderAllowed in interface SqlConformance
    • isApplyAllowed

      public boolean isApplyAllowed()
      Description copied from interface: SqlConformance
      Whether CROSS APPLY and OUTER APPLY operators are allowed in the parser.

      APPLY invokes a table-valued function for each row returned by a table expression. It is syntactic sugar:

      • SELECT * FROM emp CROSS APPLY TABLE(promote(empno)
        is equivalent to
        SELECT * FROM emp CROSS JOIN LATERAL TABLE(promote(empno)
      • SELECT * FROM emp OUTER APPLY TABLE(promote(empno)
        is equivalent to
        SELECT * FROM emp LEFT JOIN LATERAL TABLE(promote(empno) ON true

      Among the built-in conformance levels, true in BABEL, LENIENT, ORACLE_12, SQL_SERVER_2008; false otherwise.

      Specified by:
      isApplyAllowed in interface SqlConformance
    • isInsertSubsetColumnsAllowed

      public boolean isInsertSubsetColumnsAllowed()
      Description copied from interface: SqlConformance
      Whether to allow INSERT (or UPSERT) with no column list but fewer values than the target table.

      The N values provided are assumed to match the first N columns of the table, and for each of the remaining columns, the default value of the column is used. It is an error if any of these columns has no default value.

      The default value of a column is specified by the DEFAULT clause in the CREATE TABLE statement, or is NULL if the column is not declared NOT NULL.

      Among the built-in conformance levels, true in BABEL, LENIENT, PRAGMATIC_99, PRAGMATIC_2003; false otherwise.

      Specified by:
      isInsertSubsetColumnsAllowed in interface SqlConformance
    • allowNiladicParentheses

      public boolean allowNiladicParentheses()
      Description copied from interface: SqlConformance
      Whether to allow parentheses to be specified in calls to niladic functions and procedures (that is, functions and procedures with no parameters).

      For example, CURRENT_DATE is a niladic system function. In standard SQL it must be invoked without parentheses:

      VALUES CURRENT_DATE

      If allowNiladicParentheses, the following syntax is also valid:

      VALUES CURRENT_DATE()

      Of the popular databases, MySQL, Apache Phoenix and VoltDB allow this behavior; Apache Hive, HSQLDB, IBM DB2, Microsoft SQL Server, Oracle, PostgreSQL do not.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5; false otherwise.

      Specified by:
      allowNiladicParentheses in interface SqlConformance
    • allowExplicitRowValueConstructor

      public boolean allowExplicitRowValueConstructor()
      Description copied from interface: SqlConformance
      Whether to allow SQL syntax "ROW(expr1, expr2, expr3)".

      The equivalent syntax in standard SQL is "(expr1, expr2, expr3)".

      Standard SQL does not allow this because the type is not well-defined. However, PostgreSQL allows this behavior.

      Standard SQL allows row expressions in other contexts, for instance inside VALUES clause.

      Among the built-in conformance levels, true in DEFAULT, LENIENT, PRESTO; false otherwise.

      Specified by:
      allowExplicitRowValueConstructor in interface SqlConformance
    • allowExtend

      public boolean allowExtend()
      Description copied from interface: SqlConformance
      Whether to allow mixing table columns with extended columns in INSERT (or UPSERT).

      For example, suppose that the declaration of table T has columns A and B, and you want to insert data of column C INTEGER not present in the table declaration as an extended column. You can specify the columns in an INSERT statement as follows:

      INSERT INTO T (A, B, C INTEGER) VALUES (1, 2, 3)

      Among the built-in conformance levels, true in BABEL, LENIENT; false otherwise.

      Specified by:
      allowExtend in interface SqlConformance
    • isLimitStartCountAllowed

      public boolean isLimitStartCountAllowed()
      Description copied from interface: SqlConformance
      Whether to allow the SQL syntax "LIMIT start, count".

      The equivalent syntax in standard SQL is "OFFSET start ROW FETCH FIRST count ROWS ONLY", and in PostgreSQL "LIMIT count OFFSET start".

      MySQL and CUBRID allow this behavior.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5; false otherwise.

      Specified by:
      isLimitStartCountAllowed in interface SqlConformance
    • isOffsetLimitAllowed

      public boolean isOffsetLimitAllowed()
      Description copied from interface: SqlConformance
      Whether to allow the SQL syntax "OFFSET start LIMIT count" (that is, OFFSET before LIMIT, in addition to LIMIT before OFFSET and OFFSET before FETCH).

      The equivalent syntax in standard SQL is "OFFSET start ROW FETCH FIRST count ROWS ONLY".

      Trino allows this behavior.

      Among the built-in conformance levels, true in BABEL, LENIENT; false otherwise.

      Specified by:
      isOffsetLimitAllowed in interface SqlConformance
    • allowGeometry

      public boolean allowGeometry()
      Description copied from interface: SqlConformance
      Whether to allow geo-spatial extensions, including the GEOMETRY type.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5, PRESTO, SQL_SERVER_2008; false otherwise.

      Specified by:
      allowGeometry in interface SqlConformance
    • shouldConvertRaggedUnionTypesToVarying

      public boolean shouldConvertRaggedUnionTypesToVarying()
      Description copied from interface: SqlConformance
      Whether the least restrictive type of a number of CHAR types of different lengths should be a VARCHAR type. And similarly BINARY to VARBINARY.

      For example, consider the query

      SELECT 'abcde' UNION SELECT 'xyz'

      The input columns have types CHAR(5) and CHAR(3), and we need a result type that is large enough for both:

      • Under strict SQL:2003 behavior, its column has type CHAR(5), and the value in the second row will have trailing spaces.
      • With lenient behavior, its column has type VARCHAR(5), and the values have no trailing spaces.

      Among the built-in conformance levels, true in PRAGMATIC_99, PRAGMATIC_2003, MYSQL_5, ORACLE_10, ORACLE_12, PRESTO, SQL_SERVER_2008; false otherwise.

      Specified by:
      shouldConvertRaggedUnionTypesToVarying in interface SqlConformance
    • allowExtendedTrim

      public boolean allowExtendedTrim()
      Description copied from interface: SqlConformance
      Whether TRIM should support more than one trim character.

      For example, consider the query

      SELECT TRIM('eh' FROM 'hehe__hehe')

      Under strict behavior, if the length of trim character is not 1, TRIM throws an exception, and the query fails. However many implementations (in databases such as MySQL and SQL Server) trim all the characters, resulting in a return value of '__'.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5, SQL_SERVER_2008; false otherwise.

      Specified by:
      allowExtendedTrim in interface SqlConformance
    • allowPluralTimeUnits

      public boolean allowPluralTimeUnits()
      Description copied from interface: SqlConformance
      Whether interval literals should allow plural time units such as "YEARS" and "DAYS" in interval literals.

      Under strict behavior, INTERVAL '2' DAY is valid and INTERVAL '2' DAYS is invalid; PostgreSQL allows both; Oracle only allows singular time units.

      Among the built-in conformance levels, true in BABEL, LENIENT; false otherwise.

      Specified by:
      allowPluralTimeUnits in interface SqlConformance
    • allowQualifyingCommonColumn

      public boolean allowQualifyingCommonColumn()
      Description copied from interface: SqlConformance
      Whether to allow a qualified common column in a query that has a NATURAL join or a join with a USING clause.

      For example, in the query

      SELECT emp.deptno
       FROM emp
       JOIN dept USING (deptno)

      deptno is the common column. A qualified common column such as emp.deptno is not allowed in Oracle, but is allowed in PostgreSQL.

      Among the built-in conformance levels, false in ORACLE_10, ORACLE_12, PRESTO, STRICT_92, STRICT_99, STRICT_2003; true otherwise.

      Specified by:
      allowQualifyingCommonColumn in interface SqlConformance
    • allowAliasUnnestItems

      public boolean allowAliasUnnestItems()
      Description copied from interface: SqlConformance
      Whether directly alias array items in UNNEST.

      E.g. in UNNEST(a_array, b_array) AS T(a, b), a and b will be aliases of elements in a_array and b_array respectively.

      Without this flag set, T will be the alias of the element in a_array and a, b will be the top level fields of T if T is a STRUCT type.

      Among the built-in conformance levels, true in PRESTO; false otherwise.

      Specified by:
      allowAliasUnnestItems in interface SqlConformance
    • isValueAllowed

      public boolean isValueAllowed()
      Description copied from interface: SqlConformance
      Whether VALUE is allowed as an alternative to VALUES in the parser.

      Among the built-in conformance levels, true in BABEL, LENIENT, MYSQL_5; false otherwise.

      Specified by:
      isValueAllowed in interface SqlConformance
    • semantics

      public SqlLibrary semantics()
      Description copied from interface: SqlConformance
      Controls the behavior of operators that are part of Standard SQL but nevertheless have different behavior in different databases.

      Consider the SUBSTRING operator. In ISO standard SQL, negative start indexes are converted to 1; in Google BigQuery, negative start indexes are treated as offsets from the end of the string. For example, SUBSTRING('abcde' FROM -3 FOR 2) returns 'ab' in standard SQL and 'cd' in BigQuery.

      If you specify conformance=BIG_QUERY in your connection parameters, SUBSTRING will give the BigQuery behavior. Similarly MySQL and Oracle.

      Among the built-in conformance levels:

      Specified by:
      semantics in interface SqlConformance
    • allowLenientCoercion

      public boolean allowLenientCoercion()
      Description copied from interface: SqlConformance
      Whether to allow lenient type coercions.

      Coercions include:

      • Coercion of string literal to array literal. For example, SELECT ARRAY[0,1,2] == '{0,1,2}'
      • Casting BOOLEAN values to one of the following numeric types: TINYINT, SMALLINT, INTEGER, BIGINT.

      Among the built-in conformance levels, true in BABEL, false otherwise.

      Specified by:
      allowLenientCoercion in interface SqlConformance