Package net.snowflake.client.api.loader
Class LoadingError
- java.lang.Object
-
- net.snowflake.client.api.loader.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLoadingError.ErrorPropertyProperties that can be associated with a loading error.
-
Constructor Summary
Constructors Constructor Description LoadingError(ResultSet rs, net.snowflake.client.internal.loader.BufferStage bs, net.snowflake.client.internal.loader.StreamLoader loader)Construct error from validation output
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Loader.DataErrorgetException()Converts this loading error into a DataError exception.StringgetFile()Gets the file name where the error occurred.StringgetPrefix()Gets the file prefix within the stage.StringgetProperty(LoadingError.ErrorProperty p)Gets the value of a specific error property.StringgetStage()Gets the stage name where the error occurred.StringgetTarget()Gets the target table name.voidsetProperty(LoadingError.ErrorProperty p, String value)Sets the value of a specific error property.StringtoString()
-
-
-
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 setbs- buffer stageloader- 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 setvalue- 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
-
-