Error: when the value of row is obtained in sparksql and the field of row allows null, null is obtained when the value is taken and assigned to a new variable name. A NullPointerException error will be reported
Solution: you can first use row. Isnullat (index) to determine whether the value of the field is empty
Specific cases are as follows:
First, make mistakes
If row. Isnullat (6) is not empty, the value will be assigned to the variable
When you get a value from row, you often encounter the problem of being empty.
the simple summary is as follows:
get value type: if it is empty, it will be converted to 0
to judge null. It is recommended to use row.isnullat (index)
Get string type: if it is empty, it will be null
if it is empty, it is recommended to use: stringutils. Isempty() (in case of ″)
Summary: getast
is used to get values, row. Isnullat
and stringutils. Isempty ()
Read More:
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- PHP:Fatal error: Class ‘COM’ not found in … How to deal with the problem
- org.apache.hadoop.hive.ql.exec.spark.SparkTask. Failed to create Spark client for Spark session 0354
- ASP.NET How to deal with “unexpected character” when writing code
- There will be row spacing problems in algorithm use in latex. Please use the ‘setstretch {1.35}
- How to deal with the error reported by live mail
- Run spark to report error while identifying ‘ org.apache.spark . sql.hive.HiveSessionState ‘
- About the error querying database. Cause: java.lang.nullpointerexception reported in mybatis
- Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL
- Latex row overflow problem overfull / hbox (1.1499pt too wide) in paragraph
- MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key co
- How to Fix ”is not in the sudoers file“ in Linux
- Matlab delete row or col to delete the row or column of the matrix
- Global lock, table lock and row lock in MySQL
- How to compare the equality of structures in golang
- Spark shell startup error, error: not found: value spark (low level solved)
- Error reporting: java.lang.nullpointerexception solution
- class.getResource () and ClassLoader.getResource How to fill in the parameters in ()
- There are three ways to deal with the problem of vs (Visual Studio) 2017 flashback. I feel that none of them is the fundamental solution.
- How to set the custom blood bar UI in UE4 and how to call it