java.lang.IllegalArgumentException:未找到表My_Table通过Apache Phoenix中的PSQL插入数据

时间:2019-04-10 22:46:12

标签: hbase phoenix

我正在通过Apache Phoenix中的PSQL(psql.py)加载批量数据的过程,但是由于某些原因使我抛出此错误:

const myFunction = (props) => {
  const [count1, setCount1] = useState(0)
  const [count2, setCount2] = useState(0)

  const handleChange1 = ({ target: { value } }) => {
    setCount1(value)
    props.onCount1Change(value)
  }

  const handleChange2 = ({ target: { value } }) => {
    setCount2(value)
    props.onCount2Change(value)
  }

  useEffect(() => {
    props.someRandomStuffs(count1, count2);
  }, [])

  return (
    <div>
      <input type="text" value={count1} onChange={handleChange1} />
      <input type="text" value={count2} onChange={handleChange2} />
    </div>
  )
}

根据Phoenix教程https://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html,我需要拥有3个文件; java.lang.IllegalArgumentException: Table "My_Table" not found at org.apache.phoenix.util.SchemaUtil.generateColumnInfo(SchemaUtil.java:887) at org.apache.phoenix.util.CSVCommonsLoader.buildColumnInfoList(CSVCommonsLoader.java:259) at org.apache.phoenix.util.CSVCommonsLoader.upsert(CSVCommonsLoader.java:206) at org.apache.phoenix.util.CSVCommonsLoader.upsert(CSVCommonsLoader.java:182) at org.apache.phoenix.util.PhoenixRuntime.main(PhoenixRuntime.java:273) my_table.sqlmy_table.csv

并启动以下命令:

my_table_queries.sql

这些文件的内容如下:

my_table.sql

 ./psql.py <your_zookeeper_quorum> my_table.sql my_table.csv my_table_queries.sql

my_table.csv

 CREATE TABLE IF NOT EXISTS "some_namespace:my_table" (id BIGINT NOT NULL, username VARCHAR NOT NULL, CONSTRAINT my_pk PRIMARY KEY (id, username));

my_table_queries.sql

 1,Martha
 2,Scott
 3,David
 4,Alex
 5,Vicky

当我通过sqlline.py访问Phoenix时,表在那里,但根本没有数据。我应该先创建表格还是以其他方式创建表格?

1 个答案:

答案 0 :(得分:1)

在Phoenix中,表名称似乎区分大小写。由于创建表时已用双引号引起来,因此在运行批量装入作业时只需传递双引号即可。

my_table.sql

 CREATE TABLE IF NOT EXISTS "MY_TABLE" (id BIGINT NOT NULL, username VARCHAR NOT NULL, CONSTRAINT my_pk PRIMARY KEY (id, username));

my_table_queries.sql:

 SELECT id as "ID's", username as "User Name"
 FROM "MY_TABLE"
 GROUP BY id
 ORDER BY count(username) DESC;

已被报告:https://issues.apache.org/jira/browse/PHOENIX-3541?attachmentSortBy=dateTime

您还可以查看有关区分大小写的http://apache-phoenix-user-list.1124778.n5.nabble.com/Load-into-Phoenix-table-via-CsvBulkLoadTool-cannot-find-table-and-fails-td2792.html

的说明

现在,如果要使用.csv文件将批量数据加载到HBASE中,可以尝试以下操作:http://dwgeek.com/apache-hbase-bulk-load-csv-examples.html/