[FLINK-36741][transform] Fix the decimal precision and length lost during transform
This closes #3740pull/3810/merge
parent
8b554458d3
commit
79e868b864
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class BinaryTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.BINARY(17);
|
||||
}
|
||||
|
||||
public byte[] eval() {
|
||||
return "xyzzy".getBytes();
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class CharTypeReturningClass implements UserDefinedFunction {
|
||||
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.CHAR(17);
|
||||
}
|
||||
|
||||
public String eval() {
|
||||
return "This is a string.";
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.data.DecimalData;
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class DecimalTypeNonNullReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.DECIMAL(10, 3).notNull();
|
||||
}
|
||||
|
||||
public DecimalData eval() {
|
||||
return DecimalData.fromBigDecimal(new BigDecimal("12.315"), 10, 3);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.data.DecimalData;
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class DecimalTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.DECIMAL(10, 3);
|
||||
}
|
||||
|
||||
public DecimalData eval() {
|
||||
return DecimalData.fromBigDecimal(new BigDecimal("12.315"), 10, 3);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.data.LocalZonedTimestampData;
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class LocalZonedTimestampTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.TIMESTAMP_LTZ(2);
|
||||
}
|
||||
|
||||
public LocalZonedTimestampData eval() {
|
||||
return LocalZonedTimestampData.fromEpochMillis(24 * 60 * 60 * 1000);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.data.TimestampData;
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class TimestampTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.TIMESTAMP(2);
|
||||
}
|
||||
|
||||
public TimestampData eval() {
|
||||
return TimestampData.fromMillis(24 * 60 * 60 * 1000);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class VarBinaryTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.VARBINARY(17);
|
||||
}
|
||||
|
||||
public byte[] eval() {
|
||||
return "xyzzy".getBytes();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.java.precision;
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType;
|
||||
import org.apache.flink.cdc.common.types.DataTypes;
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction;
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
public class VarCharTypeReturningClass implements UserDefinedFunction {
|
||||
@Override
|
||||
public DataType getReturnType() {
|
||||
return DataTypes.VARCHAR(17);
|
||||
}
|
||||
|
||||
public String eval() {
|
||||
return "This is a string.";
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class BinaryTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.BINARY(17)
|
||||
def eval: Array[Byte] = "xyzzy".getBytes
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class CharTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.CHAR(17)
|
||||
def eval = "This is a string."
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.data.DecimalData
|
||||
import org.apache.flink.cdc.common.types.{DataType, DataTypes}
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
import java.math.BigDecimal
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class DecimalTypeNonNullReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.DECIMAL(10, 3).notNull()
|
||||
def eval: DecimalData = DecimalData.fromBigDecimal(new BigDecimal("12.315"), 10, 3)
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.data.DecimalData
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
import java.math.BigDecimal
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class DecimalTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.DECIMAL(10, 3)
|
||||
def eval: DecimalData = DecimalData.fromBigDecimal(new BigDecimal("12.315"), 10, 3)
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.data.LocalZonedTimestampData
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class LocalZonedTimestampTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.TIMESTAMP_LTZ(2)
|
||||
def eval: LocalZonedTimestampData = LocalZonedTimestampData.fromEpochMillis(24 * 60 * 60 * 1000)
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.data.TimestampData
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class TimestampTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.TIMESTAMP(2)
|
||||
def eval: TimestampData = TimestampData.fromMillis(24 * 60 * 60 * 1000)
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class VarBinaryTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.VARBINARY(17)
|
||||
def eval: Array[Byte] = "xyzzy".getBytes
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.flink.cdc.udf.examples.scala.precision
|
||||
|
||||
import org.apache.flink.cdc.common.types.DataType
|
||||
import org.apache.flink.cdc.common.types.DataTypes
|
||||
import org.apache.flink.cdc.common.udf.UserDefinedFunction
|
||||
|
||||
/** This is an example UDF class for testing purposes only. */
|
||||
class VarCharTypeReturningClass extends UserDefinedFunction {
|
||||
override def getReturnType: DataType = DataTypes.VARCHAR(17)
|
||||
def eval = "This is a string."
|
||||
}
|
Loading…
Reference in New Issue