Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load TimeWithZone field from postgres

Hi,

I have trouble loading data from postgres field of type TimeWithZone.

I can normally load it, and see it in Data model viewer.

The problem is when I try to get min(), max() or amy function. It always return NULL.

So let say that I have "time" field in postgres of TimeWithZone type.


LOAD

     min(time) as start,

     max(time) as stop

Resident temp_database

group By id;

Return all null rows.

I even try

LOAD

     min(Time(time)) as start,

     max(Time(time)) as stop

Resident temp_database

group By id;

and

LOAD

     min(Time#(time)) as start,

     max(Time#(time)) as stop

Resident temp_database

group By id;

I also try

LOAD

     Num(time) as nTime,

     Chr(time) as cTime

Resident temp_database;

return all null rows.

How to handle this type of fields?

10 Replies
Anil_Babu_Samineni

First you need to play with Time Format from TimeZone?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

I found that I was wrongly choose chr() insted of Text()

Now I have : Time#(Text(time)) -> it return values

but

min(Time#(Text(time)))  -> return null

Anil_Babu_Samineni

I am not sure what inputs is having from time?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

If the field is being treated as string, you might have to use parsing functions like time#(), date#(), timestamp#() with proper format. Try like:

Timestamp(Max(Timestamp#(time,'format') )) as Stop

'format' - is the one how you see when the field is loaded without max/min.

Anonymous
Not applicable
Author

Screen Shot 2017-12-12 at 13.24.53.png

NUra is Num(time)

WUra is Time#(Text(time))

Screen Shot 2017-12-12 at 13.26.12.png

Those two rows are

min(Time#(Text(time)))

max(Time#(Text(time)))

Anil_Babu_Samineni

Till you are using Text() it will always return text format only.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Sorry but I don't understand you.

I use Time#(Text(time)) so, it should return Time not Text...

Could you explain what do you mean by your comment.

Anonymous
Not applicable
Author

Hi,

Could you look to my reply to other answers.

Anil_Babu_Samineni

Difficult to answer, Without having any inputs. Can you provide inline and result set?May be this

Time(Time#(time), 'hh:mm:ss')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful