Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I execute CsvScanExample.java in idea,throw exception “Object 'custom_name_depts_0' not found ” #191

Open
bobqiu opened this issue Apr 11, 2020 · 4 comments
Assignees

Comments

@bobqiu
Copy link

bobqiu commented Apr 11, 2020

Versions

0.7.0

Describe the bug

CsvScanExample.java:
`package com.qihoo.qsql;

import com.qihoo.qsql.api.SqlRunner;
import com.qihoo.qsql.api.SqlRunner.Builder.RunnerType;
import com.qihoo.qsql.env.RuntimeEnv;
import java.io.IOException;

public class CsvScanExample {

/**
 * If you want to execute in the IDE, adjust the scope of the spark package in the parent pom to compile.
 * 如果希望在IDE中执行spark和flink的样例代码,请调整父pom中的spark、flink的scope值为compile。
 * @param args nothing
 */
public static void main(String[] args) throws IOException {
    RuntimeEnv.init();
    String sql = "select * from depts";
    SqlRunner.Builder.RunnerType runnerType = RunnerType.value(args.length < 1 ? "flink" : args[0]);
    SqlRunner runner = SqlRunner.builder()
        .setTransformRunner(runnerType)
        .setSchemaPath(RuntimeEnv.metadata)
        .setAppName("test_csv_app")
        .setAcceptedResultsNum(100)
        .ok();
    runner.sql(sql).show();
    System.exit(0);
}

}`

Output:
Elasticsearch Embedded Server has started!! Your query is running... Exception in thread "main" java.lang.RuntimeException: org.apache.flink.table.api.ValidationException: SQL validation failed. From line 1, column 26 to line 1, column 44: Object 'custom_name_depts_0' not found at com.qihoo.qsql.exec.flink.FlinkPipeline.show(FlinkPipeline.java:62) at com.qihoo.qsql.CsvScanExample.main(CsvScanExample.java:25) Caused by: org.apache.flink.table.api.ValidationException: SQL validation failed. From line 1, column 26 to line 1, column 44: Object 'custom_name_depts_0' not found at org.apache.flink.table.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:128) at org.apache.flink.table.api.internal.TableEnvImpl.sqlQuery(TableEnvImpl.scala:431) at Requirement36311.execute(Requirement36311.java:25) at com.qihoo.qsql.exec.flink.FlinkPipeline.show(FlinkPipeline.java:60) ... 1 more Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 26 to line 1, column 44: Object 'custom_name_depts_0' not found at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:824) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:809) at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4807) at org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:172) at org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:177) at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:997) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:957) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3111) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3093) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3365) at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:997) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:957) at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:932) at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:639) at org.apache.flink.table.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:124) ... 4 more Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Object 'custom_name_depts_0' not found at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) ... 23 more

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

If applicable, add screenshots to help explain your problem.
But do not paste log screenshots here.

Full Output Logs

Please paste your log here.

Additional context

Add any other context about the problem here.

@bobqiu
Copy link
Author

bobqiu commented Apr 11, 2020

I find out the resolve:
`public class CsvScanExample {

/**
 * If you want to execute in the IDE, adjust the scope of the spark package in the parent pom to compile.
 * 如果希望在IDE中执行spark和flink的样例代码,请调整父pom中的spark、flink的scope值为compile。
 * @param args nothing
 */
public static void main(String[] args) throws IOException {
    RuntimeEnv.init();
    String sql = "select * from depts";
    SqlRunner.Builder.RunnerType runnerType = RunnerType.value(args.length < 1 ? "**default**" : args[0]);
    SqlRunner runner = SqlRunner.builder()
        .setTransformRunner(runnerType)
        .setSchemaPath(RuntimeEnv.metadata)
        .setAppName("test_csv_app")
        .setAcceptedResultsNum(100)
        .ok();
    runner.sql(sql).show();
    System.exit(0);
}

}`

@bobqiu bobqiu closed this as completed Apr 11, 2020
@bobqiu bobqiu reopened this Apr 12, 2020
@bobqiu
Copy link
Author

bobqiu commented Apr 12, 2020

when I run it on flink,throw “ Object 'custom_name_depts_0' not found ”

@Foster9527
Copy link
Collaborator

Flink does not currently support scv query,please use spark

@bobqiu
Copy link
Author

bobqiu commented Apr 15, 2020

This is the example code in "com.qihoo.qsql.SimpleQueryByFlinkExample" of example project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants