LioRoger / subscribe_example

subscribe from dts data store
63 stars 76 forks source link

MySQL的geometry数据类型,获取不到值 #15

Open mrsongjiangtao opened 4 years ago

mrsongjiangtao commented 4 years ago

对应的适配器代码: static class GeometryAdapter implements DataAdapter { public FieldValue getFieldValue(Object data) { FieldValue fieldValue = new FieldValue(); if (null != data) { com.alibaba.dts.formats.avro.BinaryGeometry geometry = (com.alibaba.dts.formats.avro.BinaryGeometry) data; fieldValue.setValue(getBytes(geometry.getValue())); } return fieldValue; } }

拿到的值是,通过Object的tostring转换的值

mrsongjiangtao commented 4 years ago

还有blob类型的数据....也拿不到,看来只能自己改?

denghw3 commented 4 years ago

还有blob类型的数据....也拿不到,看来只能自己改?

能成功跑起来吗?

mrsongjiangtao commented 4 years ago

还有blob类型的数据....也拿不到,看来只能自己改?

能成功跑起来吗?

可以的,就是拿不到数据

static class BinaryAdapter implements DataAdapter { public FieldValue getFieldValue(Object data) {

        FieldValue fieldValue = new FieldValue();
        if (null != data) {
            com.alibaba.dts.formats.avro.BinaryObject binaryObject = (com.alibaba.dts.formats.avro.BinaryObject) data;
            fieldValue.setValue(getBytes(binaryObject.getValue()));
        }
        return fieldValue;
    }
}

他的demo,blob数据和geometry数据都没有设置encoding

if (encoding==null) { return super.toString(); }

然后输出的就是该对象.tostring

denghw3 commented 4 years ago

我跑起来,kafka消费一直报超时 宋江涛 notifications@github.com 于2020年3月24日周二 下午1:14写道:

还有blob类型的数据....也拿不到,看来只能自己改?

能成功跑起来吗?

可以的,就是拿不到数据

static class BinaryAdapter implements DataAdapter { public FieldValue getFieldValue(Object data) {

    FieldValue fieldValue = new FieldValue();

    if (null != data) {

        com.alibaba.dts.formats.avro.BinaryObject binaryObject = (com.alibaba.dts.formats.avro.BinaryObject) data;

        fieldValue.setValue(getBytes(binaryObject.getValue()));

    }

    return fieldValue;

}

}

他的demo,blob数据和geometry数据都没有设置encoding

if (encoding==null) { return super.toString(); }

然后输出的就是该对象.tostring

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LioRoger/subscribe_example/issues/15#issuecomment-603020281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHS6ZDZUAKN7KWNABQA753TRJA6SPANCNFSM4LRVZZBQ .