Class LoadingError


  • public class LoadingError
    extends Object
    Wrapper for data format errors returned by the COPY/validate command.

    This class encapsulates error information from failed data loading operations. It provides details about what went wrong, where in the file the error occurred, and the rejected record data.

    Usage Example

    
     LoadResultListener listener = new LoadResultListener() {
       public void addError(LoadingError error) {
         System.err.println("Error in file: " + error.getFile());
         System.err.println("Line: " + error.getProperty(ErrorProperty.LINE));
         System.err.println("Error: " + error.getProperty(ErrorProperty.ERROR));
       }
       // ... implement other methods
     };
     
    See Also:
    LoadResultListener, Loader
    • Field Detail

      • UNKNOWN

        public static String UNKNOWN
    • Constructor Detail

      • LoadingError

        public LoadingError​(ResultSet rs,
                            net.snowflake.client.internal.loader.BufferStage bs,
                            net.snowflake.client.internal.loader.StreamLoader loader)
        Construct error from validation output
        Parameters:
        rs - result set
        bs - buffer stage
        loader - stream loader
    • Method Detail

      • getStage

        public String getStage()
        Gets the stage name where the error occurred.
        Returns:
        the stage name
      • getPrefix

        public String getPrefix()
        Gets the file prefix within the stage.
        Returns:
        the file prefix path
      • getFile

        public String getFile()
        Gets the file name where the error occurred.
        Returns:
        the file name
      • getTarget

        public String getTarget()
        Gets the target table name.
        Returns:
        the target table name
      • getProperty

        public String getProperty​(LoadingError.ErrorProperty p)
        Gets the value of a specific error property.
        Parameters:
        p - the error property to retrieve
        Returns:
        the value of the error property, or null if not set
      • setProperty

        public void setProperty​(LoadingError.ErrorProperty p,
                                String value)
        Sets the value of a specific error property.
        Parameters:
        p - the error property to set
        value - the value to assign to the property
      • getException

        public Loader.DataError getException()
        Converts this loading error into a DataError exception.
        Returns:
        a DataError exception containing this error's details