Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active September 11, 2016 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroyuki-sato/3da10ae9fbebcd7ba37344b7ac7e70de to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/3da10ae9fbebcd7ba37344b7ac7e70de to your computer and use it in GitHub Desktop.
embulk-input-mysql error
in:
  type: mysql
  user: root
  password: xxxxx
  host: 127.0.0.1
  port: 3306
  table: gis_point
  database: embulk_test
  column_options:
    g: { value_type: string }
out:
  type: stdin
*************************** 1 ***************************
g (string) : [B@643f6179
*************************** 2 ***************************
g (string) : [B@12fccff0
*************************** 3 ***************************
g (string) : [B@5d767218
*************************** 4 ***************************
g (string) : [B@510da778

The unsupported column type raise same error message even set column_options.

Reporeted-by @mao_instantlife

Environment

  • MySQL 5.7
  • Embulk 0.8.13
  • embulk-input-jdbc 0.7.3

setup

CREATE TABLE gis_point  (g POINT);
SHOW FIELDS FROM gis_point;
INSERT INTO gis_point VALUES
    (PointFromText('POINT(10 10)')),
    (PointFromText('POINT(20 10)')),
    (PointFromText('POINT(20 20)')),
    (PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));

without column options

in:
  type: mysql
  user: root
  password: xxxx
  host: 127.0.0.1
  port: 3306
  table: gis_point
  database: embulk_test

Error: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:'

embulk preview -G /tmp/tt.yml
2016-09-06 19:38:50.002 +0900: Embulk v0.8.13
2016-09-06 19:38:51.930 +0900 [INFO] (0001:preview): Loaded plugin embulk-input-mysql (0.7.3)
2016-09-06 19:38:51.993 +0900 [INFO] (0001:preview): Fetch size is 10000. Using server-side prepared statement.
java.lang.UnsupportedOperationException: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:' option
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.unsupportedOperationException(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:190)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.sqlTypeToValueType(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:164)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.newColumnGetter(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:41)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.newColumnGetter(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:33)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.newColumnGetters(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:474)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.setupTask(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:254)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.transaction(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:188)
        at org.embulk.exec.PreviewExecutor.doPreview(org/embulk/exec/PreviewExecutor.java:108)
        at org.embulk.exec.PreviewExecutor.doPreview(org/embulk/exec/PreviewExecutor.java:101)
        at org.embulk.exec.PreviewExecutor.access$000(org/embulk/exec/PreviewExecutor.java:30)
        at org.embulk.exec.PreviewExecutor$1.run(org/embulk/exec/PreviewExecutor.java:70)
        at org.embulk.exec.PreviewExecutor$1.run(org/embulk/exec/PreviewExecutor.java:66)
        at org.embulk.spi.Exec.doWith(org/embulk/spi/Exec.java:25)
        at org.embulk.exec.PreviewExecutor.preview(org/embulk/exec/PreviewExecutor.java:66)
        at org.embulk.EmbulkEmbed.preview(org/embulk/EmbulkEmbed.java:169)
        at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
        at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453)
        at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:314)
        at RUBY.preview(/Users/hsato/.embulk/bin/embulk!/embulk/runner.rb:35)
        at RUBY.run(/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_run.rb:305)
        at RUBY.<top>(/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_main.rb:2)
        at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:849)
        at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2986)
        at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:951)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:944)
        at RUBY.(root)(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1)
        at Users.hsato.$_dot_embulk.bin.embulk.embulk.command.embulk_bundle.<top>(file:/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_bundle.rb:51)
        at java.lang.invoke.MethodHandle.invokeWithArguments(java/lang/invoke/MethodHandle.java:627)
        at org.jruby.Ruby.runScript(org/jruby/Ruby.java:833)
        at org.jruby.Ruby.runScript(org/jruby/Ruby.java:825)
        at org.jruby.Ruby.runNormally(org/jruby/Ruby.java:760)
        at org.jruby.Ruby.runFromMain(org/jruby/Ruby.java:579)
        at org.jruby.Main.doRunFromMain(org/jruby/Main.java:425)
        at org.jruby.Main.internalRun(org/jruby/Main.java:313)
        at org.jruby.Main.run(org/jruby/Main.java:242)
        at org.jruby.Main.main(org/jruby/Main.java:204)
        at org.embulk.cli.Main.main(org/embulk/cli/Main.java:23)

