I have query related to hive that Cygnus create external table in hive and it creates table in default database. But when I fetch data from hive using below query it shows me NULL value:
hive> select * from hadoop_abcdx002ftestsinkx002fx0052oom1_x0052oom_row
> ;
OK NULL NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL
NULL
Time taken: 1.495 seconds, Fetched: 12 row(s)
Can anyone please help me on how to proceed further with this issue.
Just run the below command:
Show create table hadoop_abcdx002ftestsinkx002fx0052oom1_x0052oom_row;
Check the location and Go to the location path where the underlying csv file is present.
check if you have data in it.
Related
I'm trying to get my hdfs data in hive but it shows NULL value.
Here is the sequence of commands that I'm executing
hive> LOAD DATA INPATH '/user/hadoop/oriondemo/data/Floor1_Floor/Floor1_Floor.txt' OVERWRITE INTO TABLE new;
Loading data to table default.new
OK
Time taken: 0.538 seconds
hive> select * from new;
OK
NULL NULL
NULL NULL
NULL NULL
NULL NULL
NULL NULL
Time taken: 0.321 seconds, Fetched: 5 row(s)
hive>
what is the column separator you are using to upload this text file ? if it is comma(,) then check the values, might be some values can have additional comma for e.g. values of address column.
A co-worker of mine stated that she have a query that "work" only if she use NULL, and not with null.
She wasn't able to provide me with an example.
As far as I know there shouldn't be any difference, I even ran a simple test:
select case when NULL is NULL then 1 else 0 end;
select case when NULL is null then 1 else 0 end;
select case when null is NULL then 1 else 0 end;
select case when null is null then 1 else 0 end;
and, as expected, they all returned 1.
So here the question, there is any know istance where using null is different than using NULL?
maybe she compared strings 'NULL' and 'null'
Yes:
is NULL and is null produces the same result its case insenstive
I am trying simply to convert Lat and Long Coordinates of Taxis to Geometry Points but when I do my query I get this error: ''geometry::Point' failed because parameter 1 is not allowed to be null.'
The statement has been terminated.
UPDATE [dbo].[pdPoints]
SET puGeom = GEOMETRY::Point(begintrip_lng, begintrip_lat, 4326),
dfGeom = GEOMETRY::Point(dropoff_lng, dropoff_lat, 4326)
I have tried adding a this statement
WHERE
begintrip_lng is not null
or dropoff_lng is not null
or begintrip_lat is not null
or dropoff_lat is not null
or country_id is not null
or city_id is not null;
but I get the same result. :( Anyone who can help?
You need and instead of or
WHERE
begintrip_lng is not null
and dropoff_lng is not null
and begintrip_lat is not null
and dropoff_lat is not null
and country_id is not null
and city_id is not null;
Try this, You will see some rows will still have null, or maybe more.
Any null will break your update.
SELECT *
FROM pdPoints
WHERE
begintrip_lng is not null
or dropoff_lng is not null
or begintrip_lat is not null
or dropoff_lat is not null
or country_id is not null
or city_id is not null;
I try to use stored procedure in my project.However i have question about null and empty.
ALTER PROCEDURE [dbo].[SP_EMAIL_LIST]
AS
BEGIN
SELECT *
FROM CUSTOMER
WHERE
EMAIL_ADRESS IS NOT NULL
END
I used where clause for avoid getting values null or empty values however i still get null values.
How can i get email adress values if not null and not empty ?
This should work.
SELECT
*
FROM
CUSTOMER
WHERE
EMAIL_ADRESS IS NOT NULL AND EMAIL_ADRESS != ''
Keep in mind there is a difference between NULL and ''. '' is simply an empty string. NULL generally is used to indicate an unknown or unspecified value.
I have a stored procedure that I need to filter rows that have a binary value and return only rows that are not null in the binary column.
When I execute this stored procedure:
create procedure sp_GetGraduatingStudentDataByYear
(
#year nvarchar(4)
)
as
select * from Cohort_Graduation_Student_Data where Exp_Grad_Year = #year and Off_Track != null
go
I get no results.
How can I alter this script to return the rows with a null value in the binary column?
This is not because it's a binary column, but because null in SQL should not be compared to anything. Essentially, Off_Track != null condition filters out all rows - all checks for column = null and column != null always evaluate to false.
Use is not null instead:
select *
from Cohort_Graduation_Student_Data
where Exp_Grad_Year = #year and Off_Track is not null