Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

Change the length of a variable in IMPALA SQL Select statement through SAS

I am connecting to an impala server to retrieve some data. However I want to change the length of the variable in the impala pass-through sql statement because otherwise it will retrieve the variable with a length of 32767 which is not optimized.

This is how I would do it in SAS:

proc sql;
    connect to impala (dsn="somedsn");
    create table want as
    select * 
    from connection to impala
        (select var1 length=50  
            from &disc_table.);
    disconnect from impala;
quit;

However, as IMPALA does not have the same sql statement structure, it does not work.

What is the correct statement to retrieve the var1 with a length=50 in IMPALA SQL statement ?

question from:https://stackoverflow.com/questions/65889533/change-the-length-of-a-variable-in-impala-sql-select-statement-through-sas

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could ask IMPALA to CAST the variable to one with the correct length.

... (select cast(var1 as varchar(50)) as var1 from &disc_table.) ...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...