Error: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:'

With column_options

in:
  type: mysql
  user: root
  password: xxxxx
  host: 127.0.0.1
  port: 3306
  table: gis_point
  database: embulk_test
  column_options:
    g: { type: string }

java.lang.UnsupportedOperationException: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:' option

hsato-mbp:arch_nritv_base hsato$ embulk preview -G /tmp/tt.yml
2016-09-06 19:40:00.735 +0900: Embulk v0.8.13
2016-09-06 19:40:02.623 +0900 [INFO] (0001:preview): Loaded plugin embulk-input-mysql (0.7.3)
2016-09-06 19:40:02.678 +0900 [INFO] (0001:preview): Fetch size is 10000. Using server-side prepared statement.
java.lang.UnsupportedOperationException: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:' option
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.unsupportedOperationException(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:190)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.sqlTypeToValueType(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:164)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.newColumnGetter(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:41)
        at org.embulk.input.jdbc.getter.ColumnGetterFactory.newColumnGetter(org/embulk/input/jdbc/getter/ColumnGetterFactory.java:33)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.newColumnGetters(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:474)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.setupTask(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:254)
        at org.embulk.input.jdbc.AbstractJdbcInputPlugin.transaction(org/embulk/input/jdbc/AbstractJdbcInputPlugin.java:188)
        at org.embulk.exec.PreviewExecutor.doPreview(org/embulk/exec/PreviewExecutor.java:108)
        at org.embulk.exec.PreviewExecutor.doPreview(org/embulk/exec/PreviewExecutor.java:101)
        at org.embulk.exec.PreviewExecutor.access$000(org/embulk/exec/PreviewExecutor.java:30)
        at org.embulk.exec.PreviewExecutor$1.run(org/embulk/exec/PreviewExecutor.java:70)
        at org.embulk.exec.PreviewExecutor$1.run(org/embulk/exec/PreviewExecutor.java:66)
        at org.embulk.spi.Exec.doWith(org/embulk/spi/Exec.java:25)
        at org.embulk.exec.PreviewExecutor.preview(org/embulk/exec/PreviewExecutor.java:66)
        at org.embulk.EmbulkEmbed.preview(org/embulk/EmbulkEmbed.java:169)
        at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
        at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453)
        at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:314)
        at RUBY.preview(/Users/hsato/.embulk/bin/embulk!/embulk/runner.rb:35)
        at RUBY.run(/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_run.rb:305)
        at RUBY.<top>(/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_main.rb:2)
        at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:849)
        at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2986)
        at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:951)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:944)
        at RUBY.(root)(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1)
        at Users.hsato.$_dot_embulk.bin.embulk.embulk.command.embulk_bundle.<top>(file:/Users/hsato/.embulk/bin/embulk!/embulk/command/embulk_bundle.rb:51)
        at java.lang.invoke.MethodHandle.invokeWithArguments(java/lang/invoke/MethodHandle.java:627)
        at org.jruby.Ruby.runScript(org/jruby/Ruby.java:833)
        at org.jruby.Ruby.runScript(org/jruby/Ruby.java:825)
        at org.jruby.Ruby.runNormally(org/jruby/Ruby.java:760)
        at org.jruby.Ruby.runFromMain(org/jruby/Ruby.java:579)
        at org.jruby.Main.doRunFromMain(org/jruby/Main.java:425)
        at org.jruby.Main.internalRun(org/jruby/Main.java:313)
        at org.jruby.Main.run(org/jruby/Main.java:242)
        at org.jruby.Main.main(org/jruby/Main.java:204)
        at org.embulk.cli.Main.main(org/embulk/cli/Main.java:23)

Error: Unsupported type GEOMETRY (sqlType=-2) of 'g' column. Please add 'g: {type: string}' to 'column_options: {...}' option to convert the values to strings, or exclude the column from 'select:' option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment