question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: NPE when INSERT INTO b SELECT * FROM a

See original GitHub issue

Maybe directly related to #10851


CrateDB version: 4.3.2

Environment description: CrateDB Cloud - Dev Cluster

  • 3x 0.25 vCPUs
  • 3x 2 GB Memory (0.5 GB Heap)

Problem description:

  • 1 TIMESTAMP column (PK)
  • ~ 190 DOUBLE PRECISION columns
  • ~ 10 TEXT columns
CREATE TABLE open_pv (
    DateTime TIMESTAMPTZ PRIMARY KEY ,
  temperature_outdoor_fantasytown_weather DOUBLE PRECISION,
  ...
  c_phase_voltage_brightcounty_pv DOUBLE PRECISION);
  • 103.2 MB (Size primary shard)
  • 23,422 records

when creating a second table open_pv2 with the schema as open_pv and trying to copy the data with

INSERT INTO open_pv2 SELECT * FROM open_pv
-- INSERT ERROR (0.000 sec)

this leads to the following error

NullPointerException[Cannot invoke "org.elasticsearch.common.io.stream.Writeable$Reader.read(org.elasticsearch.common.io.stream.StreamInput)" because "this.reader" is null]

Limiting the number by using LIMIT 10000; the query succedes

INSERT INTO open_pv2 SELECT * FROM open_pv LIMIT 10000;
-- INSERT OK, 10000 rows affected (37.742 sec)

Steps to reproduce:

  1. Create Table open_pv
CREATE TABLE open_pv (
    DateTime TIMESTAMPTZ PRIMARY KEY ,
  temperature_outdoor_fantasytown_weather DOUBLE PRECISION,
  ...
  c_phase_voltage_brightcounty_pv DOUBLE PRECISION);
  1. Insert ~25.000 rows

  2. Create Table open_pv2

CREATE TABLE open_pv2 (
    DateTime TIMESTAMPTZ PRIMARY KEY ,
  temperature_outdoor_fantasytown_weather DOUBLE PRECISION,
  ...
  c_phase_voltage_brightcounty_pv DOUBLE PRECISION);
  1. Try to copy table with INSERT SELECT FROM
INSERT INTO open_pv2 SELECT * FROM open_pv
-- INSERT ERROR (0.000 sec)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
seutcommented, Jan 4, 2021

@proddata We’ve fixed this by #10882, it will be part of the next 4.3 release. Thank you again for reporting.

0reactions
seutcommented, Jan 4, 2021

@proddata Thank you for that information, we are now able to reproduce the issue and working on a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nullpointerexception when trying to insert a value into SQLite
I'm trying to insert some values into an SQLite Database which are entered by the user, however when I press the button to...
Read more >
java.lang.NullPointerException when doing SQL on ms access
I am trying to perform Insert and delete commands on an access ... Everything is fine when i do a Select * FROM...,...
Read more >
NullPointerException when void convert to varchar using Tez
NullPointerException when void convert to varchar using Tez. Status: ... insert into testTezVarchar select a1 as a,b1 as b from testTezVoid; ...
Read more >
CaseExpr toThrift NPE · Issue #3854 · apache/doris - GitHub
SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END FROM t1 ORDER BY 1;. 2020-06-13 10:58:36,086 ...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
Some of the common reasons for NullPointerException in java programs are: ... Sometimes we get an error page response from a java web ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found