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

How to use
CalciteException
in
org.apache.calcite.runtime

Best Java code snippets using org.apache.calcite.runtime.CalciteException (Showing top 18 results out of 315)

origin: Qihoo360/Quicksql

 @Override public String getMessage() {
  // The superclass' message is the textual context information
  // for this exception, so we add in the underlying cause to the message
  return super.getMessage() + ": " + getCause().getMessage();
 }
}
origin: Qihoo360/Quicksql

 /**
  * Creates a new CalciteException object.
  *
  * @param message error message
  * @param cause   underlying cause
  */
 public CalciteException(
   String message,
   Throwable cause) {
  super(message, cause);

  // TODO: Force the caller to pass in a Logger as a trace argument for
  // better context.  Need to extend ResGen for this.
  LOGGER.trace("CalciteException", this);
  LOGGER.error(toString());
 }
}
origin: org.apache.calcite/calcite-core

  null,
  errorMatches(
    new CalciteException("Empty result of JSON_VALUE function is not "
      + "allowed", null)));
assertJsonValueAny(
  null,
  errorMatches(
    new CalciteException("Empty result of JSON_VALUE function is not "
      + "allowed", null)));
assertJsonValueAny(
  null,
  errorMatches(
    new CalciteException("Strict jsonpath mode requires scalar value, "
      + "and the actual value is: '[]'", null)));
