Skip to content

[BEAM-2151]Fix inconsistent mapping for SQL FLOAT#2886

Closed
xumingming wants to merge 4 commits intoapache:DSL_SQLfrom
xumingming:BEAM-2151
Closed

[BEAM-2151]Fix inconsistent mapping for SQL FLOAT#2886
xumingming wants to merge 4 commits intoapache:DSL_SQLfrom
xumingming:BEAM-2151

Conversation

@xumingming
Copy link
Contributor

This pull request is mainly to fix the SQL FLOAT mapping, previously it is mapped to Float in BeamSQLRow, but mapped to Double in BeamSQLRowCoder, now we consistently map SQL FLOAT to java Float.

When try to unit test this, found another bug in BeamSQLRow: the VARCHAR field is not encode/decoded correctly(mainly because OUTTER Context vs NESTED Context), so fixed this bug at the same time.

@xumingming
Copy link
Contributor Author

Hi @xumingmin , can you take a look at this one?

case FLOAT:
record.addField(idx, doubleCoder.decode(inStream, context));
Double raw = doubleCoder.decode(inStream, nested);
Float actual = (raw == null) ? null : raw.floatValue();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null should not appear here, it's already ignored in the start of loop;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.

BeamSqlRowCoder coder = BeamSqlRowCoder.of();
CoderProperties.coderDecodeEncodeEqual(coder, row);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also have a test case to cover decoder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoderProperties.coderDecodeEncodeEqual actually will test both encode and decode, I will rename the test method name encode to some name more appropriate.

<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be removed? don't see it's used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indirectly depended by CoderProperties.coderDecodeEncodeEqual

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version should be inherited; no need to specify it here.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 13c3136 on xumingming:BEAM-2151 into ** on apache:DSL_SQL**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 13c3136 on xumingming:BEAM-2151 into ** on apache:DSL_SQL**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 7fa94f8 on xumingming:BEAM-2151 into ** on apache:DSL_SQL**.

@mingmxu
Copy link

mingmxu commented May 4, 2017

Thanks @xumingming for your contribution.

LGTM

<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version should be inherited; no need to specify it here.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2d92a6c on xumingming:BEAM-2151 into ** on apache:DSL_SQL**.

@mingmxu
Copy link

mingmxu commented May 4, 2017

Retest this please

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2d92a6c on xumingming:BEAM-2151 into ** on apache:DSL_SQL**.

asfgit pushed a commit that referenced this pull request May 7, 2017
@davorbonaci
Copy link
Member

Merged. Please close at your leisure.

@xumingming xumingming closed this May 7, 2017
@xumingming xumingming deleted the BEAM-2151 branch May 7, 2017 03:33
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

Successfully merging this pull request may close these issues.

4 participants