java.lang.Object
org.elasticsearch.compute.operator.Warnings

public class Warnings extends Object
Utilities to collect warnings for running an executor.
  • Field Details

    • NOOP_WARNINGS

      public static final Warnings NOOP_WARNINGS
  • Method Details

    • createWarnings

      public static Warnings createWarnings(DriverContext.WarningsMode warningsMode, int lineNumber, int columnNumber, String sourceText)
      Create a new warnings object based on the given mode
      Parameters:
      warningsMode - The warnings collection strategy to use
      lineNumber - The line number of the source text. Same as `source.getLineNumber()`
      columnNumber - The column number of the source text. Same as `source.getColumnNumber()`
      sourceText - The source text that caused the warning. Same as `source.text()`
      Returns:
      A warnings collector object
    • createWarningsTreatedAsFalse

      public static Warnings createWarningsTreatedAsFalse(DriverContext.WarningsMode warningsMode, int lineNumber, int columnNumber, String sourceText)
      Create a new warnings object based on the given mode which warns that it treats the result as false.
      Parameters:
      warningsMode - The warnings collection strategy to use
      lineNumber - The line number of the source text. Same as `source.getLineNumber()`
      columnNumber - The column number of the source text. Same as `source.getColumnNumber()`
      sourceText - The source text that caused the warning. Same as `source.text()`
      Returns:
      A warnings collector object
    • createOnlyWarnings

      public static Warnings createOnlyWarnings(DriverContext.WarningsMode warningsMode, int lineNumber, int columnNumber, String sourceText)
      Create a new warnings object based on the given mode which warns that evaluation resulted in warnings.
      Parameters:
      warningsMode - The warnings collection strategy to use
      lineNumber - The line number of the source text. Same as `source.getLineNumber()`
      columnNumber - The column number of the source text. Same as `source.getColumnNumber()`
      sourceText - The source text that caused the warning. Same as `source.text()`
      Returns:
      A warnings collector object
    • registerException

      public void registerException(Exception exception)
    • registerException

      public void registerException(Class<? extends Exception> exceptionClass, String message)
      Register an exception to be included in the warnings.

      This overload avoids the need to instantiate the exception, which can be expensive. Instead, it asks only the required pieces to build the warning.