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

How to use
numberLiteralOutOfRange
method
in
org.apache.calcite.runtime.CalciteResource

Best Java code snippets using org.apache.calcite.runtime.CalciteResource.numberLiteralOutOfRange (Showing top 14 results out of 315)

origin: apache/flink

private void validateLiteralAsDouble(SqlLiteral literal) {
  BigDecimal bd = (BigDecimal) literal.getValue();
  double d = bd.doubleValue();
  if (Double.isInfinite(d) || Double.isNaN(d)) {
    // overflow
    throw newValidationError(literal,
      RESOURCE.numberLiteralOutOfRange(Util.toScientificNotation(bd)));
  }
  // REVIEW jvs 4-Aug-2004:  what about underflow?
}
origin: apache/flink

RESOURCE.numberLiteralOutOfRange(bd.toString()));
origin: Qihoo360/Quicksql

private void validateLiteralAsDouble(SqlLiteral literal) {
 BigDecimal bd = (BigDecimal) literal.getValue();
 double d = bd.doubleValue();
 if (Double.isInfinite(d) || Double.isNaN(d)) {
  // overflow
  throw newValidationError(literal,
    RESOURCE.numberLiteralOutOfRange(Util.toScientificNotation(bd)));
 }
 // REVIEW jvs 4-Aug-2004:  what about underflow?
}
origin: org.apache.calcite/calcite-core

private void validateLiteralAsDouble(SqlLiteral literal) {
 BigDecimal bd = (BigDecimal) literal.getValue();
 double d = bd.doubleValue();
 if (Double.isInfinite(d) || Double.isNaN(d)) {
  // overflow
  throw newValidationError(literal,
    RESOURCE.numberLiteralOutOfRange(Util.toScientificNotation(bd)));
 }
 // REVIEW jvs 4-Aug-2004:  what about underflow?
}
origin: org.apache.calcite/calcite-core

@SuppressWarnings("deprecation")
@Override public int getIntLiteralOperand(int ordinal) {
 SqlNode node = call.operand(ordinal);
 final Object o = SqlLiteral.value(node);
 if (o instanceof BigDecimal) {
  BigDecimal bd = (BigDecimal) o;
  try {
   return bd.intValueExact();
  } catch (ArithmeticException e) {
   throw SqlUtil.newContextException(node.pos,
     RESOURCE.numberLiteralOutOfRange(bd.toString()));
  }
 }
 throw new AssertionError();
}
origin: Qihoo360/Quicksql

@SuppressWarnings("deprecation")
@Override public int getIntLiteralOperand(int ordinal) {
 SqlNode node = call.operand(ordinal);
 final Object o = SqlLiteral.value(node);
 if (o instanceof BigDecimal) {
  BigDecimal bd = (BigDecimal) o;
  try {
   return bd.intValueExact();
  } catch (ArithmeticException e) {
   throw SqlUtil.newContextException(node.pos,
     RESOURCE.numberLiteralOutOfRange(bd.toString()));
  }
 }
 throw new AssertionError();
}
origin: Qihoo360/Quicksql

/**
 * Returns the long value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Long value of this literal
 */
public long longValue(boolean exact) {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  BigDecimal bd = (BigDecimal) value;
  if (exact) {
   try {
    return bd.longValueExact();
   } catch (ArithmeticException e) {
    throw SqlUtil.newContextException(getParserPosition(),
      RESOURCE.numberLiteralOutOfRange(bd.toString()));
   }
  } else {
   return bd.longValue();
  }
 default:
  throw Util.unexpected(typeName);
 }
}
origin: Qihoo360/Quicksql

/**
 * Returns the integer value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Integer value of this literal
 */
public int intValue(boolean exact) {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  BigDecimal bd = (BigDecimal) value;
  if (exact) {
   try {
    return bd.intValueExact();
   } catch (ArithmeticException e) {
    throw SqlUtil.newContextException(getParserPosition(),
      RESOURCE.numberLiteralOutOfRange(bd.toString()));
   }
  } else {
   return bd.intValue();
  }
 default:
  throw Util.unexpected(typeName);
 }
}
origin: org.apache.calcite/calcite-core

/**
 * Returns the integer value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Integer value of this literal
 */
public int intValue(boolean exact) {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  BigDecimal bd = (BigDecimal) value;
  if (exact) {
   try {
    return bd.intValueExact();
   } catch (ArithmeticException e) {
    throw SqlUtil.newContextException(getParserPosition(),
      RESOURCE.numberLiteralOutOfRange(bd.toString()));
   }
  } else {
   return bd.intValue();
  }
 default:
  throw Util.unexpected(typeName);
 }
}
origin: org.apache.calcite/calcite-core

/**
 * Returns the long value of this literal.
 *
 * @param exact Whether the value has to be exact. If true, and the literal
 *              is a fraction (e.g. 3.14), throws. If false, discards the
 *              fractional part of the value.
 * @return Long value of this literal
 */
public long longValue(boolean exact) {
 switch (typeName) {
 case DECIMAL:
 case DOUBLE:
  BigDecimal bd = (BigDecimal) value;
  if (exact) {
   try {
    return bd.longValueExact();
   } catch (ArithmeticException e) {
    throw SqlUtil.newContextException(getParserPosition(),
      RESOURCE.numberLiteralOutOfRange(bd.toString()));
   }
  } else {
   return bd.longValue();
  }
 default:
  throw Util.unexpected(typeName);
 }
}
origin: Qihoo360/Quicksql

if (throwOnFailure) {
 throw callBinding.newError(
   RESOURCE.numberLiteralOutOfRange(value.toString()));
origin: org.apache.calcite/calcite-core

if (throwOnFailure) {
 throw callBinding.newError(
   RESOURCE.numberLiteralOutOfRange(value.toString()));
origin: Qihoo360/Quicksql

RESOURCE.numberLiteralOutOfRange(bd.toString()));
origin: org.apache.calcite/calcite-core

RESOURCE.numberLiteralOutOfRange(bd.toString()));
org.apache.calcite.runtimeCalciteResourcenumberLiteralOutOfRange

Popular methods of CalciteResource

  • applyNotAllowed
  • bangEqualNotAllowed
  • identifierTooLong
  • illegalBinaryString
  • illegalCursorExpression
  • illegalFromEmpty
  • illegalMinusDate
  • illegalNonQueryExpression
  • illegalOrderBy
  • illegalQueryExpression
  • illegalRowExpression
  • invalidSampleSize
  • illegalRowExpression,
  • invalidSampleSize,
  • minusNotAllowed,
  • unicodeEscapeUnexpected,
  • unknownCharacterSet,
  • extendNotAllowed,
  • geometryDisabled,
  • limitStartCountNotAllowed,
  • percentRemainderNotAllowed,
  • illegalIntervalLiteral

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top plugins for Android Studio
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