Hello Karthick,

This looks like the table is using the default TEXTFILE storage format.
This storage format assumes that newlines are record delimiters.
Unfortunately, this won't work well for data that contains embedded
newlines. The select is probably finding 3 lines and misinterpreting it as
3 rows. (You can probably confirm this by running DESCRIBE EXTENDED
employee, finding the file system location and looking directly at the
contents of the files.)

Switching to a different storage format that can handle embedded newlines
will probably resolve this for you. See below for an example using ORC.

In case it's helpful, you can also represent newlines at insert time using
a \n escape, or for more complex formatting, you can use the printf
function.

CREATE TABLE employee (
    employee_id INT,
    name STRING,
    address STRING)
STORED AS ORC;

INSERT INTO employee VALUES (1, 'Alex', '123 street\nTamilnadu\nIndia');

+-----------------------+----------------+-----------------------------+
| employee.employee_id  | employee.name  |      employee.address       |
+-----------------------+----------------+-----------------------------+
| 1                     | Alex           | 123 street
Tamilnadu
India  |
+-----------------------+----------------+-----------------------------+
1 row selected (1.151 seconds)

Chris Nauroth


On Fri, Mar 10, 2023 at 5:52 AM Techsupport <techsupp...@sardonyx.in> wrote:

> *Hi to all,*
>
>
>
> I have used the following script to insert
>
>
>
> insert into employee values (1,’Alex’,’123 street
>
> Tamilnadu
>
> India’);
>
>
>
> But the selection result like the following,
>
>
>
> 1,’Alex’,’123 street’
>
> null,null,null
>
> null,null,null
>
>
>
> If I insert the record in a single line, It was inserted perfectly
>
>
>
> insert into employee values (1,’Alex’,’123 street Tamilnadu India’);
>
>
>
> How to solve this ?
>
>
>
>
>
> Thanks,
>
> Karthick Ramu
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Reply via email to