origin: org.apache.calcite/calcite-core

 protected void validateFeature(
   Feature feature,
   SqlParserPos context) {
  if (feature.equals(disabledFeature)) {
   CalciteException ex =
     new CalciteException(
       FEATURE_DISABLED,
       null);
   if (context == null) {
    throw ex;
   }
   throw new CalciteContextException(
     "location",
     ex,
     context.getLineNum(),
     context.getColumnNum(),
     context.getEndLineNum(),
     context.getEndColumnNum());
  }
 }
}
origin: org.apache.calcite/calcite-core

 @Override public String getMessage() {
  // The superclass' message is the textual context information
  // for this exception, so we add in the underlying cause to the message
  return super.getMessage() + ": " + getCause().getMessage();
 }
}
origin: Qihoo360/Quicksql

 protected void validateFeature(
   Feature feature,
   SqlParserPos context) {
  if (feature.equals(disabledFeature)) {
   CalciteException ex =
     new CalciteException(
       FEATURE_DISABLED,
       null);
   if (context == null) {
    throw ex;
   }
   throw new CalciteContextException(
     "location",
     ex,
     context.getLineNum(),
     context.getColumnNum(),
     context.getEndLineNum(),
     context.getEndColumnNum());
  }
 }
}
origin: org.apache.calcite/calcite-core

 /**
  * Creates a new CalciteException object.
  *
  * @param message error message
  * @param cause   underlying cause
  */
 public CalciteException(
   String message,
   Throwable cause) {
  super(message, cause);

  // TODO: Force the caller to pass in a Logger as a trace argument for
  // better context.  Need to extend ResGen for this.
  LOGGER.trace("CalciteException", this);
  LOGGER.error(toString());
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testLtWithAny() {
 // Non-numeric same type "less then" check
 assertThat(SqlFunctions.ltAny("apple", "banana"), is(true));
 // Numeric types "less than" check
 assertThat(SqlFunctions.ltAny(1, 2L), is(true));
 assertThat(SqlFunctions.ltAny(1, 2.0D), is(true));
 assertThat(SqlFunctions.ltAny(1L, 2.0D), is(true));
 assertThat(SqlFunctions.ltAny(new BigDecimal(1L), 2), is(true));
 assertThat(SqlFunctions.ltAny(new BigDecimal(1L), 2L), is(true));
 assertThat(SqlFunctions.ltAny(new BigDecimal(1L), 2.0D), is(true));
 assertThat(SqlFunctions.ltAny(new BigDecimal(1L), new BigDecimal(2.0D)),
   is(true));
 // Non-numeric different type but both implements Comparable
 // "less than" check
 try {
  assertThat(SqlFunctions.ltAny("1", 2L), is(false));
  fail("'lt' on non-numeric different type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for comparison: class java.lang.String < "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

  SqlJsonQueryEmptyOrErrorBehavior.NULL,
  errorMatches(
    new CalciteException("Empty result of JSON_QUERY function is not "
      + "allowed", null)));
  SqlJsonQueryEmptyOrErrorBehavior.NULL,
  errorMatches(
    new CalciteException("Empty result of JSON_QUERY function is not "
      + "allowed", null)));
assertJsonQuery(
  SqlJsonQueryEmptyOrErrorBehavior.ERROR,
  errorMatches(
    new CalciteException("Strict jsonpath mode requires array or "
      + "object value, and the actual value is: 'bar'", null)));
origin: org.apache.calcite/calcite-core

@Test public void testGtWithAny() {
 // Non-numeric same type "greater then" check
 assertThat(SqlFunctions.gtAny("banana", "apple"), is(true));
 // Numeric types "greater than" check
 assertThat(SqlFunctions.gtAny(2, 1L), is(true));
 assertThat(SqlFunctions.gtAny(2, 1.0D), is(true));
 assertThat(SqlFunctions.gtAny(2L, 1.0D), is(true));
 assertThat(SqlFunctions.gtAny(new BigDecimal(2L), 1), is(true));
 assertThat(SqlFunctions.gtAny(new BigDecimal(2L), 1L), is(true));
 assertThat(SqlFunctions.gtAny(new BigDecimal(2L), 1.0D), is(true));
 assertThat(SqlFunctions.gtAny(new BigDecimal(2L), new BigDecimal(1.0D)),
   is(true));
 // Non-numeric different type but both implements Comparable
 // "greater than" check
 try {
  assertThat(SqlFunctions.gtAny("2", 1L), is(false));
  fail("'gt' on non-numeric different type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for comparison: class java.lang.String > "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testPlusAny() {
 // null parameters
 assertNull(SqlFunctions.plusAny(null, null));
 assertNull(SqlFunctions.plusAny(null, 1));
 assertNull(SqlFunctions.plusAny(1, null));
 // Numeric types
 assertThat(SqlFunctions.plusAny(2, 1L), is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(2, 1.0D), is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(2L, 1.0D), is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(new BigDecimal(2L), 1),
   is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(new BigDecimal(2L), 1L),
   is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(new BigDecimal(2L), 1.0D),
   is((Object) new BigDecimal(3)));
 assertThat(SqlFunctions.plusAny(new BigDecimal(2L), new BigDecimal(1.0D)),
   is((Object) new BigDecimal(3)));
 // Non-numeric type
 try {
  SqlFunctions.plusAny("2", 2L);
  fail("'plus' on non-numeric type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for arithmetic: class java.lang.String + "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testMinusAny() {
 // null parameters
 assertNull(SqlFunctions.minusAny(null, null));
 assertNull(SqlFunctions.minusAny(null, 1));
 assertNull(SqlFunctions.minusAny(1, null));
 // Numeric types
 assertThat(SqlFunctions.minusAny(2, 1L), is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(2, 1.0D), is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(2L, 1.0D), is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(new BigDecimal(2L), 1),
   is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(new BigDecimal(2L), 1L),
   is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(new BigDecimal(2L), 1.0D),
   is((Object) new BigDecimal(1)));
 assertThat(SqlFunctions.minusAny(new BigDecimal(2L), new BigDecimal(1.0D)),
   is((Object) new BigDecimal(1)));
 // Non-numeric type
 try {
  SqlFunctions.minusAny("2", 2L);
  fail("'minus' on non-numeric type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for arithmetic: class java.lang.String - "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testMultiplyAny() {
 // null parameters
 assertNull(SqlFunctions.multiplyAny(null, null));
 assertNull(SqlFunctions.multiplyAny(null, 1));
 assertNull(SqlFunctions.multiplyAny(1, null));
 // Numeric types
 assertThat(SqlFunctions.multiplyAny(2, 1L), is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(2, 1.0D),
   is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(2L, 1.0D),
   is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(new BigDecimal(2L), 1),
   is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(new BigDecimal(2L), 1L),
   is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(new BigDecimal(2L), 1.0D),
   is((Object) new BigDecimal(2)));
 assertThat(SqlFunctions.multiplyAny(new BigDecimal(2L), new BigDecimal(1.0D)),
   is((Object) new BigDecimal(2)));
 // Non-numeric type
 try {
  SqlFunctions.multiplyAny("2", 2L);
  fail("'multiply' on non-numeric type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for arithmetic: class java.lang.String * "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testDivideAny() {
 // null parameters
 assertNull(SqlFunctions.divideAny(null, null));
 assertNull(SqlFunctions.divideAny(null, 1));
 assertNull(SqlFunctions.divideAny(1, null));
 // Numeric types
 assertThat(SqlFunctions.divideAny(5, 2L),
   is((Object) new BigDecimal("2.5")));
 assertThat(SqlFunctions.divideAny(5, 2.0D),
   is((Object) new BigDecimal("2.5")));
 assertThat(SqlFunctions.divideAny(5L, 2.0D),
   is((Object) new BigDecimal("2.5")));
 assertThat(SqlFunctions.divideAny(new BigDecimal(5L), 2),
   is((Object) new BigDecimal(2.5)));
 assertThat(SqlFunctions.divideAny(new BigDecimal(5L), 2L),
   is((Object) new BigDecimal(2.5)));
 assertThat(SqlFunctions.divideAny(new BigDecimal(5L), 2.0D),
   is((Object) new BigDecimal(2.5)));
 assertThat(SqlFunctions.divideAny(new BigDecimal(5L), new BigDecimal(2.0D)),
   is((Object) new BigDecimal(2.5)));
 // Non-numeric type
 try {
  SqlFunctions.divideAny("5", 2L);
  fail("'divide' on non-numeric type is not possible");
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("Invalid types for arithmetic: class java.lang.String / "
      + "class java.lang.Long"));
 }
}
origin: org.apache.calcite/calcite-core

 fail("'le' on non-numeric different type is not possible");
} catch (CalciteException e) {
 assertThat(e.getMessage(),
   is("Invalid types for comparison: class java.lang.String <= "
     + "class java.lang.Long"));
origin: org.apache.calcite/calcite-core

 fail("'ge' on non-numeric different type is not possible");
} catch (CalciteException e) {
 assertThat(e.getMessage(),
   is("Invalid types for comparison: class java.lang.String >= "
     + "class java.lang.Long"));
origin: Qihoo360/Quicksql

@Test public void testAggregateFilterFails() {
 // Equivalent SQL:
 //   SELECT deptno, SUM(sal) FILTER (WHERE comm) AS c
 //   FROM emp
 //   GROUP BY deptno
 try {
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
    builder.scan("EMP")
      .aggregate(
        builder.groupKey(builder.field("DEPTNO")),
        builder.aggregateCall(SqlStdOperatorTable.SUM, false, false,
          builder.field("COMM"), "C", builder.field("SAL")))
      .build();
  fail("expected error, got " + root);
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("FILTER expression must be of type BOOLEAN"));
 }
}
origin: org.apache.calcite/calcite-core

@Test public void testAggregateFilterFails() {
 // Equivalent SQL:
 //   SELECT deptno, SUM(sal) FILTER (WHERE comm) AS c
 //   FROM emp
 //   GROUP BY deptno
 try {
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
    builder.scan("EMP")
      .aggregate(
        builder.groupKey(builder.field("DEPTNO")),
        builder.sum(builder.field("SAL"))
          .filter(builder.field("COMM"))
          .as("C"))
      .build();
  fail("expected error, got " + root);
 } catch (CalciteException e) {
  assertThat(e.getMessage(),
    is("FILTER expression must be of type BOOLEAN"));
 }
}
org.apache.calcite.runtimeCalciteException

Javadoc

Base class for all exceptions originating from Farrago.

Most used methods

  • getMessage
  • <init>
    Creates a new CalciteException object.
  • toString

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Reference (javax.naming)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Vim 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